Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73330

mlogit compare marginal effects (margins) across two models

$
0
0
I would like to compare the marginal effects of variable B on two models: one which has variable A as the dependent variable, and another that has variable C as the dependent variable.
I attach the code and the four variables (A, B, C, wave).
wave is a dummy variable which denotes three sub periods (0,1,2). I would like to study whether the marginal effect of B on A is different than the effect of B on C for the three subperiods.
But I don't know how to refer to the margins of the two models. If it was the same dependent variable I could do test [B]2.wave = [B]1.wave but how can I refer to the marginal effects of different models (different dependent variables)?


Code:
forval i=1/5{
drop outcome`i'
}

forval i=1/5{
drop outcome_eu_`i'
}

set more off

mlogit A constant i.wave##c.B, noconstant base(0) noomitted noemptycells
est store m

forval i = 1/5 {
predict outcome`i', outcome(`i') pr
}

forval i = 1/5 {
est res m
margins, dydx(B) over(wave) pr(out(`i')) atmeans post
quietly su outcome`i'
estadd scalar pr = r(mean)
est sto m`i'
}

mlogit C constant i.wave##c.B, noconstant base(0) noomitted noemptycells
est store m_eu
 
forval i = 1/5 {
predict outcome_eu_`i', outcome(`i') pr
}
 
forval i = 1/5 {
est res m_eu
margins, dydx(B) over(wave) pr(out(`i')) atmeans post
//test [B]2.wave = [B]1.wave
quietly su outcome_eu_`i'
estadd scalar pr = r(mean)
est sto m_eu`i'
}


forval i = 1/5 {
test m_eu`i' = m`i'
}

Viewing all articles
Browse latest Browse all 73330

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>