New methods of interpretation using marginal effects for nonlinear models
Scott Long1
1Departments of Sociology and Statistics
Indiana University
EUSMEX 2016: Mexican Stata Users Group Mayo 18, 2016
Version: 2016-05-09
1 / 87
New methods of interpretation using marginal effects for nonlinear - - PowerPoint PPT Presentation
New methods of interpretation using marginal effects for nonlinear models Scott Long 1 1 Departments of Sociology and Statistics Indiana University EUSMEX 2016: Mexican Stata Users Group Mayo 18, 2016 Version: 2016-05-09 1 / 87 Road map for
1Departments of Sociology and Statistics
Indiana University
Version: 2016-05-09
1 / 87
◮ Binary logit model ◮ Standard definitions of marginal effects ◮ Generalizations of marginal effects
◮ Estimation using factor notation, storing estimates, and gsem ◮ Post-estimation using margins and lincom ◮ SPost13’s m* commands
2 / 87
3 / 87
12 11 10 9 8 7 x1 6 5 4 3 2 1 1 2 3 4 5 6 x2 7 8 9 10 11 0.5 0.25 1 0.75 12 π(x1,x 2)
4 / 87
dcVSmc brm-me-dcV14.do 2015-06-10
5 / 87
6 / 87
7 / 87
12 11 10 9 8 7 x1 6 5 4 3 2 1 1 2 3 4 5 6 x2 7 8 9 10 11 0.5 0.25 1 0.75 12 π(x1,x 2)
8 / 87
N
9 / 87
10 / 87
11 / 87
12 / 87
1Steve Heeringa generously provided the data used in Applied Survey Data Analysis
13 / 87
14 / 87
15 / 87
. estimates restore Mbmi . mchange, amount(sd) // compute average discrete change logit: Changes in Pr(y) | Number of obs = 16071 Change p-value bmi +SD 0.097 0.000 white White vs Non-white
0.000 (output omitted )
17 / 87
18 / 87
N
N
N
19 / 87
20 / 87
21 / 87
22 / 87
23 / 87
◮ mtable, commands lists the margins commands used ◮ mtable, detail shows margins output and mtable output
24 / 87
. mtable, atmeans at(bmi = `mn´) at(bmi = `mnplus´) post Expression: Pr(diabetes), predict() bmi Pr(y) 1 27.9 0.210 2 33.7 0.320 Specified values of covariates 1. 1. 1. white age female hsdegree Current .772 69.3 .568 .762
. mlincom 2 - 1 lincom pvalue ll ul 1 0.111 0.000 0.102 0.119
27 / 87
28 / 87
◮ 25% increase from 100 pounds ◮ 14% increase from average weight ◮ 8% increase from 300 pounds
29 / 87
30 / 87
31 / 87
32 / 87
x
1 2 3 4 5
x2
4 8 12 16 20
33 / 87
5 4
x
3 2 1 4 8
x2
12 16 20 0.75 1 0.5 0.25
(x,x2)
34 / 87
0.25 0.5 0.75 1
1 2 3 4 5
35 / 87
36 / 87
37 / 87
38 / 87
◮ Use height to predict weight ◮ Use margins, at(...=gen()) to change height and weight
39 / 87
40 / 87
41 / 87
42 / 87
prob-age-nolegend SJsugmex1-effects.do 2016-04-20 #08a
43 / 87
44 / 87
45 / 87
dcprob-age-dist SJsugmex1-effects.do 2016-04-20 #08e
46 / 87
5 10 15 20
Density
.05 .05 ADC .1 .1 .15 .15 .2 .2
∆Pr(diabetes)/∆(weight→weight+25)
dc-add-distribution-compare SJsugmex1-effects.do 2016-04-20 #13a
5 10 15 20
Density
.05 .05 ADC .1 .1 .15 .15 .2 .2
∆Pr(diabetes)/∆(weight→weight*1.14)
dc-pct-distribution-compare SJsugmex1-effects.do 2016-04-20 #13b
47 / 87
dc-add-dc-pct SJsugmex1-effects.do 2016-04-11 #13c
48 / 87
◮ Long and Freese (2014) show how do this without the gen() option
49 / 87
prob-age-nolegend SJsugmex1-effects.do 2016-04-20 #08a
50 / 87
51 / 87
52 / 87
53 / 87
54 / 87
55 / 87
◮ Is the average effect of BMI the same for whites and non-whites?
56 / 87
57 / 87
58 / 87
59 / 87
60 / 87
61 / 87
. gsem /// > (lhsbmi <- c.bmi i.female i.white c.age##c.age i.hsdegree, logit) /// > (lhswt <- c.weight c.height i.female i.white c.age##c.age i.hsdegree /// > , logit) /// > , vce(robust) Generalized structural equation model Number of obs = 16,071 Response : lhsbmi Family : Bernoulli Link : logit Response : lhswt Family : Bernoulli Link : logit Log pseudolikelihood = -14914.007 Robust Coef.
z P>|z| [95% Conf. Interval] lhsbmi <- bmi .099441 .003747 26.54 0.000 .092097 .1067851 female Women
.0413006
0.000
(output omitted ) 62 / 87
63 / 87
64 / 87
65 / 87
female and βN female
female = βW female
female and βN female
k = βW k
66 / 87
67 / 87
diabetes-probVdc-red groups-didactic-AMEvMEMV6.do 2016-04-20
68 / 87
70 / 87
.1 .2 .3 .4 .5
Pr(diabetes)
55 60 65 70 75 80 85 90 95 100
Age
Non-white White
prob-age-race SJsugmex1-effects.do 2016-04-11 #20b
.1 Pr(diabetes|white)-Pr(diabetes|non-white) 55 60 65 70 75 80 85 90 95 100
Age
95% confidence interval
dcprob-age-race-nonsig SJsugmex1-effects.do 2016-04-11' #20b
71 / 87
Non-white White Observed Observed
diabetes-youngW-red groups-didactic-AMEvMEMV6.do 2016-04-20
72 / 87
73 / 87
74 / 87
75 / 87
.1 .2 .3 .4 .5
Pr(diabetes)
55 60 65 70 75 80 85 90 95 100
Age
Non-white White
prob-age-race SJsugmex1-effects.do 2016-04-11 #20b
76 / 87
m
in
◮ Why do this? DC(weight) is clearer to patients than DC(bmi)
77 / 87
78 / 87
79 / 87
80 / 87
81 / 87
82 / 87
83 / 87
◮
84 / 87
85 / 87
86 / 87
87 / 87