* * Example 16.9 page 458 * open data tablef5-2[1].txt data(format=prn,org=columns) 1 123 id year cost q pl sl pk sk pf sf * * The original data set isn't ordered on q, so we reorder it, as the data cutoff * is based upon q. It appears as if the data used this time are observations * 6-111, which eliminates the (rather thin) collection of observations with * output greater than 25000. * order(all) q set avgcost = 1000.0*cost/q * npreg(bandwidth=2000,type=logit) avgcost q 6 111 kxfit kyfit scatter(style=dots,overlay=line,ovsame,footer="Figure 16.6 Non-Parametric Regression for AVGCOST",$ hlabel="Output",vlabel="E[AvgCost|O]") 2 # q avgcost 6 111 # kxfit kyfit * * The scatter plot looks somewhat different in the 15000+ range because the RATS * NPREG instruction does (by default) an equally spaced grid, while the output in * figure 16.7 uses an "x" grid which matches the observed x values, which are * rather sparse out in that area. * npreg(bandwidth=200,type=logit) avgcost q 6 111 kxfit kyfit scatter(style=dots,overlay=line,ovsame,footer="Figure 16.7 Non-Parametric Regression for AVGCOST",$ hlabel="Output",vlabel="E[AvgCost|O]") 2 # q avgcost 6 111 # kxfit kyfit