I'm analyzing the effect of Sex, Cap.Year, Cap.Location and Spawning.Season on the number of spawning sites lake trout visit (Sites.Visited). I'm trying to add a random effect variable ("Transmitter", i.e. individual fish ID) to a linear mixed effects model. See below for sample of my data.
> head(Conc, 10)
Transmitter Sex Sites.Visited Cap.Year Cap.Location Season.Length Spawning.Season
1 A69-1601-26770 M 2 2013 Grand Isle P 2013
2 A69-1601-26771 F 1 2013 Grand Isle P 2013
3 A69-1601-26773 F 2 2013 Grand Isle P 2013
4 A69-1601-26774 M 2 2013 Grand Isle P 2013
5 A69-1601-26776 F 4 2013 Grand Isle P 2013
6 A69-1601-26778 M 2 2013 Grand Isle P 2013
7 A69-1601-26784 M 1 2013 Grand Isle P 2013
8 A69-1601-26785 F 2 2013 Grand Isle P 2013
9 A69-1601-26786 F 2 2013 Grand Isle P 2013
10 A69-1601-26787 M 2 2013 Grand Isle P 2013
Here is my model (without the random effects variable):
modelDDF<-glm2(Sites.Visited~ factor(Sex)+factor(Cap.Year)+factor(Spawning.Season)+factor(Cap.Location),
family = gaussian, Conc, weights=NULL, subset=NULL, na.action=NULL, start = NULL,
offset=NULL, model = TRUE, method = "glm.fit2", x = FALSE, y = TRUE, contrasts = NULL,)
The random effect variable I'd like to add is "Transmitter". According to everything I've read, this should work:
modelDDF<-glm2(Sites.Visited~ factor(Sex)+factor(Cap.Year)+factor(Spawning.Season)+factor(Cap.Location)+(1|Transmitter),
family = gaussian, Conc, weights=NULL, subset=NULL, na.action=NULL, start = NULL,
offset=NULL, model = TRUE, method = "glm.fit2", x = FALSE, y = TRUE, contrasts = NULL,)
But instead, I get this error:
Error in 1 | Transmitter :
operations are possible only for numeric, logical or complex types
>
Please help!!! Thank you!
Aucun commentaire:
Enregistrer un commentaire