我正在估计probitStata 中的常规模型并使用该margins命令来计算边际效应。
我试图说明在我的估计中将虚拟变量视为连续的,而不是将它们视为从 0 到 1 的离散变化时效果的变化。
probit dead dmage dmeduc i.dmar i.foreignb i.mblack i.mhispan i.motherr agesq i.tobacco i.alcohol
margins, dydx(alcohol tobacco) // treating the discrete variables
margins, dydx(alcohol tobacco) continuous
Run Code Online (Sandbox Code Playgroud)
根据文档,该margins命令使用e(). 但是,当我在使用margins命令后尝试保存估计值时,无论我是否使用
return list
ereturn list
Run Code Online (Sandbox Code Playgroud)
它只是从我的probit模型而不是margins命令返回保存的后估计结果。
如何存储边际效应值,然后将它们放入表格中以显示比较?
的文档margins说如果指定post选项,结果将在 e() 中返回。因此,这是一个可以执行您想要的操作的示例:
sysuse auto, clear
gen byte good = rep78 > 3 if !missing(rep78)
probit good i.foreign price
margin , dydx(foreign) post
est store indicator
probit good foreign price
margins , dydx(foreign) post
est store continuous
est table indicator continuous, se
Run Code Online (Sandbox Code Playgroud)