[R-sig-ME] mixed-effects model with crossed random effects
Magdalena Wiedermann
mwiederm at mtu.edu
Mon May 4 22:52:39 CEST 2015
On 04/24/2015 02:26 PM, Ben Bolker wrote:
> 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
Ben, thank you so much for your suggestions and help! I have a few
follow up questions though....
1) Why do you choose to write (veg|year/Month) instead of
(1|veg/year/Month)?
I am asking because I had read that for a continuous random effect it l
would be written like ~veg rather than ~1|veg which would be use for
a categorical random effects. Is there anything to it?
2) How would “lmer(response~veg + (veg|year/Month/block), data=...)”
compare to your model “lmer(responses~veg + (veg|year/Month) +
(veg|block), data= …)”
3) I am not sure what you mean by “ add a numeric covariate of time
period to the fixed effects” can you please explain that.
sorry I should have provided more specifics about my spread sheet setup:
block: 1, 2, 3, 4
plot: a, b, c, d, e, f, g, h, I, j, k, l
veg: E, S, U
depth: 20, 40
Month: 5, 6, 7, 8, 9
year: 2012, 2013, 2014
Mainly I am interested in the main effects and interactions of veg*depth
and I need to account for the fact that I have multiple readings from
the sampling plots. I regarded it useful to think of it as a split plot
setup with block divided into 3 veg treatments which each are split into
two depth treatments. Samples from each exact depth point are taken
repeatedly for 5 times throughout the year for 3 years. Does plot need
to be included in the model?
As for seasonal trends: each year the measured values increase over the
course of the year, but the slopes of this increase seem to vary between
years. So, additionally it might be interesting to determine whether the
slopes of the seasonal trends differ between years but that can possibly
be done in a separate analyzes.
Thank you so much,
Lena
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list