STAT 350: Lecture 5 Example
We consider data on average claims paid per policy for automobile insurance in New Brunswick in the years 1971-1980:
Here is a plot of the data:
One goal of analysis is to extrapolate the Costs for 2.25 years beyond the end of the data; this should help the insurance company set premiums.
In this example we fit polynomials of degrees from 1 to 5, plot the fits, compute error sums of squares and examine the 5 resulting extrapolations to the year 1982.25.
In the following you will see the SAS analyses of the data, though I have edited the analyses severely.
Using SAS the following code will fit the model for a degree five polynomial.
options pagesize=60 linesize=80; data insure; infile 'insure.dat'; input year cost; code = year - 1975.5 ; c2=code**2 ; c3=code**3 ; c4=code**4 ; c5=code**5 ; proc glm data=insure; model cost = code c2 c3 c4 c5 ; run ;
NOTE: the computation of code is important. The software has great difficulty with the calculation without the subtraction. It should seem reasonable that there is no harm in counting years with 1975.5 taken to be the 0 point of the variable time.
Here is some edited output:
Dependent Variable: COST Sum of Mean Source DF Squares Square F Value Pr > F Model 5 3935.2507732 787.0501546 2147.50 0.0001 Error 4 1.4659868 0.3664967 Corrected Total 9 3936.7167600 Source DF Type I SS Mean Square F Value Pr > F CODE 1 3328.3209709 3328.3209709 9081.45 0.0001 C2 1 298.6522917 298.6522917 814.88 0.0001 C3 1 278.9323940 278.9323940 761.08 0.0001 C4 1 0.0006756 0.0006756 0.00 0.9678 C5 1 29.3444412 29.3444412 80.07 0.0009
From these sums of squares I can compute error sums of squares for each of the five models.
|Degree||Error Sum of Squares|
The actual estimates of the coefficients must be obtained by running SAS proc glm 5 times, once for each model. The fitted models are
You should observe that sometimes, but not always, adding a term to the model changes coefficients of terms already in the model. These lead to the follwing predictions for 1982.25:
Here is a plot of the five resulting fitted polynomials, superimposed on the data and extended to 1983. I have added a vertical line at 1982.25 so that you can see that the different fits give wildly different extrapolated values. You will not be able to see a difference between the degree 3 and degree 4 fits. Overall the degree 3 fit is probably best but does have a lot of parameters for the number of data points. The degree 5 fit is a statistically significant improvement over the degree 3 and 4 fits. but it is hard to believe in the polynomial model outside the range of the data! Extrapolation is very dangerous and unreliable.