2
votes

I'm finalizing a short research note and having difficulty with my code in Stata 13.

I am estimating the effect of several variables on an ordinal dependent variable. I've run the initial estimation using ordered probit and generated predicted probabilities. For the purpose of this research note, I am required to generate confidence intervals for the predicted probabilities by hand (using simulation). Unfortunately, margins is not in my immediate future.

I've been trying to run the simulation but whenever I include the index function [i']` for each cut point of the dependent variable, I receive the error:

equation cut1][1 not found

The code I am using is:

set seed 23
mat b = e(b)
mat V = e(V)
drawnorm b_term b_pres b_acc cut1 cut2 cut3 cut4 cut5 cut6, mean(b) cov(V) n(1000) clear

gen p_1a_mean = .
forvalues i = 1/1000 {
    gen p_1a_`i' = normal(_b[/cut1][`i'] - (term*b_term[`i'] + pres*b_pres[`i'] + acc*b_acc[`i']))
    summarize p_1a_`i', meanonly
    replace p_1a_mean = r(mean) in `i'
}

drop p_1a_1-p_1a_1000

I find that when I do not index the cutpoint, I am able to run the code perfectly. This is strange, because I was let to believe that failing to index the cutpoint will bias the results.

Does anyone have any insight as to where I'm going wrong?

1
This is an international forum, so goodness knows how many people what UMD is. It doesn't matter for the question, however. - Nick Cox
Hey Nick, absolutely. I just wanted to give credit where credit was due, so that it didn't look like I came up with this on my own! - Yasha
A side-comment is that generating 1000 new variables here is quite unnecessary. You just need to initialise a single p_la outside the loop and replace it with new simulation results inside the loop. - Nick Cox
Hi Nick - that's pretty interesting; I didn't know that you could do that. I was given this code and told to use it, so I didn't want to deviate from the assignment, but in future attempts, I will try your suggestion. Thank you! - Yasha

1 Answers

2
votes

You don't show all your code but you are evidently fitting an ordered probit upstream. Consider the simplest kind of example:

. sysuse auto
(1978 Automobile Data)

. oprobit rep78 weight

[stuff omitted]
------------------------------------------------------------------------------
       rep78 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      weight |  -.0005881   .0001729    -3.40   0.001     -.000927   -.0002492
-------------+----------------------------------------------------------------
       /cut1 |  -3.797833   .6421343                     -5.056393   -2.539273
       /cut2 |  -2.954918   .5957484                     -4.122563   -1.787272
       /cut3 |  -1.582673   .5471056                      -2.65498   -.5103658
       /cut4 |  -.6635675   .5192685                     -1.681315      .35418
 ------------------------------------------------------------------------------

. di _b[/cut1]
-3.7978328

The coefficient you are using is a single estimate. It isn't to be subscripted and there are certainly aren't one thousand members of the same family, as your subscripting implies.