[R] Adding correlation and or variance structure in mixed models
Ben Bolker
bbolker at gmail.com
Tue Apr 8 00:31:00 CEST 2014
Laz <lmramba <at> ufl.edu> writes:
>
> Dear R users,
>
> I am using mixed models to analyze genetic experiments. I have tried to
> use R packages such as lme4, nlme. I am looking for a model that can
> allow me to specify my correlation structure and the same time allow to
> have more than 2 random effects in the model. None of the above packages
> fully answer my question and some results obtained have incorrect
> degrees of freedom at some point.
>
> For example: Y = XB + Z1g + Z2f + e
> where X is the design matrix of fixed effect, B is the vector of fixed
> effect, Z1 is a random design matrix of the first random variable,g,
> and g is the vector of the random effect g, Z2 is random design matrix
> of the second random variable, and f is a vector of the random effect
> f., e is the residual error.
> If I need to specify an autocorrelation structure such as AR1
> (autocorrelation 1st order) or CORG (general correlation) how would I do
> that in R? the functions provided do not allow to specify this term
> except the gls but it does not take random effects.
>
> I am interested in specifying variance structures such as AR1V
> (autocorrelation 1st order), diagonal, uniform heterogeneous, uniform
> correlation, Unstrustured etc in my model that has both fixed and
> several random effects. Which R packages or functions will help me to
> accomplish this?
>
> Thanks.
> Laz
The lme() function in the nlme package allows you to do some but
not necessarily all of this, and is I think the closest you will get.
If by "more than one random effect" you mean *crossed* (as opposed to
nested) random effects, that will be a little more difficult, but it
is possible in lme: see Pinheiro and Bates 2000 p. 163.
For more information/detail you should ask this question at
r-sig-mixed-models at r-project.org , but it would be a good idea to
invest in a copy of Pinheiro and Bates 2000 and find out as much
as you can for yourself first.
Ben Bolker
More information about the R-help
mailing list