2

Both plot(gam.object)(regardless of whether in mgcv or gam) and car::crplots(model) plot the partial residuals of a predictor and the corresponding non-parametric smoother.

True or False?

If False, what then is the difference between both outputs?

The only difference/benefit I can see in plotting the gam.object is that a wider range of smoothers with more specifications (e.g. df, smoothing parameter) can be used.

Would be grateful for any insights.

gammer
  • 23
  • 5

1 Answers1

1

Both output the same partial residuals. The standard models that mgcv::gam() fits are basically GLMs but fitted with a penalized likelihood approach rather than a pure maximum likelihood approach, both via a IRLS algorithm.

The car::crPlots() approach only works because mgcv::gam() returns an object that inherits from class "glm" and car::crPlots() has a method for "glm" objects. Although I haven't tried it, I would expect car::crPlots() to fail when presented with by variable splines, 2d splines, and models where there are more than one linear predictor (families ziplss(), gaulss() and gevlss() for example, that are specific to mgcv::gam().

Hence the benefit is not just restricted to the types of smoother that one can employ in fitting the model: the functionality in plot.gam is superior to that of crPlots because it was specifically designed to work with all the kinds of models that can be fitted using mgcv.

Gavin Simpson
  • 37,567
  • 5
  • 110
  • 153