Two-Stage Least Squares Program
MacDonald R. Phillips
phillipm.ggd@gao.gov
October 7, 1996
Platforms: HP48G and HP48GX

The file consists of three files: TWOST, APLY, and TSLS.TXT. 
Enter the programs TWOST and APLY in binary mode to your home
directory.  TWOST will create a subdirectory for computing your
two stage estimates.  APLY is the program from the TEACH command
and is used by the TSLS program.  You can either leave it in your
HOME directory or put it in the TWOST subdirectory.

Two-stage least squares is a statistical method used to estimate
the equations in simultaneous systems one by one.  The equation
is of the form:  y = Alpha + Y1*Beta + X1*Gamma + u.  For each
equation to be estimated, four matrixes must be entered.  They
are:

1:  X1 - an n X i matrix of the predetermined (exogenous)
variables appearing in the equation.  A column of ones is added
by the program so as to compute an intercept.

2:  X2 - an n X j matrix of the predetermined (exogenous)
variables not appearing in the equation.

3:  Y1 - an n X k matrix of the other dependent (endogenous)
variables appearing in the equation.

4:  Y - an n X 1 (one) matrix of the dependent variable of the
equation.

The matrixes may be stored in the appropriate variables or
entered on the stack in the above order.  The program TSLS
accepts either method; however, it does not test whether the
variables are actually matrixes and will crash if they are not.

The program TSLS computes four things and puts them on levels 1-4
on the stack.  On level 4 is the degrees of freedom of the t
values.  On level 3 is a vector of the t values for the computed
coefficients.  On level 2 is a vector of the standard errors of
the computed coefficients.  On level 1 is a vector of the
computed coefficients of the form [Alpha, Beta, Gamma], where
Alpha is the value of the intercept, Beta is the k coefficients
of the Y1 matrix, and Gamma is the i coefficients of the X1
matrix.

Given a set of Y1 and X1 values in vector from, [Y1, X1], the
program YX->Y will compute an estimated Y value.  The leading one
for the alpha coefficient is added by the program.

If you have any questions, comments, or suggestions please send
me an email.

Source: Econometric Methods, 2nd Edition, J. Johnston, McGraw-
Hill Book Company, New York, 1972, pp. 380-2.