I am analysing some whale tourism data and am trying to construct linear mixed effect models in the nlme
package to see if any of my explanatory variables affect encounter time between whales and tourists. (I am also open to running this model in lme4
.)
My variables are:
mins
: encounter time (response variable)Id
: individual whale ID (random effect)Vessel
: vessel Id (random effect)Sex
: sex of the animalLength
: length of the animalYear
Month
(nested withinYear
).
So my random variables are Id
and Vessel
and I also have Year
and Month
as nested random effects.
I have come up with the following:
form1 <- formula(Min ~ length + Sex+ Encounter)
model1 <- lme(form1,
random = list(Id = ~1,
Vessel = ~1,
Year=~1,
Month = ~1), data=wsdata, method="ML")
But all my random effects become nested within Id
.
Is there any way I can define Id
and Vessel
as separate random effects and Year
and Month
as nested random effects?