* LIMITED INFORMATION MAXIMUM LIKELIHOOD
* This example was proposed by Professor Ray Byron of Bond University
* in Australia. SHAZAM computes Two-Stage Least Squares estimation of a
* single equation in a simultaneous equation model with the 2SLS command as
* described in the chapter TWO-STAGE LEAST SQUARES AND SYSTEMS OF EQUATIONS.
* An alternative estimation method is Limited Information Maximum Likelihood
* (LIML).
* See Amemiya [1985, Section 7.3.2] for further information on LIML and
* the notation used in this example.
* The method shown in this procedure can be also be used to compute
* k-Class estimates by selecting a desired value of k.
SET NOECHO
PROC LIML
* If you do not want the PROC commands to print during the EXEC phase
* then SET NODOECHO here, only do this after the PROC is working properly.
SET NODOECHO
* *************************************************************
* INPUTS REQUIRED: EXOG, RHSEXOG RHSENDOG ENDOG
* *************************************************************
* To keep Proc variables distinct from others append the _ symbol
* This is not required but it eliminates confusion
*
* Define X as all exogenous variables in system
COPY [EXOG] X_ / TROW=1,$N
* Define X1 as right-hand-side exogenous variables
COPY [RHSEXOG] X1_ / TROW=1,$N
* Define Y1 as all right-hand-side endogenous variables
COPY [RHSENDOG] Y1_ / TROW=1,$N
* Define Y as all endogenous variables in equation
COPY [ENDOG] Y_ / TROW=1,$N
* Define the Left hand side endogenous variable
COPY [LHS] Y2_ / TROW=1,$N
* *************************************************************
* Define Z as all right-hand-side variables, exogenous first
MATRIX Z_= X1_ | Y1_
* Compute the M matrices for X and X1
GEN1 ROWS_=$ROWS
GEN1 COLS_=$COLS
MATRIX M_=IDEN(ROWS_)-X_*INV(X_'X_)*X_'
MATRIX M1_=IDEN(ROWS_)-X1_*INV(X1_'X1_)*X1_'
* Compute W and W1
MATRIX W_=Y_'M_*Y_
MATRIX W1_=Y_'M1_*Y_
* Get the eigenvalues from the W1 and INV(W) matrix computations
MATRIX LAMBDA_=EIGVAL(W1_*INV(W_))
PRINT LAMBDA_
* Get the minimum eigenvalue and use it for k
STAT LAMBDA_ / MIN=K_
PRINT K_
* Note that k-class estimation can be done by choosing
* a different value of k
MATRIX ALPHA_=INV(Z_'(IDEN(ROWS_)-K_*M_)*Z_) * Z_'(IDEN(ROWS_)-K_*M_)*Y2_
* Now print the LIML coefficients
* The order is: CONSTANT PLAG P WGWP
ATITLE_: The estimated coefficient vector is:
PRINT ATITLE_ / NONAME
PRINT ALPHA_ / NONAME
* Get the residuals and variance
MATRIX E_=Y2_-Z_*ALPHA_
* Print SIGMA**2 using 17 Degrees of freedom
MATRIX SIG2_=E_'E_/(ROWS_-COLS_)
ATITLE_: The estimated value of SIGMA-SQUARED is:
PRINT ATITLE_ / NONAME
PRINT SIG2_ / NONAME
* Get the Covariance matrix
MATRIX V_=SIG2_*INV(Z_'(IDEN(ROWS_)-K_*M_)*Z_)
ATITLE_: COVARIANCE MATRIX OF COEFFICIENTS
PRINT ATITLE_ / NONAME
PRINT V_ / NONAME
* Get the standard errors
MATRIX SE_=SQRT(DIAG(V_))
PRINT SE_
* Now delete all the PROC variables
DELETE / ALL_
SET DOECHO
PROCEND
* THE PROC is over, turn echo back on again
SET ECHO