Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Capturing RMSE after MC Simulations


From   Sachin Chintawar <[email protected]>
To   [email protected]
Subject   st: Capturing RMSE after MC Simulations
Date   Thu, 23 Apr 2009 11:57:27 -0600

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index