* Interval Estimation -- A Simulation Experiment * Reference: Section 5.1.3, pp.96-97 of * R. Carter Hill, William E. Griffiths and George G. Judge, * Undergraduate Econometrics, Second Edition, Wiley. * 10 samples of data are generated by assuming that the true model * coefficients are Beta1=45.0 and Beta2=0.14. * The file NRAN.shd contains 40,000 random numbers generated from * a N(0,1) distribution. Therefore, the number of replications * of the experiment NREP can be set to 1000. SAMPLE 1 40 READ (TAB3-1.shd) FOOD INCOME / SKIPLINES=1 * Set the "true" model coefficients GEN1 BETA1=45.0 GEN1 BETA2=0.14 GEN1 SIGSQ=1400 * Set the number of random samples GEN1 NREP=10 SET NODOECHO NOOUTPUT DIM B2 NREP SE2 NREP VAR NREP * Use a DO-loop to do repeat operations DO #=1,NREP * Read some random numbers from a N(0,1) distribution READ (NRAN.shd) E / BYVAR NOREWIND * Change the variance GENR E=E*SQRT(SIGSQ) * Generate Y GENR Y = BETA1 + BETA2 * INCOME + E * Run an OLS regression and save the estimated coefficients. OLS Y INCOME / COEF=BTEMP STDERR=SETEMP GEN1 VAR:#=$SIG2 GEN1 B2:#=BTEMP:1 GEN1 SE2:#=SETEMP:1 ENDO SET OUTPUT * Print the results SAMPLE 1 NREP GENR N=TIME(0) * Table 5.1, p.97 FORMAT(1X,F12.0,F12.4,F12.4,F14.4) PRINT N B2 SE2 VAR / FORMAT STAT B2 * Interval estimation * Get a critical value from the t-distribution SAMPLE 1 1 GEN1 ALPHA=0.025 DISTRIB ALPHA / TYPE=T DF=38 INVERSE CRITICAL=TC * Construct the interval estimates SAMPLE 1 NREP GENR B2LOW=B2-TC*SE2 GENR B2UP=B2+TC*SE2 * Table 5.2, p.97 PRINT N B2LOW B2UP / FORMAT STOP