Locally weighted polynomial regressionFinally, we’ll try the kernel method on the birthrate data. We’ll use loess in the packagemodreg.YoucanuseCpas in the other methods, which depends onσ2e. For natural splinesand smoothing splines, we tried four estimates, so I’ll just stick with those. The best df ’sfor the variousσ2e’s:σ2eNatural spline Smoothing spline Loess11.54 47 43 3617.7629 39 36147.177109181.48799So df = 9 looks like a good try for a smooth fit, and df = 36 f or a rough fit. The firstone:lo <- loess(birthrate[,1]~birthrate[,2],enp.target=9)plot(birthrate[,2],birthrate[,1],xlab="Year",ylab="Birthrate",main="df = 9")lines(birthrate[,2],birthrate[,1]-lo$res)The enp.target is the number of equivalent parameters, which should be the df .Forsome reason, this number is not exactly the trace of the smoother matrix, but it’s closeenough.1920 1940 1960150 200 250df = 9YearBirthrate1Cf, the smoothing spline at df = 10:1920 1930 1940 1950 1960 1970150 200 250df=10YearBirthrateNice! The rougher:21920 1940 1960150 200 250df = 36YearBirthrateCf, the smoothing spline at df = 43:31920 1930 1940 1950 1960 1970150 200 250Smoothing spline, df=43xyTo compare the residual sums of squares for various procedures, all with df = 10:Polynomial: 4363.026Natural spline: 3937.721Smoothing spline: 3863.780Loess:
View Full Document