Nesting random effect within fixed effect, with additional nested random effect. Nominal logistic 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?`

 A: Since there is interest in the association of Treatment with the outcome, it should be a fixed factor.
There are repeated measures per subject, and no interest in subject-specific associations with the outcome, so ID should be specified as a random intercept.
By similar reasoning, replicate could also be considered random, however, with only 3 replicates per treatment, the software can't be expected to estimate a variance for it with any reliability.
It is important to note that, when controlling for non-independence of observations within a factor, eg repeated measures and nesting, there is almost always the option to treat the factor as fixed instead. When there are very few levels of it, or if there are problems with model convergence that appear to be related to the random structure, for example a singular fit, these are very good reasons to treat the factor as fixed.
So in this case I would suggest trying both: one model with replicate as fixed and one with it as random. If they both converge then hopefully they will both produce similar answers to the research question(s).
Finally you might want to consider splines, which are far more flexible than quadratic terms, for handling non-linearities.
