Very new to R so please pardon my naivety. I am trying to run a sort of mixed effects nominal logistic regression model with my insect response data. I have 2 rearing treatments (hot and cold) and 3 replicates within each treatment (1,2,3,4,5,6) with data (1/0) for both males and females. Each individual was tested at up to 5 different temperatures. To start I am trying to compare responses by Sex, so comparing females across the 2 treatments. Currently I have this:
RandomFemales<-glmer(Called~ Treatment + Temp + Temp*Temp + Temp*Treatment + Temp*Temp*Treatment + DaysFromEclose + Temp*DaysFromEclose +Temp*Temp*DaysFromEclose + (1|Treatment/Rep) + (1|Rep/ID), data = Females, family=binomial, control = glmerControl(optimizer = "bobyqa"))
where temp*temp accounts for the quadratic shape of their activity curves across temperatures. DaysFromEclose is more or less time, since individuals were tested across several days.
Replicates are specific to the treatments (ie, 2,4,6 are Hot, 1,3,5 are Cold), so I assumed replicate would have to be nested within treatment, and individual ID nested within replicate to account for differences in individual response rate. The problem is that now it seems that Treatment is being treated as a random effect which it is not. Any thoughts? thank you! Update RE warnings:
`Warning messages:
1: In optwrap(optimizer, devfun, start, rho$lower, control = control, :
convergence code 1 from bobyqa: bobyqa -- maximum number of function evaluations exceeded
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.235779 (tol = 0.002, component 1)
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?`
ID
is nested inRep
andRep
is nested inTreatment
then you probably wantTreatment/Rep/ID
unless there is crossing . But then you haveTreatment
as a fixed effect, so that looks like a problem. I don't see whyTreatment
should be random, norRep
for that matter, though I'm happy to be convinced otherwise :) $\endgroup$Treatment
as random ? $\endgroup$