* Least Absolute Deviations Estimation * Reference: William H. Greene, Econometric Analysis, Fourth Edition, * Prentice-Hall, 2000. * Section 9.8.1, pp. 399-402. SAMPLE 1 25 FORMAT (A8,A4,1X,F10.0,F12.0,F11.0,F13.0) READ (industry.shd) STATE1-STATE2 Q KS L NF / SKIPLINE=1 FORMAT GENR LQ=LOG(Q) GENR LK=LOG(KS) GENR LL=LOG(L) * Least Squares OLS LQ LK LL / COEF=BOLS TRATIO=TOLS * Least Absolute Deviations Estimation ROBUST LQ LK LL / COEF=BETA TRATIO=TVAL * Use the bootstrap method to estimate the standard errors. * Set the number of replications GEN1 NREP=1000 * Set the number of observations GEN1 N=25 * Set the number of variables GEN1 K=3 DIM VARCOV K K DATR N K * Generate an observation index GENR OBS=TIME(0) * Make an observation data matrix DAT COPY LQ LK LL DAT SET NODOECHO NOOUTPUT SET RANFIX CPUTIME * Start the replications DO #=1,NREP * A random sample drawn with replacement GENR I=SAMP(OBS) DO %=1,N GEN1 A=I:% MATRIX DATR(%,0)=DAT(A,0) ENDO MATRIX Y=DATR(0,1) GEN1 K1=K-1 COPY DATR X / FROW=1;N TROW=1;N FCOL=2;K TCOL=1;K1 ROBUST Y X / COEF=BR DIFF=-1 * Bootstrap estimates of the variance-covariance matrix MATRIX VARCOV=VARCOV+(BR-BETA)*(BR-BETA)' ENDO DIS CPUTIME MATRIX VARCOV=VARCOV/NREP * Calculate t-ratios based on the bootstrap standard errors. MATRIX TBOOT=BETA/SQRT(DIAG(VARCOV)) * Print the results for OLS and LAD estimation. * See the results in Greene, 2000, Table 9.3, page 402. SAMPLE 1 3 FORMAT(2F10.3,5X,3F10.3) PRINT BOLS TOLS BETA TVAL TBOOT / FORMAT STOP