* LIMITED INFORMATION MAXIMUM LIKELIHOOD 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 * ************************************************************* * FIRST DELETE ALL VARIABLES CREATED BY PROC * To keep Proc variables distinct from others append the _ symbol * This is not required but it eliminates confusion ?DELETE X_ X1_ Y1_ Y2_ Y_ Z_ M_ W_ W1_ LAMBDA_ K_ ALPHA_ E_ SIG2_ V_ SE_ * A shortcut is to delete all variables containing _ in the name with: DELETE / ALL_ * ************************************************************* * PUT THE INPUT DATA IN THE RIGHT PLACE * 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_)) LTITLE_: The eigenvalues are: =PRINT LTITLE_ / NONAME =PRINT LAMBDA_ / NONAME * Get the minimum eigenvalue and use it for k ?STAT LAMBDA_ / MIN=K_ KTITLE_: The smallest eigenvalue (k) is =PRINT KTITLE_ K_ / NONAME * 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 ATITLE_: The estimated coefficients for [RHSEXOG] [RHSENDOG] are =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_) * Get the Covariance matrix MATRIX V_=SIG2_*INV(Z_'(IDEN(ROWS_)-K_*M_)*Z_) * Get the standard errors MATRIX SE_=SQRT(DIAG(V_)) SETITLE_: Standard errors: =PRINT SETITLE_ / NONAME =PRINT SE_ /NONAME ** The estimated value of SIGMA-SQUARED IS: STITLE_: The estimated value of the residual variance is: =PRINT STITLE_ SIG2_ / NONAME ** COVARIANCE MATRIX OF COEFFICIENTS VTITLE_: The covariance matrix of the coefficients: =PRINT VTITLE_ / NONAME =PRINT V_ /NONAME * Now delete all the PROC variables DELETE / ALL_ set doecho PROCEND * THE PROC is over, turn echo back on again set echo