here is one way:
x <- rnorm(100)
y <- 1:100
g <- c(rep("a",50),rep("b",50))
library(lme4)
mod1 <- glmer(y ~ x + (1|g) )
summary(mod1)
library(memisc)
getSummary.mer(mod1)$coef
write.csv(getSummary.mer(mod1)$coef,"answer.csv")
this should give what I think your looking for, but your model is of class mer
not a matrix
or data.frame
:
class(mod1)
[1] "mer"
attr(,"package")
[1] "lme4"
class(getSummary.mer(mod1)$coef)
[1] "matrix"
which is why you cannot just write to a file as you wanted.
EDIT
also now:
summary(mod1)$coefficients
write.csv( summary(mod1)$coefficients )