Hi Everyone,
My question is, how can we estimate the marginal effect after IVPOISSON?
I saw a post that IVPROBIT requires some sort of correction after you run IVPROBIT: See https://www.statalist.org/forums/for...after-ivprobit.
This made me wonder if we need to do some sort of correction for IVPOSSION too when calculating the marginal effect.
To illustrate both commands, and that correction of IVPROBIT produced different results, I provided some examples below.
Thank you so much for your help,
Alex
webuse trip, clear
ivpoisson cfunction trips cbd ptn worker weekend (tcost=pt)
margins, dydx(tcost)
*Question: do we need to do some sort of correction like IVPORBIT? and if yes, how to?
*generate a binary variable for trip to illustrate IVPROBIT
gen b_trip=(trips>0)
ivprobit b_trip cbd ptn worker weekend (tcost=pt)
margins, dydx(tcost)
*correction from the previous IVPORBIT post
margins, dydx(tcost) predict(pr fix(tcost))
. webuse trip, clear
. ivpoisson cfunction trips cbd ptn worker weekend (tcost=pt)
Step 1
Iteration 0: GMM criterion Q(b) = .00056156
Iteration 1: GMM criterion Q(b) = 2.366e-07
Iteration 2: GMM criterion Q(b) = 5.552e-14
Iteration 3: GMM criterion Q(b) = 9.760e-27
note: model is exactly identified
Exponential mean model with endogenous regressors
Number of parameters = 13 Number of obs = 5,000
Number of moments = 13
Initial weight matrix: Unadjusted
GMM weight matrix: Robust
------------------------------------------------------------------------------
| Robust
trips | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
trips |
cbd | -.0082567 .0020005 -4.13 0.000 -.0121777 -.0043357
ptn | -.0113719 .0021625 -5.26 0.000 -.0156102 -.0071335
worker | .6903044 .0521642 13.23 0.000 .5880645 .7925444
weekend | .2978149 .0356474 8.35 0.000 .2279472 .3676825
tcost | .0320718 .0092738 3.46 0.001 .0138955 .0502481
_cons | .2145986 .1359327 1.58 0.114 -.0518246 .4810218
-------------+----------------------------------------------------------------
tcost |
cbd | .0165466 .0043693 3.79 0.000 .0079829 .0251102
ptn | -.040652 .0045946 -8.85 0.000 -.0496573 -.0316467
worker | 1.550985 .0996496 15.56 0.000 1.355675 1.746294
weekend | .0423009 .0779101 0.54 0.587 -.1104002 .1950019
pt | .7739176 .0150072 51.57 0.000 .7445041 .8033312
_cons | 12.13934 .1123471 108.05 0.000 11.91915 12.35954
-------------+----------------------------------------------------------------
/c_tcost | .1599984 .0111752 14.32 0.000 .1380954 .1819014
------------------------------------------------------------------------------
Instrumented: tcost
Instruments: cbd ptn worker weekend pt
. margins, dydx(tcost)
Average marginal effects Number of obs = 5,000
Model VCE : Robust
Expression : Predicted number of events, predict()
dy/dx w.r.t. : tcost
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
tcost | .1213036 .0354129 3.43 0.001 .0518957 .1907115
------------------------------------------------------------------------------
.
. *generate a binary variable for trip to illustrate IVPROBIT
. gen b_trip=(trips>0)
. ivprobit b_trip cbd ptn worker weekend (tcost=pt)
Fitting exogenous probit model
Iteration 0: log likelihood = -2359.9974
Iteration 1: log likelihood = -2113.0152
Iteration 2: log likelihood = -2109.5136
Iteration 3: log likelihood = -2109.5126
Iteration 4: log likelihood = -2109.5126
Fitting full model
Iteration 0: log likelihood = -13816.879
Iteration 1: log likelihood = -13816.877
Iteration 2: log likelihood = -13816.877
Probit model with endogenous regressors Number of obs = 5,000
Wald chi2(5) = 153.15
Log likelihood = -13816.877 Prob > chi2 = 0.0000
-------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
--------------+----------------------------------------------------------------
tcost | .032658 .0124063 2.63 0.008 .0083422 .0569738
cbd | -.0078241 .0026063 -3.00 0.003 -.0129323 -.0027158
ptn | -.0106348 .0027012 -3.94 0.000 -.0159292 -.0053405
worker | .4967599 .0574409 8.65 0.000 .3841778 .609342
weekend | .1840408 .0488222 3.77 0.000 .0883511 .2797306
_cons | .1925618 .1719024 1.12 0.263 -.1443607 .5294843
--------------+----------------------------------------------------------------
corr(e.tcost,|
e.b_trip)| .3100046 .0335613 .2428287 .3742216
sd(e.tcost)| 2.515658 .0251566 2.466832 2.56545
-------------------------------------------------------------------------------
Instrumented: tcost
Instruments: cbd ptn worker weekend pt
-------------------------------------------------------------------------------
Wald test of exogeneity (corr = 0): chi2(1) = 74.53 Prob > chi2 = 0.0000
. margins, dydx(tcost)
Average marginal effects Number of obs = 5,000
Model VCE : OIM
Expression : Fitted values, predict()
dy/dx w.r.t. : tcost
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
tcost | .032658 .0124063 2.63 0.008 .0083422 .0569738
------------------------------------------------------------------------------
. margins, dydx(tcost) predict(pr fix(tcost))
Average marginal effects Number of obs = 5,000
Model VCE : OIM
Expression : Probability of positive outcome, predict(pr fix(tcost))
dy/dx w.r.t. : tcost
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
tcost | .0080811 .002996 2.70 0.007 .002209 .0139532
------------------------------------------------------------------------------
. log close
name: <unnamed>
log: /Users/alex/question.txt
log type: text
closed on: 9 Sep 2022, 11:07:40
--------------------------------------------------------------------------------
My question is, how can we estimate the marginal effect after IVPOISSON?
I saw a post that IVPROBIT requires some sort of correction after you run IVPROBIT: See https://www.statalist.org/forums/for...after-ivprobit.
This made me wonder if we need to do some sort of correction for IVPOSSION too when calculating the marginal effect.
To illustrate both commands, and that correction of IVPROBIT produced different results, I provided some examples below.
Thank you so much for your help,
Alex
webuse trip, clear
ivpoisson cfunction trips cbd ptn worker weekend (tcost=pt)
margins, dydx(tcost)
*Question: do we need to do some sort of correction like IVPORBIT? and if yes, how to?
*generate a binary variable for trip to illustrate IVPROBIT
gen b_trip=(trips>0)
ivprobit b_trip cbd ptn worker weekend (tcost=pt)
margins, dydx(tcost)
*correction from the previous IVPORBIT post
margins, dydx(tcost) predict(pr fix(tcost))
. webuse trip, clear
. ivpoisson cfunction trips cbd ptn worker weekend (tcost=pt)
Step 1
Iteration 0: GMM criterion Q(b) = .00056156
Iteration 1: GMM criterion Q(b) = 2.366e-07
Iteration 2: GMM criterion Q(b) = 5.552e-14
Iteration 3: GMM criterion Q(b) = 9.760e-27
note: model is exactly identified
Exponential mean model with endogenous regressors
Number of parameters = 13 Number of obs = 5,000
Number of moments = 13
Initial weight matrix: Unadjusted
GMM weight matrix: Robust
------------------------------------------------------------------------------
| Robust
trips | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
trips |
cbd | -.0082567 .0020005 -4.13 0.000 -.0121777 -.0043357
ptn | -.0113719 .0021625 -5.26 0.000 -.0156102 -.0071335
worker | .6903044 .0521642 13.23 0.000 .5880645 .7925444
weekend | .2978149 .0356474 8.35 0.000 .2279472 .3676825
tcost | .0320718 .0092738 3.46 0.001 .0138955 .0502481
_cons | .2145986 .1359327 1.58 0.114 -.0518246 .4810218
-------------+----------------------------------------------------------------
tcost |
cbd | .0165466 .0043693 3.79 0.000 .0079829 .0251102
ptn | -.040652 .0045946 -8.85 0.000 -.0496573 -.0316467
worker | 1.550985 .0996496 15.56 0.000 1.355675 1.746294
weekend | .0423009 .0779101 0.54 0.587 -.1104002 .1950019
pt | .7739176 .0150072 51.57 0.000 .7445041 .8033312
_cons | 12.13934 .1123471 108.05 0.000 11.91915 12.35954
-------------+----------------------------------------------------------------
/c_tcost | .1599984 .0111752 14.32 0.000 .1380954 .1819014
------------------------------------------------------------------------------
Instrumented: tcost
Instruments: cbd ptn worker weekend pt
. margins, dydx(tcost)
Average marginal effects Number of obs = 5,000
Model VCE : Robust
Expression : Predicted number of events, predict()
dy/dx w.r.t. : tcost
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
tcost | .1213036 .0354129 3.43 0.001 .0518957 .1907115
------------------------------------------------------------------------------
.
. *generate a binary variable for trip to illustrate IVPROBIT
. gen b_trip=(trips>0)
. ivprobit b_trip cbd ptn worker weekend (tcost=pt)
Fitting exogenous probit model
Iteration 0: log likelihood = -2359.9974
Iteration 1: log likelihood = -2113.0152
Iteration 2: log likelihood = -2109.5136
Iteration 3: log likelihood = -2109.5126
Iteration 4: log likelihood = -2109.5126
Fitting full model
Iteration 0: log likelihood = -13816.879
Iteration 1: log likelihood = -13816.877
Iteration 2: log likelihood = -13816.877
Probit model with endogenous regressors Number of obs = 5,000
Wald chi2(5) = 153.15
Log likelihood = -13816.877 Prob > chi2 = 0.0000
-------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
--------------+----------------------------------------------------------------
tcost | .032658 .0124063 2.63 0.008 .0083422 .0569738
cbd | -.0078241 .0026063 -3.00 0.003 -.0129323 -.0027158
ptn | -.0106348 .0027012 -3.94 0.000 -.0159292 -.0053405
worker | .4967599 .0574409 8.65 0.000 .3841778 .609342
weekend | .1840408 .0488222 3.77 0.000 .0883511 .2797306
_cons | .1925618 .1719024 1.12 0.263 -.1443607 .5294843
--------------+----------------------------------------------------------------
corr(e.tcost,|
e.b_trip)| .3100046 .0335613 .2428287 .3742216
sd(e.tcost)| 2.515658 .0251566 2.466832 2.56545
-------------------------------------------------------------------------------
Instrumented: tcost
Instruments: cbd ptn worker weekend pt
-------------------------------------------------------------------------------
Wald test of exogeneity (corr = 0): chi2(1) = 74.53 Prob > chi2 = 0.0000
. margins, dydx(tcost)
Average marginal effects Number of obs = 5,000
Model VCE : OIM
Expression : Fitted values, predict()
dy/dx w.r.t. : tcost
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
tcost | .032658 .0124063 2.63 0.008 .0083422 .0569738
------------------------------------------------------------------------------
. margins, dydx(tcost) predict(pr fix(tcost))
Average marginal effects Number of obs = 5,000
Model VCE : OIM
Expression : Probability of positive outcome, predict(pr fix(tcost))
dy/dx w.r.t. : tcost
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
tcost | .0080811 .002996 2.70 0.007 .002209 .0139532
------------------------------------------------------------------------------
. log close
name: <unnamed>
log: /Users/alex/question.txt
log type: text
closed on: 9 Sep 2022, 11:07:40
--------------------------------------------------------------------------------
