[R-sig-eco] Help with mixed effects model using lme

Ben Bolker bbolker at gmail.com
Thu Mar 17 23:41:50 CET 2011


On 03/17/2011 06:27 PM, Gabe Strain wrote:
> Hi all, I am relatively new to R and am having problems modelling my
> data. I sampled a single salamander species along streams (Sites,
> random effect, n=16) over five months (fixed effect) with three
> methods (TRMT, fixed effect). 


  Philosophically, month seems like more of a random effect to me (don't
you want to be able to extrapolate to months that weren't included in
your sample??), but practically going with fixed effects may be safer
when n=5, unless you go Bayesian (MCMCglmm etc.).


> Snout-to-vent length (SVL) was measured
> and salamanders (each salamander is represented as Subject) released.
> Each site had all three methods present(although there is some
> missing data) and each site was resampled each month. The data is
> structured as follows:
> 
> Site Month TRMT Subject  SVL S15   May  VES       1  2.96 S15   May
> VES       2  2.03 S15   May  VES       3  3.84 S15   May  VES       4
> 2.67 S15   May  VES       5  3.12 S15   May  VES       6  2.08
> 
> I'm trying to model SVL as a function of TRMT. I think that Subject
> is nested within TRMT which is nested within Month, but am unsure if
> I have corectly specified this in the model:
> 

 I don't think you want nesting.  It rarely makes sense for fixed
effects, where the effect of treatment is considered to be similar
across months and sites (unless you include a treatment-by-site
interaction).

  lme(SVL~TRMT*Month, random=~1|Site, method="ML")

  The correlation is handled by the fact that you have included Site as
a random grouping factor: that by itself induces a compound symmetry
structure in the marginal correlation matrix.

  The model above seems reasonable to me.  If each Subject is measured
only once (i.e., unmarked individuals) then you don't want to put
Subject in the model, it will be confounded with your residual error term.

   In a perfect world I would probably want to fit

 lmer(SVL~TRMT+(TRMT|Site) + (TRMT|Month) + (TRMT|Site:Month)

  (it's posible that (TRMT|Site*Month) is an equivalent specification of
the random effect, but I'm not sure), to quantify the variation in
treatment size-specificity across time and space (you'd need lme4 for
this).  The last random-effect term is almost certainly too much for
your data, and even removing that you're still fitting 3 (fixed) + 6*2
(parameterizing a 3x3 variance-covariance model for each random effect =
15 parameters, which is going to be hard.

  lmer(SVL~TRMT+(1|Site)+(1|Month))

would be a reasonable back-up strategy.

  If you stay with lme, you can also add a correlation term to account
for temporal autocorrelation (again, keeping your data limitations in mind).

  PS this question may be more appropriate for R-sig-mixed-models -- I
watch both, so I hadn't noticed it was sent to r-sig-ecology.

> lme(SVL ~ Month/TRMT/Subject, random = ~1|Site, method="ML",
> correlation = corCompSymm(form = ~ 1 | Site)))
> 
> Or is this more appropriate:
> 
> lme(SVL ~ TRMT + Month + TRMT*Month, random = ~1|Site/TRMT,
> method="ML", correlation = corCompSymm(form = ~ 1 | Site/TRMT)))
> 
> I have included the correlation option to account for the fact that
> sites were sampled multiple times (compound symmetry may not be
> appropriate, this is just an example). Any advice would be very much
> appreciated! Thank you in advance for taking the time to look this
> over.
> 
> 
> Sincerely,
> 
> Gabriel Strain Graduate Research Assistant Division of Forestry and
> Natural Resources West Virginia University Morgantown, WV 26506 
> 301-876-1070 gstrain54 at yahoo.com 
> www.stat.wvu.edu/~gabrielstrain/gabrielstrain.htm
> 
> _______________________________________________ R-sig-ecology mailing
> list R-sig-ecology at r-project.org 
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



More information about the R-sig-ecology mailing list