I've been trying to fit a mixed model in R however since age and time are correlated (both increase) I'm having some problems figuring out the best option.
I have data on 500 children, between 2005 and 2013. My dependent variable is the number of prescriptions. Therefore count data. For each year, I have the age of the children. This will increase one unit per year (as expected). However, the age is extremely correlated with time.
1) One of the approaches was to fix age. Each child will have the age at baseline (children entered with different ages). Is this appropriate? If I transform the time-varying covariate age into fixed effect how do I interpret the variable?
2) I tried to add age at baseline also as random slope. Would this make it easier to interpret the changes, since age is supposed to change between and within individual? This approach does not converge using the negative binomial.
3) I also have another time-varying covariate (not correlated) corresponding to the number of hospital admissions in each year. For instance child 1 could have 0 hospital admissions in 2005, 2 hospital admissions in 2006, 0 in 2007, etc. Should I treat this variable differently?
The model in R:
glmer(prescriptions ~ time + ageBase + hospAdmission + (ageBase|id), data, family=poisson)
glmer.nb(prescriptions ~ time + ageBase + hospAdmission + (ageBase|id), data)
Can someone provide some pointers, if I'm on the right direction or provide some references?
Thank you very much!
EDIT
So, what I'm doing is to leave time in the model and adjust the curve parameters for age centered at the sample's mean.
ageCent <- data$agePerYear - round(mean(data$agePerYear))
glmer(prescriptions ~ time + hospAdmission + (ageCent|id), data, family=poisson)