Final degrees of freedom for smoother are not as requested in PROC GAM


When you specify degrees of freedom (df) in a smoother using the DF= option (for example, SPLINE(X,DF=5)) or accept the default 4 df, PROC GAM attempts to find a setting of the smoothing parameter which results in the requested df. However, it is not always possible to find such a setting, so the final df may be different than requested. Large data sets with a large number of distinct predictor values which are close together make it harder to find the needed smoothing parameter value. This situation can cause instability (near collinearity) in a matrix involved in fitting the spline. In such cases, using a random subset of your data may allow PROC GAM to get closer to the desired df. Alternatively or in addition to this, you can try rounding the predictor variables so that distinct values are farther apart. Both reduce the number of distinct values and increase their separation. For example, this statement used in a DATA step creates a new variable X2 containing values of X rounded to the nearest integer:

   x2 = round(x,1);

You may need to try rounding to progressively coarser levels.