look <- function(out){ ss <- summary(out) print(ss$call) cat("Residuals:\n") print(summary(ss$resid)) cat(paste("Rsquared: ",round(ss$r.squared,3),"\n")) print( round(ss$coef,3)) } # for use with the Box Cox poisons data make.table <- function(data){ the.table <- matrix(data,nrow=12,ncol=4) # easier to display pnames <- paste(rep(c("I","II","III"),each=4),1:4,sep=".") tnames <- LETTERS[1:4] # dimnames(the.table) <- list(rep(c("I","II","III"),each=4),LETTERS[1:4]) dimnames(the.table) <- list(pnames,tnames) return(the.table) } BC.coeff <- function(out,digits=1,do.print=T){ coeff <- summary(out)$coeff[,1:2] dd <- dimnames(coeff) dd[[1]] <- gsub("(p|t)\\K[a-z]*","",dd[[1]],perl=T) dd[[2]] <- c("Est","StdErr") dimnames(coeff) <- dd cc <- out$call if(do.print){ print(out$call) print( t(coeff),digits ) }else{ # for combining with other output the.call <- paste(cc[1],"(",cc[2],",", cc[3],")",collapse="") return( list( CALL=the.call, COEFF= t(coeff))) } } lose.some <- function(num.samples=5,lose=4){ set.seed(0) COEFF <- matrix(0,ncol=8,nrow=num.samples+1) dimnames(COEFF)[[2]] <- names(mab.hat) COEFF[1,] <- mab.hat dimnames(COEFF)[[1]] <- c("full",rep("sample",num.samples)) for (nn in 1:(num.samples)){ rows <- sample(48, 48-lose,replace=T) out <- lm(rate ~ Ht + Hp , BC,subset=rows) COEFF[1+nn,] <- as.vector(M.HtHp %*% out$coeff) } return(COEFF) }