# Specifying multilevel model with time series covariance in nlme

I am learning to use the nlme package to fit a multilevel model in R, and I want to be sure that I am specifying the model correctly.

My response variable is cortisol levels measured over several years for many individuals (sample collection was opportunistic, so the time intervals between samples are variable). These are my predictors:

1. Gender (binary, individual level predictor)
2. Age (in years, varies within individuals)
3. Disease (binary, varies within individuals)
4. Pregnancy (binary, varies within females but always 0 for males)
5. Temperature (continuous, varies within individuals)
6. Rainfall (continuous, varies within individuals)

I also know from past work that interactions between Gender:Age and Temperature:Rainfall should be included. I want to allow random intercepts among individuals, and I want to account for the temporal autocorrelation of samples within individuals. I am specifying my model like this:

lme(cortisol ~ sex + age + sex:age + disease + pregnancy + temperature +
rainfall + temperature:rainfall, random=~1|ID, correlation=corCAR1(form=~Date|ID))


Is my specification of this model correct?

Also, is it a problem that one of my variables (pregnancy) only applies to a subset of my data (females)?

• Out of curiosity... How does weather affect cortisol outside of seasonality? – AdamO Sep 23 '16 at 18:11
• low temperatures and low rainfall stress the animals, with a synergistic effect (probably mediated by their combined effect on food availability) – Slow loris Sep 28 '16 at 17:51