# In repeated-measures linear mixed model, should the time variable be fixed or random?

I'm attempting to run a linear mixed effect model with repeated measures. I read the relevant chapters from R book to construct my model. However I’m concerned if my model syntax is correct for repeated measures.

Experimental design: My study organism is a pest caterpillar. As in all insects, caterpillars grow in series of multiple molts called instars. This caterpillar can reach up to 7 or 8 instars before they turned into pupae. The objective of my study was to evaluate the effect of host plants and fertilizer on the growth of the caterpillar. The set up was a 2x2 factorial experiment in a completely randomized design:

• Host: Canola or Wheat
• Fertilizer: Fertilized or Unfertilized

Each caterpillar (subject) was assigned one treatment combination, and measurements were recorded for each subject at each instar stage. The data set is unbalanced because some subjects died throughout the experiment.

## My data set contains the following variables:

• host: Canola or Wheat (fixed)
• fertilizer: Fertilized or Unfertilized (fixed)
• sex: Male or female (fixed) (Sex can be determined only after they pupate. Caterpillars were randomly assigned to each treatment without knowing their sex)
• instar: L3,L4,L5,L6,L7,L8 (repeated measure factor within subject)
• rep (subjects): 32 caterpillar per treatment combination (random)
• weight = response variable

Following the syntax from R book, instar is considered as a continuous random effect because it represents pseudo-replication within each subject.

m1<-lme(weight~  host*fert*sex,  random=~instar|rep, data=larva.weight)


However, the statistician advised me to include instar as fixed effect because the number of instars are finite and the caterpillars exhaust all levels.

m2<-lme(weight~ host*fert*sex + instar, random=~1|rep, data=larva.weight)


Looking at other [questions in this forum][1], they suggested including the repeated measures factor as fixed and random. I modified the model to:

m3<-lme(weight~ host*fert*sex + instar, random=~ instar|rep, data=larva.weight)


For m1 and m3, I had to increase the number of iterations because the models ran out of coverage. I looked online and I added the following codes to the syntax:

correlation=corSymm(),control=list(msMaxIter=200,opt= "nlminb",msVerbose=TRUE),


All three models ran and gave me different AIC values with normal distribution of residuals.

m1 AIC= 307.54, m2 AIC= 100.87, m3 AIC = -25.21

It is implicit that instar effect is significant. I am interested the effect of host, fertilizer, sex and their interaction. I have the following questions:

1. If instar is consider random, then is m1 correct?
2. If instar is considered fixed, how should it be placed in a repeated measures linear-mixed model?
3. What is the difference between m2 and m3?