Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Zellner's SUR for limited dependent variables model usingpanel data


From   "Adane Tuffa Debela" <[email protected]>
To   <[email protected]>
Subject   st: Zellner's SUR for limited dependent variables model usingpanel data
Date   Tue, 22 Mar 2005 13:53:45 +0100

Dear STATA users:

The following do file is  for estimating a system of simultaneous
equations involving limited dependent  and continuous variables using
the two-stage
limited dependent variable (2SLDV) procedure. I am also using a panel
data model to control for unobserved cluster level fixed effects
although my data do  not involve time-series observations. To make it
simple I have already
predicted each of the dependent variables in the first stage using
only
exogenous explanatory variables and have saved them in the data file
which is not posted here. The  do file here  is therefore for the second
stage estimation. It is already framed for estimating the second stage
with
the coefficients  to be bootstrapped.  But since I am assuming (and
believe)
that the errors across the equations are correlated, I want to use the
Zellner's SUR to estimate the system in this second stage. 

But I don't know what syntaxes or codes to add to the do file
already framed. Please note that I still want to keep the
bootstrapping and predicting and including the Mill's ratios as they
are. I am already aware that Stata does not have command for Zellner's
Sur involving panel data models.

I am wondering if any body knows or have heard of any user-written
program to estimate this model.

I look forward to hearing from you.

Regards,
Adane


The file is:



cap prog drop _all 


program define myboot, eclass
version 8 
tempname b V tmpb 
tempvar   xb1  xb2  imr12  imr22 

*****1***
.xtprobit fallow interhat manhat fertynhat herbiynhat ltlszocu  ///
lage edu eduto6 ltlutlsz cwr irrg loxotlsz lwftlsz   ///
  grazland rrl, re i(loca) 

 matrix `tmpb' = e(b) 

matrix colnames `tmpb' = interhat manhat fertynhat herbiynhat ltlszocu 
 ///
lage edu eduto6 ltlutlsz cwr irrg loxotlsz lwftlsz  ///
 grazland rrl  _cons

matrix coleq `tmpb' = eq1: 
matrix `b' = nullmat(`b') , `tmpb' 


*****2****
.xtprobit inter fallowhat manhat fertynhat herbiynhat ///
lolszocu lage  eduto6 cwr lwfolsz ltluolsz mktdist ///
 walkpt4  rrl , i(loca) pa robust


matrix `tmpb' = e(b) 

matrix colnames `tmpb' =fallowhat manhat fertynhat herbiynhat   ///
lolszocu lage  eduto6 cwr lwfolsz ltluolsz mktdist  ///
walkpt4  rrl  _cons

matrix coleq `tmpb' = eq2: 
matrix `b' = `b', `tmpb'


****3****
.xtprobit man fallowhat interhat fertynhat herbiynhat ///
 lolszocu lage edu eduto6 irrg cwr lwfolsz ltluolsz ///
publict2  walkpt4 rrl fuel2d1 fuel2d2, i(loca) pa robust

matrix `tmpb' = e(b) 

matrix colnames `tmpb' =fallowhat interhat fertynhat herbiynhat  ///
 lolszocu lage edu eduto6 irrg cwr lwfolsz ltluolsz  /// 
 publict2 walkpt4 rrl fuel2d1 fuel2d2 _cons

matrix coleq `tmpb' = eq3: 
matrix `b' = `b', `tmpb'
 
  ***4.1****
.xtprobit fertyn fallowhat interhat manhat herbiynhat ///
 lolszocu lage  eduto6 irrg  loxolsz cwr  ltluolsz ///
mktdist  publict2 walkpt4 rrl mfratio,  i(loca) pa robust

matrix `tmpb' = e(b) 

matrix colnames `tmpb' =fallowhat interhat manhat herbiynhat   ///
lolszocu lage  eduto6 irrg  loxolsz cwr  ltluolsz  ///
 mktdist  publict2 walkpt4 rrl mfratio _cons

matrix coleq `tmpb' = eq4: 
matrix `b' = `b', `tmpb' 
predict double `xb1', xb 
gen double `imr12' = normden(`xb1')/norm(`xb1') 



     ***4.2***

.areg lfertamop  `imr12'  fallowhat interhat manhat ///
herbiamophat  lolszocu lage edu eduto6   loxolsz irrg  ///
 cwr lwfolsz   ltluolsz     sex   publict2 mktdist walkpt4  ///
  rrl mfratio,absorb(loca) robust  cluster(loca),  if  fertamop>0


matrix `tmpb' = e(b) 

matrix colnames `tmpb' =imr12   fallowhat interhat manhat  ///
herbiamophat  lolszocu lage edu eduto6   loxolsz irrg   ///
cwr lwfolsz   ltluolsz     sex   publict2 mktdist walkpt4  ///
   rrl mfratio _cons

matrix coleq `tmpb' = eq5: 
matrix `b' = `b', `tmpb'


***5.1***

.xtprobit herbiyn  fallowhat interhat manhat fertynhat ///
lolszocu lage edu eduto6 sex ltluolsz lwfolsz mktdist ///
publict2   walkpt4 rrl mfratio, i(loca) pa robust

matrix `tmpb' = e(b) 

matrix colnames `tmpb' = fallowhat interhat manhat fertynhat   ///
lolszocu lage edu eduto6 sex ltluolsz lwfolsz mktdist ///
 publict2    walkpt4 rrl mfratio _cons

matrix coleq `tmpb' = eq6: 
matrix `b' = `b', `tmpb'
predict double `xb2', xb
gen double `imr22' = normden(`xb2') / norm(`xb2') 


***5.2***
.xtgls lherbiamop  `imr22' fallowhat interhat manhat fertamophat ///
  lolszocu lage edu eduto6 sex  lwfolsz  ltluolsz ///
 publict2  walkpt4 rrl mfratio, panel(hetero) i(loca), if herbiamop>0 

matrix `tmpb' = e(b) 

matrix colnames `tmpb' = imr22 fallowhat interhat manhat fertamophat 
///
lolszocu lage edu eduto6 sex  lwfolsz  ltluolsz ///
 publict2  walkpt4 rrl mfratio _cons

matrix coleq `tmpb' = eq7: 
matrix `b' = `b', `tmpb'

tempvar es 
gen byte `es' = e(sample) 
local j = colsof(`b') 
matrix `V' = I(`j') 
local j : colfullnames(`b') 
matrix rownames `V' = `j' 
matrix colnames `V' = `j' 
ereturn post `b' `V' , esample(`es') 


end 

set seed 123456 
bootstrap "myboot" _b  ,reps(70) dots saving(strategystrap) /// 
replace noesample


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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