* * CHAPTER 7 * Page 239 * open data ch04-08_schools.xls data(format=xls,org=columns) 1 420 dist_cod enrl_tot teachers calw_pct meal_pct $ computer testscr comp_stu expn_stu str avginc el_pct read_scr math_scr * * Regression with the student-teacher ratio and pct of English learners * linreg(robust) testscr # constant str el_pct * disp "95% Confidence Interval on ST Ratio Coefficient" %beta(2)-1.96*%stderrs(2) %beta(2)+1.96*%stderrs(2) * * Add in the expenditures per student * linreg(robust) testscr # constant str expn_stu el_pct * * Test the joint significance of the ST ratio and expenditures per student. Note * that (after using the ROBUSTERRORS on the LINREG), this will produce a * chi-squared statistic. The relationship between this and the large-sample F is * described on the top of page 229. Joint tests of exclusion restrictions are * done using the instruction EXCLUDE. You list the regressors to be testing on * the supplementary line. * exclude(title="Joint Significance of ST ratio and expenditures") # str expn_stu * * This creates the scatter plot matrix in figure 7.2. The graph "matrix" is * created using the SPGRAPH...SPGRAPH(DONE) construction. On the spgraph, * VFIELDS=2 and HFIELDS=2 indicate two vertical fields and two horizontal fields. * The SCATTER instructions fill the fields down the columns, so we do the income * assistance variable second. The extra options shown here are HMAX and HMIN * which force the three graphs to run over the full range from 0 to 100. If you * don't do this, the individual scatter plots might come up with different * ranges, which might give a misleading impression. Suppose, for instance, that * one of the percent series only runs over 40-60%, while the others are 0-100%. * The same slope will look five times steeper in the first case than in the * second if each is graphed in the same size box using the tightest possible * range of x values. * spgraph(vfields=2,hfields=2,footer="Figure 7.2 Scatterplots of Test Scores vs Three Characteristics") scatter(hmin=0.0,hmax=100.0,hlabel="Percent of English Language learners") # el_pct testscr scatter(hmin=0.0,hmax=100.0,hlabel="Percent qualifying for income assistance") # calw_pct testscr scatter(hmin=0.0,hmax=100.0,hlabel="Percent qualifying for reduced price lunch") # meal_pct testscr spgraph(done) * * Regressions used in table 7.2 * linreg(robust) testscr # constant str linreg(robust) testscr # constant str el_pct linreg(robust) testscr # constant str el_pct meal_pct linreg(robust) testscr # constant str el_pct calw_pct linreg(robust) testscr # constant str el_pct meal_pct calw_pct * report(action=define) report(atrow=1,atcol=1,fillby=cols) "SER" "R-Squared" "n" linreg(robust) testscr # constant str report(regression) report(atrow=1,col=current,fillby=cols) sqrt(%seesq) %rsquared %nobs linreg(robust) testscr # constant str el_pct report(regression) report(atrow=1,col=current,fillby=cols) sqrt(%seesq) %rsquared %nobs linreg(robust) testscr # constant str el_pct meal_pct report(regression) report(atrow=1,col=current,fillby=cols) sqrt(%seesq) %rsquared %nobs linreg(robust) testscr # constant str el_pct calw_pct report(regression) report(atrow=1,col=current,fillby=cols) sqrt(%seesq) %rsquared %nobs linreg(robust) testscr # constant str el_pct meal_pct calw_pct report(regression) report(atrow=1,col=current,fillby=cols) sqrt(%seesq) %rsquared %nobs report(action=format,atrow=1,torow=1,picture="*.##") report(action=format,atrow=2,torow=2,picture="*.###") report(action=format,atrow=4,torow=5,picture="*.#") report(action=format,atrow=6,torow=7,picture="*.##") report(action=format,atrow=8,torow=13,picture="*.###") report(action=show)