modelinginteractionsincountdataregression ......h. leitgöb interactions in count data models...

17
Modeling Interactions in Count Data Regression Principles and Implementation in Stata Heinz Leitgöb Johannes Kepler University of Linz, Austria German Stata Uers Group Meeting H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 1 / 17

Upload: others

Post on 25-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Modeling Interactions in Count Data RegressionPrinciples and Implementation in Stata

Heinz Leitgöb

Johannes Kepler University of Linz, Austria

German Stata Uers Group Meeting

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 1 / 17

Page 2: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Table of contents

1 Theoretical & analytical principles

2 Interaction effects in nonlinear models

3 Introduction to count data models

4 Interaction effects in count data models

5 Example with artificial data

6 Next steps

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 2 / 17

Page 3: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Definition of interactions

"By interactions we mean an interplay among predictors that producesan effect on the outcome Y that is different from the sum of theeffects of the individual predictors." (Cohen et al. 2003, 255)

"Two explanatory variables are said to interact in determining aresponse variable when the partial effect of one depends on the valueof the other." (Fox 2008, 131)

→ From an analytical point of view, an interaction effect can be defined asthe marginal effect of a marginal effect

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 3 / 17

Page 4: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Identification of interaction effects in the linear model

Linear model with interaction term x1x2:

E (y |x) = β0 + β1x1 + β2x2 + βMx1x2 + ∑k

j=3 βjxj (1)

Interaction effects (if xj is dichotomous, then xj = dj):

∂2E (y |x)∂x1∂x2

=∂∆E (y |x)

∂x1∆d2=

∆2E (y |x)∆d1∆d2

= βM (2)

→ In the linear model, the interaction effect is in any case equal to theproduct term coefficient βM

Significance testing: Wald-test for βM

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 4 / 17

Page 5: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Interaction effects in nonlinear models

Current state of research

... in Logit & Probit models (Ai & Norton 2003; Berry et al. 2010;Bowen 2012; Greene 2010; Karaca-Mandic et al. 2012; Norton et al.2004; Seymour 2011)

... within the GLM framework (Tsai & Gill 2013)

To date, no explicit contributions covering the identification ofinteraction effects in count data models are available

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 5 / 17

Page 6: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Characteristics of Interaction effects in nonlinear models

In contrast to the linear model (see Eq. (2)), the interaction effectdoes not equal βM

A significant interaction effect is possible even when βM = 0 (modelinherent interaction effect)→ Statistical significance cannot be tested by applying a Wald-test forβM

The interaction effect is dependent on covariates and thus subject tovariation across individualsThe interaction effect may have different signs for different individuals→ The sign of βM does not necessarily indicate the direction of theinteraction effectThe total interaction effect is composed additively of a model inherentinteraction effect and a product term induced interaction effect

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 6 / 17

Page 7: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Introduction to count data models

Inverted link function:

E (y |x) = exp (xβxβxβ) = µ (3)

Poisson model (stochastic component)

f (y |µ) = Pr(Y = y) =exp(−µ)µy

y !; y = 0, 1, 2, ...; µ > 0 (4)

Negative binomial model (stochastic component)

f (y |µ, α) = Pr(Y = y) =Γ(y + α−1)

Γ(y + 1)Γ(α−1)

(α−1

α−1 + µ

)α−1

α−1 + µ

)y

; y = 0, 1, 2, ...; µ > 0; α ≥ 0

(5)

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 7 / 17

Page 8: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Interaction effects in count data models

Count data model with interaction term x1x2:

E (y |x) = exp(

β0 + β1x1 + β2x2 + βMx1x2 + ∑k

j=3 βjxj

)(6)

Total interaction effect ( ιt)

ιt =∂2E (y |x)

∂x1∂x2= [(β1 + βMx2) (β2 + βMx1) + βM ]E (y |x) (7)

Rearranging terms uncovers the model inherent ( ιm ) and the productterm induced ( ιp ) interaction effect

ιt = β1β2E (y |x)︸ ︷︷ ︸ιm

+ βM (β1x1 + β2x2 + βMx1x2 + 1)E (y |x)︸ ︷︷ ︸ιp

(8)

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 8 / 17

Page 9: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Delta method standard errors

According to Ai & Norton (2003), standard errors for the interaction effectscan be obtained by applying the Delta method for variance estimation

total interaction effect

σ̂2ιt =

(∂ιt∂βββ

)V̂(

∂ιt∂βββ

)′(9)

model inherent interaction effect

σ̂2ιm =

(∂ιm∂βββ

)V̂(

∂ιm∂βββ

)′(10)

product term induced interaction effect

σ̂2ιp =

(∂ιp∂βββ

)V̂(

∂ιp∂βββ

)′(11)

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 9 / 17

Page 10: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Example with artificial data ( β1 < 0; β2 > 0; βM > 0 )

Simulation of a Poisson model with η = −6− 2x1 + 2x2 + .5x1x2x1, x2 ∼ N(0; 1); n = 10.000

Estimation results (poisson command)

variable coef. se pconstant -6.148 .172 <.001x1 -2.038 .073 <.001x2 1.990 .086 <.001x1x2 .493 .042 <.001

LL = −935.011; LR-Test (Nullmodell): χ2 = 1, 424.69; df = 3;p < .001;PseudoR2 = .432;AIC = 1, 878.022;BIC = 1, 906.82

Calculation of interaction effects and standard errors via predictnlcommand

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 10 / 17

Page 11: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Calculation of ιt , ιm, ιp & standard errors with predictnl

Estimate Poisson modelpoisson y x1 x2 x1x2

Calculate predicted countpredict expcount

Calculate total, model inherent & product term induced interactioneffects and corresponding standard errorspredictnl total = ((_b[x1] + _b[x1x2]*x2)*(_b[x2] +_b[x1x2]*x1) + _b[x1x2])*expcount, se(setotal)

predictnl inherent = _b[x1]*b[x2]*expcount,se(seinherent)

nlpredict product = _b[x1x2]*(_b[x1]*x1 + _b[x2]*x2 +_b[x1x2]*x1*x2 + 1)*expcount, se(seproduct)

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17

Page 12: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Total interaction effect

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 12 / 17

Page 13: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Model interent interaction effect

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 13 / 17

Page 14: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Product-term induced interaction effect

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 14 / 17

Page 15: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

All interaction effects

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 15 / 17

Page 16: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Next steps

Calculate average interaction effects & corresponding standard errors(analogous to AMEs)

Calculate interaction effects & corresponding standard errors fordichotomous covariates

Allow for more than one two-way and for three-way interactions?!?

Put all these features into a Stata program

Simulate distributions of interaction effects from a theoreticalperspective (e.g. exploring the relevance of ιm)→ Learn how to adequately interpret these interaction effects innonlinear models

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 16 / 17

Page 17: ModelingInteractionsinCountDataRegression ......H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 11 / 17 Totalinteractioneffect H. Leitgöb Interactions in Count Data

Mail to

[email protected] list can be requested via email

H. Leitgöb Interactions in Count Data Models Hamburg, June 2014 17 / 17