# tsls.est: The Two-Stage Least Squares (TSLS) estimator. In SteinIV: Semi-Parametric Stein-Like Estimator with Instrumental Variables

## Description

Computes the TSLS estimator for a two-stage structural model, as well as the set of standard errors for each individual estimator, and the sample estimate of the asymptotic variance/covariance matrix.

## Usage

 1  tsls.est(y,X,Z,SE=FALSE) 

## Arguments

 y Numeric: A vector of observations, representing the outcome variable. X Numeric: A matrix of observations, whose number of columns corresponds to the number of predictors in the model, and the number of rows should be conformal with the number of entries in y. This matrix may contain both endogenous and exogenous variables. Z Numeric: A matrix of observations representing the intrumental variables (IVs) in the first-stage structural equation. The number of IVs should be at least as large as the number of endogenous variables in X. SE Logical: If TRUE, then the function also returns the standard errors of the individual TSLS estimator, and a sample estimate of its asymptotic variance/covariance matrix.

## Details

The TSLS estimator is applied to a two-stage structural model. We here adopt the terminology commonly used in econometrics. See, for example, the references below for Cameron and Trivedi (2005), Davidson and MacKinnon (1993), as well as Wooldridge (2002). The second-stage equation is thus modelled as follows,

y = Xβ + ε,

in which y is a vector of n observations representing the outcome variable, X is a matrix of order n\times k denoting the predictors of the model, and comprised of both exogenous and endogenous variables, β is the k-dimensional vector of parameters of interest; whereas ε is an unknown vector of error terms.

The first-stage level of the model is given by a multivariate multiple regression. That is, this is a linear modle with a multivariate outcome variable, as well as multiple predictors. This first-stage model is represented in this manner,

X = ZΓ + Δ

, where X is the matrix of predictors from the second-stage equation, Z is a matrix of instrumental variables (IVs) of order n \times l, Γ is a matrix of unknown parameters of order l\times k; whereas Δ denotes an unknown matrix of order n\times k of error terms.

Whenever certain variables in X are assumed to be exogenous, these variables should be incorporated into Z. That is, all the exogneous variables are their own instruments. Moreover, it is also assumed that the model contains at least as many instruments as predictors, in the sense that l≥q k, as commonly donein practice (Wooldridge, 2002). Also, the matrices, X^TX, Z^TX, and Z^TZ are all assumed to be full rank. Finally, both X and Z should comprise a column of one's, representing the intercept in each structural equation.

The formula for the TSLS estimator is then obtained in the standard fashion by the following equation,

\hatβ_{TSLS} := (\hat{X}^T\hat{X})^{-1}(\hat{X}^{T}y),

where \hat{X}:=H_zX, is the orthogonal projection of the matrix X, onto the vector space spanned by the columns of Z; and H_{z}:=Z(Z^{T}Z)^{-1}Z^{T} is the hat matrix of the first-stage multivariate regression.

When requested by the user, the standard errors of each entry in \hatβ_{TSLS} are also provided, as a vector. These are computed by taking the squareroot of the diagonal entries of the sample asymptotic variance/covariance matrix, which is given by the following equation,

\hatΣ_{TSLS} := \hatσ^{2}(\hat{X}^{T}\hat{X})^{-1},

in which the sample residual sum of squares is \hatσ^{2}:=(y - X\hatβ_{TSLS})^{T}(y - X\hatβ_{TSLS})/(n-k).

## Value

 list A list with one or three arguments, depending on whether the user has activated the SE flag. The first element (est) in the list is the TSLS estimate of the model in vector format. The second element (se) is the vector of standard errors; and the third element (var) is the sample estimate of the asymptotic variance/covariance matrix.

## Author(s)

Cedric E. Ginestet <cedric.ginestet@kcl.ac.uk>

## References

Cameron, A. and Trivedi, P. (2005). Microeconometrics: Methods and Applications. Cam- bridge University press, Cambridge.

Davidson, R. and MacKinnon, J.G. (1993). Estimation and inference in econometrics. OUP Catalogue.

Wooldridge, J. (2002). Econometric analysis of cross-section and panel data. MIT press, London.

## Examples

  1 2 3 4 5 6 7 8 9 10 ### Generate a simple example with synthetic data, and no intercept. n <- 100; k <- 3; l <- 3; Ga<- diag(rep(1,l)); be <- rep(1,k); Z <- matrix(0,n,l); for(j in 1:l) Z[,j] <- rnorm(n); X <- matrix(0,n,k); for(j in 1:k) X[,j] <- Z[,j]*Ga[j,j] + rnorm(n); y <- X%*%be + rnorm(n); ### Compute TSLS estimator with SEs and variance/covariance matrix. print(tsls.est(y,X,Z)); print(tsls.est(y,X,Z,SE=TRUE)); 

SteinIV documentation built on May 2, 2019, 6:17 a.m.