[R-sig-ME] Testing a trend across possibly non-independent estimates, take 2

Ben Bolker bbolker at gmail.com
Tue Sep 22 16:49:42 CEST 2015

Steven Orzack <orzack at ...> writes:

> I have longitudinal data on Health (0/1) for a set of individuals, each 
> of which has a cohort ID (defined by birth year). Each individual is 
> assessed for health for a range of ages. Call the data frame 
> longitudinal.df, which looks like
> ID Age Cohort Health
> individual_ID_1 age cohort health_at_age
> individual_ID_1 age+1 cohort health_at_age+1
> individual_ID_2 age cohort health_at_age
> individual_ID_2 age+1 cohort health_at_age+1
> etc.
> if we fit, say,
> glmer(Health ~ Cohort:as.factor(Age) + (Cohort|ID), data = 
> longitudinal.df, family = binomial)
> we get a set of age-specific slopes:
> Cohort:as.factor(Age)64
> Cohort:as.factor(Age)66
> .
> .
> .
> Cohort:as.factor(Age)92
> Cohort:as.factor(Age)94
> each estimates the slope on the logit scale of the regression between 
> health (y) and cohort (x) for a given age.
> This model has a much lower AIC than the model without age-specific 
> slopes. This means that there is support for the claim that there is 
> heterogeneity across ages with respect to slope.
> I have an external hypothesis that the trend of these age-specific 
> slopes over age is increasing (with younger ages having negative slopes 
> and older ages having positive slopes).
> How do I correctly test for an increasing trend over ages of the 
> age-specific regression slope estimates derived from the glmer model fit?

   Hmm.  I'm not sure, but isn't this just a test of accelerating
slope, i.e. a quadratic model in age?  Constructing tests on sets
of parameters seems like the long way around.  I would suggest
making Age an *ordered* factor; then you will get the same number
of parameters, but the contrasts will be parameterized in terms
of orthogonal polynomials, so that the first few parameters will be
labeled L (linear), Q (quadratic), C (cubic) ... the significance
of the 'Q' term will be a reasonable test of change in slope with
age, and you can try to simplify the model by keeping only the first
few polynomial terms (e.g. equivalent to Cohort:poly(Age,3))

More information about the R-sig-mixed-models mailing list