lm0 <- lm(sr ~ pop15 + pop75, data = LifeCycleSavings)
lm1 <- lm(sr ~ dpi + ddpi, data = LifeCycleSavings)
lm2 <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
mtable123 <- mtable("Model 1"=lm0,"Model 2"=lm1,"Model 3"=lm2,
summary.stats=c("sigma","R-squared","F","p","N"))
(mtable123 <- relabel(mtable123,
"(Intercept)" = "Constant",
pop15 = "Percentage of population under 15",
pop75 = "Percentage of population over 75",
dpi = "Real per-capita disposable income",
ddpi = "Growth rate of real per-capita disp. income"
))
# This produces output in tab-delimited format:
write.mtable(mtable123)
# This produces output in tab-delimited format:
file123 <- "mtable123.txt"
write.mtable(mtable123,file=file123)
file.show(file123)
# The contents of this file can be pasted into Word
# and converted into a Word table.
toLatex(mtable123)
texfile123 <- "mtable123.tex"
write.mtable(mtable123,forLaTeX=TRUE,file=texfile123)
file.show(texfile123)
berkeley <- Aggregate(Table(Admit,Freq)~.,data=UCBAdmissions)
berk0 <- glm(cbind(Admitted,Rejected)~1,data=berkeley,family="binomial")
berk1 <- glm(cbind(Admitted,Rejected)~Gender,data=berkeley,family="binomial")
berk2 <- glm(cbind(Admitted,Rejected)~Gender+Dept,data=berkeley,family="binomial")
mtable(berk0,summary.stats=c("Deviance","N"))
mtable(berk0,drop=FALSE,summary.stats=c("Deviance","N"))
mtable(berk1,summary.stats=c("Deviance","N"))
mtable(berk1,drop=FALSE,summary.stats=c("Deviance","N"))
mtable(berk0,berk1,berk2,summary.stats=c("Deviance","N"))
mtable(berk0,berk1,berk2,
coef.style="horizontal",
summary.stats=c("Deviance","AIC","N"))
mtable(berk0,berk1,berk2,
coef.style="stat",
summary.stats=c("Deviance","AIC","N"))
mtable(berk0,berk1,berk2,
coef.style="ci",
summary.stats=c("Deviance","AIC","N"))
mtable(berk0,berk1,berk2,
coef.style="ci.se",
summary.stats=c("Deviance","AIC","N"))
mtable(berk0,berk1,berk2,
coef.style="ci.se.horizontal",
summary.stats=c("Deviance","AIC","N"))
mtable(berk0,berk1,berk2,
coef.style="ci.p.horizontal",
summary.stats=c("Deviance","AIC","N"))
mtable(berk0,berk1,berk2,
coef.style="all",
summary.stats=c("Deviance","AIC","N"))
mtable(berk0,berk1,berk2,
coef.style="all.nostar",
summary.stats=c("Deviance","AIC","N"))
mtable(by(berkeley,berkeley$Dept,function(x)glm(cbind(Admitted,Rejected)~Gender,
data=x,family="binomial")),
summary.stats=c("Likelihood-ratio","N"))
mtable(By(~Gender,glm(cbind(Admitted,Rejected)~Dept,family="binomial"),
data=berkeley),
summary.stats=c("Likelihood-ratio","N"))
berkfull <- glm(cbind(Admitted,Rejected)~Dept/Gender - 1,
data=berkeley,family="binomial")
relabel(mtable(berkfull),Dept="Department",gsub=TRUE)
Run the code above in your browser using DataLab