TSLS (2SLS) (Scripts) Publisher's description
Original model: y = X*beta + u
% Original model: y = X*beta + u
% We are concerned that a regressor in X
% could be endogenous.
% W contains the instruments and all regressors in X
% except the suspected one.
% An example:
% m_t = b1 + b2*r_t + b3*y_t + b4*m_(t-1) + b5*m_(t-2) + u_t
% In this model, we have a concern that r_t could be correlated
% with u_t and we want to see the results with instruments,
% r_(t-1) and r_(t-2). So the inputs y, X and W must be
% y = m_t;
% X = [ones(length(y)) r y m_(t-1) m_(t-2)];
% W = [ones(length(y)) r_(t-1) r_(t-2) y m_(t-1) m_(t-2)];
% Please do not forget checking the length of the variables be equal
One computational method which can be used to calculate IV estimates is two-stage least squares (2SLS). In the first stage, each endogenous covariate in the equation of interest is regressed on all of the exogenous variables in the model, including both exogenous covariates in the equation of interest and the excluded instruments. The predicted values from these regressions are obtained.
Stage 1: Regress each column of X on W, (X = WОґ + errors)
and save the predicted (fitted) values:
In the second stage, the regression of interest is estimated as usual, except that in this stage each endogenous covariate is replaced with the predicted values from its first stage model from the first stage.
Stage 2: Regress Y on the predicted values from the first stage:
Y=^XОІ+residuals (original model: Y=XОІ+u)
The resulting estimator of ОІ is numerically identical to the expression displayed above. A small correction must be made to the sum-of-squared residuals in the second-stage fitted model in order that the covariance matrix of ОІ is calculated correctly.
System Requirements:MATLAB 7.1.0 (R14SP3)
Program Release Status: New Release
Program Install Support: Install and Uninstall