Statalist


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

st: Re: Capturing RMSE after MC Simulations


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Capturing RMSE after MC Simulations
Date   Thu, 23 Apr 2009 20:15:07 +0200

<>

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" <schint1@tigers.lsu.edu>
To: <statalist@hsphsun2.harvard.edu>
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/



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