<>
Well, -ivprobit- does not return e(rmse)... Note that you can use the
returned values of -ivprobit- for the -simulate- command.
****
global numobs 500 // sample size N
global numsims "50" // number of simulations
set seed 123456789
capture program drop endoprob
program endoprob // , rclass
version 10.1
drop _all
set obs $numobs
generate u = rnormal(0)
generate mu = rnormal(0)
//generate x = rnormal(0)
generate z1 = rnormal(0) // 4 Instruements
generate z2 = rnormal(0)
generate z3 = rnormal(0)
generate z4 = rnormal(0)
// Also be written *drawnorm u mu x1 z1 z2 z3 z4
generate a = 0.5*u
generate x = z1 + a
regress x z1 // endogenous regressor with four instruments
predict px
generate y = 0.5 + px + mu + u>4 //Reduced Form Equation
ivprobit y (x= z1)
end
simulate _b _se , ///
reps($numsims): endoprob
mean x* y*
****
HTH
Martin
_______________________
----- Original Message -----
From: "Sachin Chintawar" <[email protected]>
To: <[email protected]>
Sent: Thursday, April 23, 2009 7:57 PM
Subject: st: Capturing RMSE after MC Simulations
Dear All
After a long struggle with stata I am back to asking a new question. I
have used MC Simulations for a IVProbit regression. I now want to
capture the RMSE (Root MEan Square Error) for the Model. Well I know
that using the display e(rmse) should have done the trick but I guess
I should say it differently so it captures it. Unfortunately I could
not get to work. Below find the program that I wrote for an MC
simulation for IVProbit.
Any inputs will be greatly appreciated
Thanks
Sachin
--------------------------------------------------------------------Start
Example---------------------------------------------------------
global numobs 500 // sample size N
global numsims "1000" // number of simulations
set seed 123456789
capture program drop endoprob
program endoprob, rclass
version 10.1
drop _all
set obs $numobs
generate u = rnormal(0)
generate mu = rnormal(0)
//generate x = rnormal(0)
generate z1 = rnormal(0) // 4 Instruements
generate z2 = rnormal(0)
generate z3 = rnormal(0)
generate z4 = rnormal(0)
// Also be written *drawnorm u mu x1 z1 z2 z3 z4
generate a = 0.5*u
generate x = z1 + a
regress x z1 // endogenous regressor with four
instruments
predict px
generate y = 0.5 + px + mu + u>4 //Reduced Form Equation
ivprobit y (x= z1)
// return scalar b2 = _b[x]
return scalar b = _b[x]
// return scalar se2 = _se[x]
return scalar se = _se[x]
end
simulate br=r(b) ser=r(se), ///
reps($numsims): endoprob
mean br ser
--------------------------------------------------End
Program----------------------------------------------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/