The ORTHOREG Procedure |

The extra accuracy of the regression algorithm used by PROC ORTHOREG is most useful when the model contains near-singularities that you want to be able to distinguish from true singularities. This example demonstrates this usefulness in the context of fitting polynomials of high degree.

**Note**:The results from this example vary from machine to machine, depending on floating-point configuration.

The following DATA step computes a response y as an exact ninth-degree polynomial function of a predictor x evaluated at 0, 0.01, 0.02, ..., 1.

title 'Polynomial Data'; data Polynomial; do i = 1 to 101; x = (i-1)/(101-1); y = 10**(9/2); do j = 0 to 8; y = y * (x - j/8); end; output; end; run;

The polynomial is constructed in such a way that its zeros lie at for . The following statements use the EFFECT statement to fit a ninth-degree polynomial to this data with PROC ORTHOREG. The EFFECT statement makes it easy to specify complicated polynomial models.

ods graphics on; proc orthoreg data=Polynomial; effect xMod = polynomial(x / degree=9); model y = xMod; effectplot fit / obs; store OStore; run; ods graphics off;

The effect xMod defined by the EFFECT statement refers to all nine degrees of freedom in the ninth-degree polynomial (excluding the intercept term). The resulting output is shown in Output 63.3.1. Note that the R square for the fit is 1, indicating that the ninth-degree polynomial has been correctly fit.

Polynomial Data |

The ORTHOREG Procedure

Dependent Variable: y

Source | DF | Sum of Squares | Mean Square | F Value | Pr > F |
---|---|---|---|---|---|

Model | 9 | 15.527180055 | 1.7252422284 | 1.65E22 | <.0001 |

Error | 91 | 9.496616E-21 | 1.043584E-22 | ||

Corrected Total | 100 | 15.527180055 |

Parameter | DF | Parameter Estimate | Standard Error | t Value | Pr > |t| |
---|---|---|---|---|---|

Intercept | 1 | -3.24572035915E-11 | 8.114115E-12 | -4.00 | 0.0001 |

x | 1 | 75.9977312440678 | 4.898326E-10 | 1.55E11 | <.0001 |

x_2 | 1 | -1652.40781362191 | 9.5027919E-9 | -174E9 | <.0001 |

x_3 | 1 | 14249.4539769783 | 8.3110512E-8 | 1.71E11 | <.0001 |

x_4 | 1 | -64932.461575205 | 3.8997072E-7 | -167E9 | <.0001 |

x_5 | 1 | 173315.359360779 | 1.066611E-6 | 1.62E11 | <.0001 |

x_6 | 1 | -280158.03646002 | 1.7523078E-6 | -16E10 | <.0001 |

x_7 | 1 | 269781.812887653 | 1.7021134E-6 | 1.58E11 | <.0001 |

x_8 | 1 | -142302.494710055 | 9.0027891E-7 | -158E9 | <.0001 |

x_9 | 1 | 31622.7766022468 | 1.997493E-7 | 1.58E11 | <.0001 |

The fit plot produced by the EFFECTPLOT statement, Output 63.3.2, also demonstrates the perfect fit.

Finally, you can use the PLM procedure with the fit model saved by the STORE statement in the item store OStore to check the predicted values for the known zeros of the polynomial, as shown in the following statements:

data Zeros(keep=x); do j = 0 to 8; x = j/8; output; end; run; proc plm restore=OStore noprint; score data=Zeros out=OZeros pred=OPred; run; proc print noobs; run;

The predicted values of the zeros, shown in Output 63.3.3, are again all miniscule.

To compare these results with those from a least squares fit produced by an alternative algorithm, consider fitting a polynomial to this data using the GLM procedure. PROC GLM does not have an EFFECT statement, but the familiar bar notation can still be used to specify a ninth-degree polynomial fairly succinctly, as shown in the following statements:

proc glm data=Polynomial; model y = x|x|x|x|x|x|x|x|x; store GStore; run;

Partial results are shown in Output 63.3.4. In this case, the R square for the fit is only about 0.83, indicating that the full ninth-degree polynomial was not correctly fit.

The following statements, which use the PLM procedure to compute predictions based on the GLM fit at the true zeros of the polynomial, also confirm that PROC GLM is not able to correctly fit a polynomial of this degree, as shown in Output 63.3.5.

proc plm restore=GStore noprint; score data=Zeros out=GZeros pred=GPred; run; data Zeros; merge OZeros GZeros; run; proc print noobs; run;

Copyright © SAS Institute, Inc. All Rights Reserved.