I was hoping that there might be some way to attach significance code like the ones from summary.lm to a dataframe. Anyone know how to do something like that. Here is the function i'd like to add that functionality to:
add1.coef <- function(model,scope,test="F",p.value=1,order.by.p=FALSE) { num <- length(model$coefficients) add <- add1(model,scope,test=test) sub <- subset(add,add$'Pr(F)'<=p.value) est <- sapply(rownames(sub), function(x) update(model,paste("~ . +",x))$coefficients[num+1]) ret <- data.frame(est,sub$'Pr(F)') colnames(ret) <- c("Estimate","Pr(F)") rownames(ret) <- rownames(sub) ret <- format(ret,digits=1,nsmall=1,scientific=F) if (order.by.p) { ret <- ret[order(ret$'Pr(F)'),]} return(ret) } fscope <- as.formula(paste("dep.sign.up ~ ", paste(names(lr)[2:10], collapse= "+"))) rslt <- add1.coef(lm(dep.sign.up ~ 1, data=lr),fscope,p.value=1,order.by.p=FALSE) Estimate Pr(F) r1.pop.total 0.02 0.09 r1.pop.household 0.05 0.09 r1.pop.female 0.03 0.09 r1.pop.pct.female 14594.39 0.35 r1.pop.male 0.04 0.08 r1.pop.pct.male -13827.51 0.37 r1.pop.density 0.06 0.09 r1.age.0.4.pct 14581.65 0.39 r1.age.5.14.pct 2849.15 0.76 -- View this message in context: http://r.789695.n4.nabble.com/Add-Significance-Codes-to-Data-Frame-tp2289263p2289263.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.