E STIMATION R ESULTS WITH S TATA G RAPHICS LANCE ERICKSON
Slide 3
OUTLINE Why we need graphics Why we need graphics Marginal
effects Marginal effects Marginal effects at the means Marginal
effects at the means Average marginal effects Average marginal
effects Marginal effects at representative values Marginal effects
at representative values Walking through an example Walking through
an example Programming Programming Graph editor Graph editor
Slide 4
A SIMPLE CORRELATION Is parental control related to adolescent
delinquency? Is parental control related to adolescent
delinquency?. corr delinq parcon (obs=11) | delinq parcon
-------------+------------------ delinq | 1.0000 parcon | 0.0000
1.0000
Slide 5
A SIMPLE REGRESSION Is parental control related to adolescent
delinquency? Is parental control related to adolescent
delinquency?. reg delinq parcon Source | SS df MS Number of obs =
11 -------------+------------------------------ F( 1, 9) = 0.00
Model | 1.4211e-14 1 1.4211e-14 Prob > F = 1.0000 Residual |
102.727273 9 11.4141414 R-squared = 0.0000
-------------+------------------------------ Adj R-squared =
-0.1111 Total | 102.727273 10 10.2727273 Root MSE = 3.3785
------------------------------------------------------------------------------
delinq | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
parcon | 1.76e-08.5598242 0.00 1.000 -1.26641 1.26641 _cons |
5.545454 2.208356 2.51 0.033.5498056 10.5411
------------------------------------------------------------------------------
Slide 6
VISUALIZING THE DATA Is parental control related to adolescent
delinquency? Is parental control related to adolescent
delinquency?
Slide 7
REVISING THE MODEL Is parental control related to adolescent
delinquency? Is parental control related to adolescent
delinquency?. reg delinq c.parcon##c.parcon Source | SS df MS
Number of obs = 11 -------------+------------------------------ F(
2, 8) = 930.87 Model | 102.287737 2 51.1438687 Prob > F = 0.0000
Residual |.439535405 8.054941926 R-squared = 0.9957
-------------+------------------------------ Adj R-squared = 0.9947
Total | 102.727273 10 10.2727273 Root MSE =.2344
-----------------------------------------------------------------------------------
delinq | Coef. Std. Err. t P>|t| [95% Conf. Interval]
------------------+----------------------------------------------------------------
parcon | -9.912351.2329897 -42.54 0.000 -10.44963 -9.375076
c.parcon#c.parcon | 1.41605.0328185 43.15 0.000 1.340371 1.49173
_cons | 18.20366.330967 55.00 0.000 17.44044 18.96687
-----------------------------------------------------------------------------------
Slide 8
OUTLINE Why we need graphics Why we need graphics Marginal
effects Marginal effects Marginal effects at the means Marginal
effects at the means Average marginal effects Average marginal
effects Marginal effects at representative values Marginal effects
at representative values Walking through an example Walking through
an example Programming Programming Graph editor Graph editor
Slide 9
MARGINAL EFFECTS A [marginal effect], or partial effect, most
often measures the effect on the conditional mean of y of a change
in one of the regressors, say x k. In the linear regression model,
the [marginal effect] equals the relevant slope coefficient,
greatly simplifying analysis. For nonlinear models, this is no
longer the case, leading to remarkably many different methods for
calculating [marginal effects]. If x changes by one unit, how would
y change?
Slide 10
MARGINAL EFFECTS AT THE MEAN Mean is the average characteristic
in the data Mean is the average characteristic in the data Identify
mean value and substitute into the regression equation Identify
mean value and substitute into the regression equation
Slide 11
MARGINAL EFFECTS Average Say were interested in the AME for
whites vs. blacks Say were interested in the AME for whites vs.
blacks 1.Imagine the first case is white, regardless of the true
race 2.Use other characteristics as measured 3.Estimate the
individual prediction 4.Repeat 2 and 3 with the race as black 5.The
difference in predictions is individual marginal effect 6.Repeat 1
through 5 for every case 7.Calculate mean for entire sample
Slide 12
MARGINAL EFFECTS at representative values Identify profiles for
individuals that have some particular meaning Identify profiles for
individuals that have some particular meaning
Slide 13
OUTLINE Why we need graphics Why we need graphics Marginal
effects Marginal effects Marginal effects at the means Marginal
effects at the means Average marginal effects Average marginal
effects Marginal effects at representative values Marginal effects
at representative values Walking through an example Walking through
an example Programming Programming Graph Editor Graph Editor
Slide 14
Toxoplasmosis Gondii Parasite whose primary host is any member
of the cat family Parasite whose primary host is any member of the
cat family Transmitted by contact with feces Transmitted by contact
with feces Lodges into neurons Lodges into neurons 30 percent of
worlds human population carries the parasite 30 percent of worlds
human population carries the parasite Not thought of as dangerous
for healthy people Not thought of as dangerous for healthy people
Maybe its not so benign
Slide 15
eststo m1: svy: regress sdl i.toxbin##c.pir female age higrade
ib1.race Number of strata = 49 Number of obs = 4169 Number of PSUs
= 98 Population size = 109225249 Design df = 49 F( 9, 41) = 157.93
Prob > F = 0.0000 R-squared = 0.2657
------------------------------------------------------------------------------
| Linearized sdl | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
1.toxbin |.9756481.3447252 2.83 0.007.282897 1.668399 pir |
-.2212445.0501302 -4.41 0.000 -.321985 -.1205041 | toxbin#c.pir | 1
| -.2222757.0970269 -2.29 0.026 -.4172585 -.0272929 | female
|.0780064.1505963 0.52 0.607 -.2246282.380641 age |.0936083.0070641
13.25 0.000.0794125.1078042 higrade | -.5190588.0388779 -13.35
0.000 -.597187 -.4409307 | race | Black | 1.741903.1750276 9.95
0.000 1.390172 2.093634 Hispanic | 2.414574.3088713 7.82 0.000
1.793874 3.035274 Other | 2.315488.5264093 4.40 0.000 1.257629
3.373347 | _cons | 7.715189.6056571 12.74 0.000 6.498076 8.932303
------------------------------------------------------------------------------
Slide 16
estout m1, cells("b(star fmt(2)) ci") stats(N r2, fmt(0 2)
label(N "R squared")) nolz /// collabels(b "95% CI") mlabels(none)
/// prehead("Table 1.""Latent Toxoplasmosis and Symbol-Digit
Learning Test:" /// "Poverty-to-income Ratio as Linear") ///
drop(0b.toxbin 0b.toxbin#co.pir 1b.race) /// order(1.toxbin pir
1.toxbin#c.pir Controls female age higrade race) ///
varlabels(1.toxbin "Toxoplasmosis (Toxo)" pir "Poverty-to-income
ratio (PIR)" /// 1.toxbin#c.pir "Toxo X PIR" female " Female" age "
Age" /// higrade " Highest grade achieved" race " Race" 2.race "
Black" /// 3.race " Hispanic" 4.race " Other" _cons "Constant") ///
refcat(2.race " White", label(---)) /// postfoot("Note:""* p |t|
[95% Conf. Interval] --------">
Toxoplasmosis Gondii At low poverty-to-income T. Gondii is
related to reduced cognitive functioning At low poverty-to-income
T. Gondii is related to reduced cognitive functioning At high PIR
T. Gondii is related to increased cognitive functioning At high PIR
T. Gondii is related to increased cognitive functioning
Slide 22
. lowess sdl pir, by(toxbin)
Slide 23
Table 2. Latent Toxoplasmosis and Symbol-Digit Learning Test:
Poverty-to-income Ratio as Quadratic
----------------------------------------------------------- b 95%
CI -----------------------------------------------------------
Toxoplasmosis (Toxo).93**.26,1.60 Poverty-to-income ratio (PIR)
-.58*** -.90,-.26 PIR^2.04*.01,.08 Toxo X PIR -.22* -.40,-.03
Controls Female.06 -.24,.36 Age.09***.08,.11 Highest grade achieved
-.51*** -.59,-.43 Race White --- Black 1.66*** 1.30,2.02 Hispanic
2.33*** 1.71,2.94 Other 2.29*** 1.22,3.36 Constant 8.12***
6.80,9.44
----------------------------------------------------------- N 4169
R squared.27
----------------------------------------------------------- Note: *
p