[R-sig-ME] mixed-effects model with crossed random effects

Ben Bolker bbolker at gmail.com
Fri Apr 24 20:26:31 CEST 2015


Magdalena Wiedermann <mwiederm at ...> writes:

> 
> Dear list,
> 
> I am using the nlme package to analyze a mixed effects model. I am 
> dealing with crossed random effects, meaning that I have repeated 
> measures in time and space (on a split plot design). We are sampling 
> water at two depth within one of each vegetation treatment (3 veg 
> treatments) organized in 4 blocks.
> 
> I figured that the code including the spacial component only would be!?:
> <-lme(responses~veg*depth*year*Month, random=~1|block/veg)
> 
> I am aware that 4 blocks is not pretty for it to be a random effect, but 
> I am not interested in it as fixed effects. Also I am aware that there 
> are very many philosophies and views on what a random effect is/should be.
> 
> Can anybody please help me with adding the temporal component in? 
> Samples on these plots were taken 5 times each year for 3 years => 15 
> times of repeated measures
> 
> I'd be more than happy about any suggestions, similar examples etc.
> Thank you so much!
> Lena


   It is possible to fit crossed random effects in lme (it's discussed
in one of the later chapters of Pinheiro and Bates), but it's a
bit of a hassle.  If you're willing to use lme4 instead (you can
use the lmerTest or pbkrtest if you need p-values, see ?pvalues)
this will be a little bit easier.

    Something like

  lmer(responses~veg + (veg|year/Month) + (veg|block), data= ...)

would seem to be a reasonable guess, although it may be too much
for your data since you will be estimating 3 3x3 variance-covariance
matrices of veg responses (within year, within Month-within-year,
within block).  I don't know whether you have trends over
the course of your time series (e.g. add a numeric covariate of
time period to the fixed effects) or consistent seasonal effects
(e.g. make your model (veg|year) + (veg|Month) + (veg|year:Month)) ...

   Ben Bolker



More information about the R-sig-mixed-models mailing list