Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: 2SLS, manipulating the coefficients of the 2nd stage


From   Eilya Torshizian <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: 2SLS, manipulating the coefficients of the 2nd stage
Date   Mon, 13 Jan 2014 06:06:19 +0000

Dear Statalist members,
 
I need to serve a semi two stage least squares (TSLS) in which the coefficients of the second stage are manipulated.
 
Here I am going to present a very short and simplified version of the estimations of GDP = C + I + G in which, C and I are instrumented by G and VARIABLE1. The first stage regressions are as follows,
 
1.1:
 
C = bc1*VAR1 + bc2*G
 
C: Consumption
 
VAR1: variable 1
 
G: Government expenditure
 
bc1, bc2: coefficients
 
1.2:
 
I = bi1*VAR1 + bi2*G
 
VAR1: variable 1
 
G: Government expenditure
 
bi1, bi2: coefficients
 
In the second stage I need to put the total of the first stages' coefficients in the equation. I need to have the p_values and other reported statistics based on the total coefficients, i.e. I am not going to estimate any
 
regression for the second stage but I need to report the second stage's statistics based on the first stage's derived multipliers. Thus the second stage's equation is as follows,
 
2:
 
GDP = (bc1 + bi1)*VAR1 + (1 + bc2 + bi2) * G
 
The code that I have attached below worries me from two aspects. First, I doubt if the replacement of coefficients in the second stage is done correctly? Second, I am not sure if the standard errors are biased or not?
 
The code is as follows:
 
*VARIABLES and MULTIPLIERS are written in capital letters
 
*Loading the dataset 
 
use "StataSheet.dta", clear
 
*Declare time-series settings
tsset YEAR
 
*First Stage Consumption regression (1.1)
 
regress C VAR1 G
 
gen BC1 = _b[VAR1]
 
gen BC2 = _b[G]
 
*First Stage Investment regression (1.2)
 
regress I VAR1 G
 
gen BI1 = _b[VAR1]
 
gen BI2 = _b[G]
 
*Summing up the coefficients derived from the first stages
 
gen BT1 = BC1 + BI1
 
gen BT2 = BC2 + BI2
 
*Second Stage regression
 
regress Y VAR1 G
 
*Here I am trying to get rid of the biased Standard errors. However, I am not sure if I need to do this!
 
predict double RES, residual
 
replace RES = RES^2  
 
quietly summ RES
 
scalar RMSE = r(mean)*r(N)/e(df_r) 
 
matrix VM = e(V)
 
matrix VM = e(V) * RMSE / e(rmse)^2
 
*I replace the coefficients by the total coefficients derived from the first stage
 
matrix M = e(b)
 
matrix M[1,1] = BT1
 
matrix M[1,2] = 1 + BT2
 
*I doubt if I am right here. I need to replace the coefficient matrix with the manipulated coefficient matrix (M).
 
ereturn post M VM, noclear
 
*Saving the results for the second stage (2),
 
estimates store EST1
 
*Run a Wald test of the equality of the replaced coefficients
 
test VAR1 G
 
*END
 
Thanks,
Eilya.
 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index