l inear m ixed m odels Sarah Mustillo Purdue University Stata Conference Chicago 2011 The problem Introduction Examples Application Conclusion Problem Using Margins to test for group differences in GLMMs ID: 134428
Download Presentation The PPT/PDF document "Using margins to test for group differen..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Using margins to test for group differences in generalized linear mixed models
Sarah MustilloPurdue University
Stata Conference Chicago 2011Slide2
The problemIntroductionExamples
ApplicationConclusion
Problem
Using Margins to test for group differences in GLMMs
Linear mixed models (LMM) are a standard model for estimating trajectories of change over time in longitudinal data.
Theory, specification, estimation, and post-estimation evaluation techniques for LMMs are well-developed.
Less so for generalized linear mixed models (GLMM).Slide3
Testing for group differencesIntroductionExamples
ApplicationConclusion
Problem
Using Margins to test for group differences in GLMMs
In LMMs, researchers tend to include a group by time interaction term to test for group differences.
Others have suggested that this same procedure can be used in nonlinear models. For example,
Rabe-Hesketh
and
Skrondal
(2005) note that the coefficient of the product term can be interpreted as indicating group differences in the rate of change over time in logistic models (pp.115-118) and ordinal models (155-161).
But, interaction
terms in nonlinear models are different than interaction terms in linear models.Slide4
Interpreting interactions in nonlinear modelsIntroductionExamples
ApplicationConclusion
Problem
Using Margins to test for group differences in GLMMs
For example, Ai
and Norton (2004)
argue that
:
The coefficient of the interaction term in a linear model is the same as the first derivative or marginal effect and thus
a group by time interaction term in a linear model can
be interpreted as
group differences in the
effect of time
on the DV.
In nonlinear models, the first derivative of the interaction term is not the interaction effect. For that, we need the cross-partial derivative of E(y) with respect to group and time.
-
inteff
- is one way to interpret interactions in
logit
and
probit
models, but it’s not a panacea for several reasons.
Only available for
logit
and
probit
.
Not available for longitudinal models.
Difficult to interpret and generalize.Slide5
Longitudinal modelsIntroductionExamples
ApplicationConclusion
Problem
Using Margins to test for group differences in GLMMs
In the longitudinal, mixed model context, the interaction of a grouping variable and a time variable
is
a test for group differences in slope, but it’s a test on a ratio scale, which isn’t always what we want (or ever, in my case).
The difference in the rate of change (rather than the ratio of change) can be measured by taking the derivative or partial derivative of the conditional expectation of Y with respect to time by group.
When the ratio of change and the rate of change
are
close, both yield similar results. When they aren’t the same, they provide different results and answer different questions.Slide6
Real exampleIntroductionExamples
ApplicationConclusion
Motivating example
Using Margins to test for group differences in GLMMs
Using the Established Populations for Epidemiological Studies of the Elderly (EPESE) data, we were exploring the effects of baseline cognitive status on change in physical functioning over time. Physical functioning was measured as a count of instrumental tasks the subject could not perform. We used –
xtmepoisson
- with a cognitive impairment X time interaction term to test for the group difference in slope.
Based on previous work, we expected baseline cognitive impairment to be associated with greater yearly increases in disability over time. Indeed, descriptive statistics showed an increase of .06 per year in the cognitively intact and .13 in the cognitively impaired.Slide7
Results from –xtmepoisson-Introduction
ExamplesApplication
Conclusion
Empirical example
Using Margins to test for group differences in GLMMs
Table
1.
Estimated Mixed Poisson Model of Number of IADL's Regressed on Cognitive Impairment by Time, EPESE Data.
Fixed parameters
B
SE
IRR
Cognitive impairment2.817***(0.161)16.73 Time 0.541***(0.060)1.72 Cog impairment X Time-0.188***(0.046)0.83 Intercept -4.555***(0.144) Random components Slope variance 0.102(0.0187) Intercept variance 7.562(0.679) Covariance -0.487(0.115) Summary Statistics N 15016 Chi square 434.050 Log likelihood -8346.699 Note: Standard errors in parentheses * p< .05 **p<.01 *** p<.001 Slide8
Fake example - Graphs of generated count variables with gender differences in slope.
IntroductionExamplesApplication
Conclusion
Fake example
Using Margins to test for group differences in GLMMsSlide9
Fake example - Graphs of generated count variables with gender differences in slope.
IntroductionExamplesApplication
Conclusion
Fake example
Using Margins to test for group differences in GLMMs
1.32
1.40
1.25
1.24
1.22
1.17
Ratio Female/Male = 1.32/1.40=.93
Ratio Female/Male = 1.25/1.24=1.01
Ratio Female/Male = 1.22/1.17=1.03Slide10
IntroductionExamplesApplication
ConclusionFake example
Using Margins to test for group differences in GLMMs
Mean Outcome=
Model 1
_______
4
Model 2______
5
Model 3_____
6
B
(S.E)
IRR
b
(S.E)
IRR
B
(S.E)
IRR
Time
.340
***
(0.008)
1.406
***
.222
***
(0.006)
1.250***.165***(0.059)1.180***Female 1.037***(0.020)2.822***.671***(0.016)1.957***.498***(0.013)1.646***Female*Time -0.065***(0.009)0.937***.005(0.007)1.006.029***(0.006)1.030***Intercept0.080***(0.019) 0.741***(0.014) 1.397***(0.011) Chi square13824.89 11435.03 9775.27 Log likelihood28298.13 31527.75 34031.66 Note: Standard errors in parentheses * p< .05 **p<.01 *** p<.001Table 2. Mixed Poisson Regression Models Estimated for Generated Count Variables in EPESE Data (n=16,648).Slide11
Using –margins- to assess the group differenceIntroductionExamples
ApplicationConclusion
Margins
Using Margins to test for group differences in GLMMs
The interaction term does not test what we want to test here.
We want to calculate the partial derivative of E(Y) with respect to time by group and then test for a significant difference using a Wald test.
Hmmm…does Stata have a command that can do that?Slide12
Using –margins- to assess the group differenceIntroductionExamples
ApplicationConclusion
Margins
Using Margins to test for group differences in GLMMs
The interaction term does not test what we want to test here.
We want to calculate the partial derivative of E(Y) with respect to time by group and then test for a significant difference using a Wald test.
Hmmm…does Stata have a command that can do that?
xtmepoisson
yvar
i.female
##
c.time
||
person:time
,
cov
(
unstr
)
var
mle
margins
,
dydx
(time) over(female)
predict(
fixedonly
) post
lincom
_b[0.female] - _b[1.female]Slide13
IntroductionExamplesApplication
ConclusionMargins
Using Margins to test for group differences in GLMMs
Table 3. Using –margins- following –
xtmepoisson
- to test for group differences in slope in the fake examples
Fem ratio/
Male ratio
0.93
1.01
1.03
dy
/
dt
Male
0.693*** (0.018)
0.659***(0.021)
0.687***(0.027)
Female
1.359***(0.021)
1.325*** (0.022)
1.329*** (0.025)
Difference0.667***(0.028)0.665***(0.031)0.642***(0.037) Mean Outcome= Model 1_______4 Model 2______5 Model 3_____6 Slide14
Table 4. Using –margins- following –xtmepoisson- to test for group differences in slope in the original exampleIntroduction
ExamplesApplicationConclusion
Empirical example
Using Margins to test for group differences in GLMMs
Disability
b
SE
IRR
Time
.541***
(0.102)
1.716***
Cognitive impairment
2.817***
(2.686)
16.727***
Cog impairment X Time
-0.187***
(0.038)
0.830***
Intercept
-4.555***
dy
/
dt
No cog impairment
0.015***
(0.002)
Cog impairment
0.108***
(0.018) Difference0.093***(0.017) Note: Random coefficients omitted, * p<0.05, ** p<0.01, *** p<0.001 Slide15
Table 5. Using –margins- following –xtmepoisson- to test for group differences in slope in the original example with additional covariates and an additional interaction
IntroductionExamplesApplicationConclusion
Empirical example
Using Margins to test for group differences in GLMMs
Disability
B
SE
IRR
Time
.564***
(0.082)
1.758***
Cognitive impairment
2.130***
(1.299)
8.413***
Cog impairment X Time -0.186***(0.035)0.830***Age 0.114***(0.008)1.121***Female -0.032(0.113)0.969Black 0.225*(0.131)1.253*Income -0.029***(0.006)0.972***Married 0.005(0.152)1.005Married X Time -0.025(0.040)0.976Intercept -12.701*** dy/dt No cog impairment 0.022***(0.003) Cog impairment 0.163***(0.024) Difference 0.141***(0.023) Married 0.019***(0.003) Unmarried 0.052***(0.006) Difference 0.033***(0.005) Slide16
SummaryIntroductionExamples
ApplicationConclusion
Using Margins to test for group differences in GLMMs
In the generalized linear mixed model, the group by time interaction term is measuring differences in the ratio of change, e.g., change on a multiplicative scale.
This isn’t wrong – it just wasn’t what we wanted.
-margins- provides an easy way to test group difference in rate of change over time on an additive scale by allowing us to calculate the partial derivative of the response with respect to time separately by group and then run a significance test between the two.