GAM also provides diagnostic information about the fitting procedure and results of the generalized additive model. In this recipe, we demonstrate how to plot diagnostic plots through the gam.check
function.
Ensure that the previous recipe is completed with the gam
fitted model assigned to the fit
variable.
Perform the following step to diagnose the generalized additive model:
- Generate the diagnostic plot using
gam.check
on the fitted model:
> gam.check(fit) Output: Method: GCV Optimizer: magic Smoothing parameter selection converged after 7 iterations. The RMS GCV score gradient at convergence was 8.79622e-06 . The Hessian was positive definite. The estimated model rank was 10 (maximum possible: 10) Model rank = 10 / 10 Basis dimension (k) checking results. Low p-value (k-index<1) may indicate that k is too low, especially if edf is close...