Question

Does anyone know a way to produce a nice publication quality LaTeX table from an lme4 mer object? Neither the xtable method (package xtable) nor the latex method (package Hmisc) know how to deal with mer objects.

For example, given this fit:

library(lme4)    
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)

Are there any options for producing a nice LaTeX table of the coefficient estimates for both the fixed and random effects?

EDIT:

Because this is somewhat buried in the comment threads below, note that a community wiki is in development for R LaTeX tables: Tools for making latex tables in R

Was it helpful?

Solution

Here is a blog post that seems tailor made for this situation Latex Tables for lme4 Models

OTHER TIPS

The answer may be a bit late, but perhaps somebody may find it interesting:

library("texreg")
texreg(fm1)

To typeset multiple lme4 or other models side by side, use something like this:

texreg(list(fm1, fm2))

I may have a hacky solution. I wanted the same thing, specifically the table of coefficients from a glmer model fit (the estimates, SEs, z, and p values). Finding the right part of the summary output and feeding that into xtable seems to have done the trick. Apologies for not supplying reproducible code & data, but from your original example:

fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
xtable(summary(fm1)@coef)

Should give you the table of coefficients, SEs, etc. Note that it just gives the values, not the extra dressing-up of significance stars, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top