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?
p_laoutside the loop andreplaceit with new simulation results inside the loop. - Nick Cox