* =========== Semi-Parametric Regression =========== * Reference: P.M. Robinson, Root-N-Consistent Semiparametric Regression, * Econometrica, Vol. 56, 1988, pp. 931-954. * * The commands below generate some data and run a semi-parametric * regression. * A simulation experiment is also considered. * The number of replications are set in the variable NREP. * SET RANFIX * Generate the data (Robinson, 1988, Section 6) READ SIGMA / ROWS=2 COLS=2 LIST 4 2 2 3 MATRIX P=CHOL(SIGMA) GEN1 NOBS=200 SAMPLE 1 NOBS MATRIX E=NOR(NOBS,2) MATRIX MRAN=E*P' * X and Z are from a bivariate normal population MATRIX X=MRAN(0,1) MATRIX Z=MRAN(0,2) * Generate the true model - Model (6.1), Robinson, p. 934. GENR U=NOR(1) GENR Y = 1 + X + Z*Z + U * Get OLS estimates based on the true model GENR Z2=Z*Z OLS Y X Z2 / COEF=BETA DN STDERR=STD GEN1 B1=BETA:1 GEN1 SE1=STD:1 * Repeat the OLS estimation using the method from Robinson, p. 935. ?OLS Y Z2 / PREDICT=YHAT ?OLS X Z2 / PREDICT=XHAT GENR YNEW=Y-YHAT GENR XNEW=X-XHAT OLS YNEW XNEW / COEF=BETA DN STDERR=STD GEN1 B1A=BETA:1 GEN1 SE1A=STD:1 * Check that the two OLS estimations give the same results. PRINT B1 B1A SE1 SE1A * ----------------------------------------------------------------- * Semiparametric regression * Set the smoothing parameter from Robinson, p. 943. * Note: A trimming constant b is not introduced. * Use a Gaussian kernel - Kernel 1 in Robinson GEN1 a=0.75 NONPAR Y Z / PREDICT=YHAT SMOOTH=a NONPAR X Z / PREDICT=XHAT SMOOTH=a GENR YNEW=Y-YHAT GENR XNEW=X-XHAT OLS YNEW XNEW * ----------------------------------------------------------------- * Now try a simulation experiment SET CPUTIME DISPLAY CPUTIME * Robinson uses 10,000 replications. But fewer replications takes less time. GEN1 NREP=1000 SET NODOECHO NOOUTPUT GEN1 BHAT=0 DO #=1,NREP * Generate the true model - Model (6.1), Robinson, p. 934. GENR U=NOR(1) GENR Y = 1 + X + Z*Z + U * Semiparametric regression * Use the BRHO option for a boundary modification NONPAR Y Z / PREDICT=YHAT SMOOTH=a BRHO=0.6 NONPAR X Z / PREDICT=XHAT SMOOTH=a BRHO=0.6 GENR YNEW=Y-YHAT GENR XNEW=X-XHAT OLS YNEW XNEW / COEF=BETA GEN1 BHAT=BHAT+BETA:1 ENDO DISPLAY CPUTIME GEN1 BHAT=BHAT/NREP * Calculate the bias. * Note: Robinson reports a bias = 0.0018 GEN1 BIAS=BHAT-1 PRINT BIAS STOP