If you're reporting on the results of a statistical analysis for a journal or report, you'll probably be building a table comparing two or models. Such tables may include variables in the model, parameter estimates, and p-values, and model summary statistics. If you want to include such tables based on lm, glm, svyglm, gee, gam, polr, survreg or coxph models in a LaTeX document, Marek Hlavac's stargazer package may save you some time. Just give it some model objects and title labels, and you'll get a table something like this:
The table style above is based on that of the International Organization journal. Other journal styles supported are: American Economic Review (AER), American Journal of Political Science (AJPS), American Journal of Sociology (AJS), Administrative Science Quarterly (ASQ), American Sociological Review (ASR), American Political Science Review (APSR), Demography, International Organization (IO) and the Journal of Policy Analysis and Management (JPAM). This list covers the syle of most top science journals, but if you need something different, you can either tweak the generated LaTeX code, or modify the R code of the stargazer function itself.
You can download the stargazer package from CRAN at the link below.
[Updated Oct 16 to add the list of supported journal styles.]
CRAN: Package stargazer
Thanks for the pointer. For the record: The mtable() function from the "memisc" package can produce similarly formatted tables. It has both a print() method for display within R and a toLatex() method for usage in LaTeX, Sweave, etc.
Furthermore, unlike stargazer the memisc package is easily extensible to additional model classes by suitable methods. Recently, I've sent the memisc author (Martin Elff) such extensions for AER::tobit, AER::ivreg, nnet::multinom, pscl::zeroinfl, pscl::hurdle, betareg::betareg. Martin will include these in the next memisc release. Anyone interested to use these before the release, just let me know.
Posted by: Z | October 15, 2012 at 23:42