[R-sig-ME] basic question
Ben Bolker
bbolker at gmail.com
Thu Aug 2 03:51:57 CEST 2012
Rachel Cohen <stat.list at ...> writes:
> Hi, I have a very basic query (I think). If I fit a model of the
> specification given below how many model parameters are there? Am I
> correct in thinking that the model parameters are the fixed effects
> intercept and coefficients (in this case two of them) and also a
> parameter for within and for between group variance? So in total 5
> fitted parameters? or are there also covariance parameters?. I am
> trying to calculate the standard error of the residuals as:
Unfortunately, this is an easy question to state but not (in my
opinion) an easy question to answer unambiguously.
> RSE = ((sum(residuals^2))/(N - no.of parameters))
>
> and therefore need to know how many parameters my model actually has.
> I've gotten a little confused by the
> literature definitions of what constitutes a parameter.
It's confusing!
[snip]
A *reasonable* definition (although not the only one) would be
to count the number of fixed-effect parameters ('beta' in much
of the literature) and the number of random-effect parameters
(generally referred to as 'theta' in the lme4 documentation,
but varying a great deal among references):
length(fixef(model))+length(getME(model,"theta"))
in your case that's 3 parameters for the fixed effects
and 6 RE parameters (you have a 3x3 variance-covariance matrix of the
random effects, the matrix is symmetric, so counting the
diagonal plus one triangle gives 3*(3+1)/2 = 6). Generally one
doesn't count the residual variance since that is estimated
from the (penalized) residual sum of squares.
It really depends what you want to use the RSE for. It may
very well not have the properties you're expecting (i.e. the
properties that it has in a simple (non-mixed) linear model ...)
There's a bit more about parameter-counting issues at
http://glmm.wikidot.com/faq, I think ...
> model<-lmer((log.mass)~centre.log.dbh+centre.log.height+
> (1+centre.log.dbh+centre.log.height|species_site),
> data=allometry_2,REML=T)
>
> model summary output table:
>
> Linear mixed model fit by REML
> Formula: (log.mass) ~ centre.log.dbh + centre.log.height +
> (1 + centre.log.dbh + centre.log.height | species_site)
[snip]
> Random effects:
> Groups Name Variance Std.Dev. Corr
> species_site (Intercept) 0.061636 0.24827
> centre.log.dbh 0.279362 0.52855 0.575
> centre.log.height 0.285753 0.53456 -0.441 -0.755
> Residual 0.086963 0.29489
> Number of obs: 337, groups: species_site, 18
>
More information about the R-sig-mixed-models
mailing list