[R-sig-ME] Random slope models with nested random effects and multiple x variables
Samantha Patrick
samantha.patrick at plymouth.ac.uk
Thu Oct 6 15:19:03 CEST 2011
Hi Thierry
Thank you for getting back to me. Modelling
lmer (behaviour ~ (a|bird) + (1|bird:track))
does exactly what I want.
However I simplified the model (to make it easier to explain to the list) and in reality the model has 3 environmental variables (a, b and c) and I want to know how each birds responds to each variable.
I have run the three models separately, so fitting:
(1) a|bird + (1|bird:track)
(2) b|bird + (1|bird:track)
(3) c|bird + (1|bird:track)
but was wondering if you can fit all three in one model and whether this is a good idea!
My code for this again results in multiple intercepts for bird.
lmer (behaviour ~ (1|bird:track) + (a|bird) + (b|bird) + (c|bird))
While you could remove the intercepts
e.g.
lmer (behaviour ~ (1|bird:track) + (a|bird) + (0+b|bird) + (0+c|bird))
this would again result in the covariance between the intercept and the slope b and c being 0, when ideally I would like all three slopes to be able to covary with the intercept (through a a symmetric variance-covariance matrix). Otherwise the intercept will be driven by one but not all slopes. This may not be possible to avoid but I am keen to understand exactly how the intercept is calculated to make sure my interpretation of the results is correct.
Thanks
Sam
Dr Samantha Patrick
EU INTERREG Post Doc
Davy 618
Marine Biology & Ecology Research Centre
University of Plymouth
Plymouth
PL4 8AA
T: 01752 586165
M: 07740472719
-----Original Message-----
From: ONKELINX, Thierry [mailto:Thierry.ONKELINX at inbo.be]
Sent: 06 October 2011 13:00
To: Samantha Patrick; r-sig-mixed-models at r-project.org
Subject: RE: [R-sig-ME] Random slope models with nested random effects and multiple x variables
Dear Sam,
Models a and b are identical.
Model c has the problem that you fit two random intercepts for bird (one from the 1|bird/track term and one from the a|bird term
You might want the model lmer (behaviour ~ (a|bird) + (1|bird:track))
Best regards,
Thierry
> -----Oorspronkelijk bericht-----
> Van: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-
> bounces at r-project.org] Namens Samantha Patrick
> Verzonden: donderdag 6 oktober 2011 12:20
> Aan: r-sig-mixed-models at r-project.org
> Onderwerp: [R-sig-ME] Random slope models with nested random effects and
> multiple x variables
>
> Hi
>
> I am fitting random intercept and slope models on some GPS tracking data. I
> have data from 113 tracks from 31 individuals with about 400 behavioural
> observations per track.
>
> I am interested in looking at how individuals change their behaviour in response
> to an environmental variable (a) but want to control for the non-independence
> of points from individual tracks.
>
> So I have these possible lmer models :
>
>
> a) lmer (behaviour ~ (1|bird/track) + (-1+a|bird))
>
> b) lmer (behaviour ~ (1|bird/track) + (0+a|bird))
>
> c) lmer (behaviour ~ (1|bird/track) + (a|bird))
>
>
> I have two questions:
>
> 1) Can you fit an intercept and slope with different random effect structures?
> In theory I think this is ok but I have not see it done.
>
> 2) I am interested in the differences in covariance structures in the three
> models. I thought that model (a) set the covariance between the slope and
> intercept for bird to 0 but from looking at previous posts in the forum, it seems
> that model (b) may do this? In which case does model (a) set the covariance to -
> 1?
> My understanding is that model (c) allows a symmetric variance-covariance
> matrix (which is what I want) but I am concerned that this model is fitting two
> intercepts for bird?
>
> Ideally I want the intercept for bird to be allowed to covary with the slope for
> bird (I don't want to constrain it to 0 or 1) but I am unsure if my problem is in the
> syntax or whether I don't fully understand how the model partitions the variance
> in nested random effects and that maybe the model I want to fit is not possible.
>
> Any advice on creating the models would be much appreciated!
>
> Many Thanks
>
> Sam
>
> Dr Samantha Patrick
> EU INTERREG Post Doc
> Davy 618
> Marine Biology & Ecology Research Centre University of Plymouth Plymouth
> PL4 8AA
>
> T: 01752 586165
> M: 07740472719
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list