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!


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)
  • $\begingroup$ If I understand you well, you are trying to model dynamics of prescriptions as a function of year? Maybe you may try to normalize prescriptions/age ? this ratio will likely maintain dependency. $\endgroup$ – Vlad Bogomolov Sep 29 '15 at 11:30
  • $\begingroup$ Basically, I'm trying to see if some factors will lead to an increase in the number of prescriptions. The time is year, could have been something else but I though it would be easier to calculate the number of prescriptions for each year and see the trajectories. But as the time increases so will age. Could you elaborate a bit on normalize prescriptions/age? I'm not sure exactly what you mean. Thank you $\endgroup$ – psoares Sep 29 '15 at 11:33

Age at baseline does not make sense as a random slope per individual, as age at baselines is constant per subject. This is probably why your model does not converge.

Age as a random slope would make more sense. Given how children change over the year, I would more tend to question that modelling age linearly is sufficient.

As for age and time being correlated, how much of a problem is that for your data? Did you look at the variance inflation factor? In many situations like these I found out that the concern was unwarranted.

Your third question I find hard to answer without seeing the data. As with age I doubt that modelling it as a simple numerical variable works well. Depending on the distribution in your data I could imagine using a categorical version, with categories being 0, 1, 2-4, >4 or if the scale is even wider, splines could also serve well.

  • $\begingroup$ The VIF was almost 30 for age and time. The model converge for poisson but not for negative binomial so I'm not sure if that would be the reason for non convergence. I also tried to categorize age but it's still correlated. So those are not options in this scenario. I've seen some documentation over the Internet that when age and time are correlated (and VIF is a proof of the correlation) one should use age at baseline. Or even age centered at the mean. But I'm not sure about this and that is the reason of the post. To understand better those approaches. Thank you $\endgroup$ – psoares Sep 29 '15 at 11:53
  • 1
    $\begingroup$ @pavid Not centering usually leads to huge inflations factors between intercepts and slopes. Try centering all numerical predictors before calculating the VIF. $\endgroup$ – Erik Sep 29 '15 at 12:05
  • $\begingroup$ Above comment usually applies when there are interactions so this should not be the case here. $\endgroup$ – Erik Sep 29 '15 at 12:16
  • $\begingroup$ I will try that also. Should I then transform age as current age minus mean sample age and use that as random slope? And use centered age instead of age? And how will this be interpreted? $\endgroup$ – psoares Sep 29 '15 at 12:17
  • $\begingroup$ Even with age centered the VIF is quite large (26). Adding the age centered as random slope the model does not converge. The variance is quite large since we have children and young adults (2 to 30 years old). Do you have any other suggestion? $\endgroup$ – psoares Sep 29 '15 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.