We are running an oprobit for a 5-category dependent variable (Y) and would like to have a marginal effect graph for a continuous variable in the form of a graph in Prof. Williams’ “Adjusted Predictions & Marginal Effects for Multiple Outcome Models” https://www3.nd.edu/~rwilliam/xsoc73994/Margins05.pdf
Text and graph reproduced here (pp.4-5):
. mgen, at(age = (20(5)75)) stub(all)
. list allpr1 allpr2 allpr3 allpr4 allpr5 allage in 1/15
. line allpr1 allpr2 allpr3 allpr4 allpr5 allage, scheme(sj) name(pooled)
Array
The continuous independent variable (X1) essentially counts the number of days of a particular event in a country and we cluster around the regions in that country. Note, X2 and X3 are interactions of X1 and a set of dummy variables. The remainder are controls.
When we run the following:
. oprobit Y X1 X2 X3 X4 X5 … , vce(cluster countycode)
. margins , at(X1=(0(7)365))
We get this:
Predictive margins Number of obs = 9,407
Model VCE : Robust
1._predict : Pr(Y==1), predict(pr outcome(1))
2._predict : Pr(Y ==2), predict(pr outcome(2))
3._predict : Pr(Y ==3), predict(pr outcome(3))
4._predict : Pr(Y ==4), predict(pr outcome(4))
5._predict : Pr(Y ==5), predict(pr outcome(5))
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_predict#_at |
1 1 | . (not estimable)
1 2 | . (not estimable)
1 3 | . (not estimable)
1 4 | . (not estimable)
So, we re-ran the model and tried the mgen approach
. mgen, at(X1=(0(7)365))
Predictions from: margins, at(X1=(0(7)365)) predict(outcome())
Variable Obs Unique Mean Min Max Label
-------------------------------------------------------------------------------
_pr1 0 0 . . . pr(y=1) from margins
_ll1 0 0 . . . 95% lower limit
_ul1 0 0 . . . 95% upper limit
_X1 53 53 182 0 364 TmaxW_30-10
_Cpr1 0 0 . . . pr(y<=1)
_pr2 0 0 . . . pr(y=2) from margins
_ll2 0 0 . . . 95% lower limit
_ul2 0 0 . . . 95% upper limit
_Cpr2 0 0 . . . pr(y<=2)
_pr3 0 0 . . . pr(y=3) from margins
_ll3 0 0 . . . 95% lower limit
_ul3 0 0 . . . 95% upper limit
_Cpr3 0 0 . . . pr(y<=3)
_pr4 0 0 . . . pr(y=4) from margins
_ll4 0 0 . . . 95% lower limit
_ul4 0 0 . . . 95% upper limit
_Cpr4 0 0 . . . pr(y<=4)
_pr5 0 0 . . . pr(y=5) from margins
_ll5 0 0 . . . 95% lower limit
_ul5 0 0 . . . 95% upper limit
_Cpr5 0 0 . . . pr(y<=5)
--------------------------------------------------------------------------------
So we tried:
. margins, at(X1=(0(7)365)) predict(outcome(1)) predict(outcome(2)) predict(outcome(3)) predict(outcome(4)) predict(outcome(5))
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_predict#_at |
1 1 | . (not estimable)
1 2 | . (not estimable)
1 3 | . (not estimable)
1 4 | . (not estimable)
1 5 | . (not estimable)
1 6 | . (not estimable)
1 7 | . (not estimable)
...
It feels like the problem is in the model, but we are not sure how to identify the issue. Otherwise, are we doing something wrong in our effort to graph the margins?
Related Posts with Oprobit and marginsplot
Finding number of people of a given type for each groupI have a data set with 1000 observations. As an example, let's consider the following table: Grou…
ttest means and differencesHello, In the ttest help Stata notes that a test of differences occurs by subtracting the highest v…
varananewDear All, I'm looking for the varananew command or some help with it Someone could help me best f …
How to merge multiple data sets without id variable?Hi, I want to merge multiple cross-sectional micro data files for each year (1992-2003) to make a si…
making a number of variables based on values of other variablesHello, I have been receiving great help from the Stata Forum by searching - but today I have encount…
Subscribe to:
Post Comments (Atom)
0 Response to Oprobit and marginsplot
Post a Comment