Statalist


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

st: Re: Simulating Instrumental Variable Probit Model


From   Sachin Chintawar <[email protected]>
To   [email protected]
Subject   st: Re: Simulating Instrumental Variable Probit Model
Date   Tue, 21 Apr 2009 10:39:26 -0600

Thank You Dr. Martin
Well I did make the changes and got my program to do most of what I
really wanted to do - except for a few problems. Below is the program
---------------------------------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 x1 = 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 x2 = z1 + z2 + z3 + z4 + a
    regress x2  z1 z2 z3 z4 mu                // endogenous regressor
with four instruments
    predict px2
                  					
    generate y = 0.5 + 2*x1 + px2 + mu + u>4    //Reduced Form Equation
    ivprobit y x1 px2
    return scalar b2 = _b[x1]
    return scalar b3 = _b[x2hat]
    return scalar se2 = _se[x1]								
    return scalar se3 = _b[x2hat]
end
simulate b2=r(b2) b3=r(b3) se2r=r(se2) se3r=r(se3), ///
    reps($numsims): endoprob
---------------------------------------------End
Program---------------------------------------------------------------------------

Every time I run the program, there is an error suggesting that there
is no endogenous variable and that I need to use just probit. This
totally negates the point of doing my simulation. Did I specify the
program wrong in some way? and if so what I can do to mend it?
Any help would be really appreciated.
Thank you
Sachin
*
*   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