IMSTAT Procedure (Analytics)

Example 11: Fitting a Regression Model

Details

This IMSTAT procedure example demonstrates using higher-order polynomial models and also model selection.
Both REGCORR statements in the example request fitting a regression model of the response variable, Sales, and the regressor variable, Inventory. If no variables are specified, then the procedure fits a model for each pair of numeric non-CLASS variables in the table.

Program

libname example sasiola host="grid001.example.com" port=10010 tag='hps';

data example.shoes; set sashelp.shoes; run;

proc imstat data=example.shoes;
    regcorr sales inventory / order=2; 1
run;

    regcorr sales inventory / order=-3; 2
run;
quit;

Program Description

  1. This REGCORR statement uses the ORDER=2 option to specify a quadratic model. ORDER=1 requests a linear model and ORDER=3 requests a cubic model.
  2. Specifying -3 for the ORDER= option indicates that the procedure perform model selection from linear, quadratic, and cubic models. The procedure finds the best-fitting polynomial that is most appropriate, according to statistical principles.

Output

The following display shows the results for the two REGCORR statements. The first display shows the results for the quadratic model that was requested with ORDER=2. The second display shows the results for letting the procedure determine the best fit of the model. In this case, because the Quadr column has a nonzero value, that indicates the procedure determined that the quadratic model fits the data best. If the Cubic column been nonzero, that would indicate that the procedure selected the cubic model as the most appropriate.
Results for fitting regression models