我有兴趣从随机效应 logit 模型中重现平均边际效应(在 Stata 中使用 运行xtlogit
)。我了解如何logit
使用 Delta 方法从模型中重现平均边际效应。例如,在下面的代码中,我成功地重现了age
报告的平均边际效应margins
。
*** Stata code
* download data
webuse union, clear
* calculate delta and copy variable of interest - age
sum age
gen xdelta = r(sd)/1000
clonevar age_ = age
* run logit model and calculate average marginal effect using margins
logit union age_
margins,dydx(age_)
* calculate average marginal effect by hand - mean of xme equals result from margins above
predict p1
replace age_ = age_+xdelta
predict p2
gen xme = (p2 - p1) / xdelta
sum xme
* calculate average marginal effect at fixed value of age using margins
margins,at(age=(16))
* calculate average marginal effect by hand - mean of p3 equals result from margins above
replace age_ = 16
predict p3
sum p3
我苦苦挣扎的地方是重现xtlogit
模型的平均边际效应。
*** Stata code
* download data and designate panel variables
webuse union, clear
xtset idcode year
* run xtlogit model
xtlogit union age
* calculate average marginal effects - can't figure out how to reproduce these estimates :(
margins, dydx(*)
margins, at(age=(16))
xtlogit
非常感谢任何有助于弄清楚如何重现边际效应的帮助。谢谢!
----- 编辑以更清楚地表明我有兴趣复制由margins