Similar to the following question,

How to extract/compute leverage and Cook's distances for linear mixed effects models

Is there any method in R to determine influential points in a GAM?


If your model is quick to fit, you can calculate a leave-one-out measure of sample influence manually like this:

mref <- gam(y ~ s(x), data = DAT)
fref <- fitted(mref)

f <- function(index) {
  dat <- DAT[-index, ]
  m <- gam(y ~ s(x), data = dat)

  # sum of squared differences between this fit and reference model
  # based on full dataset
  sum( (fref[-index] - fitted(m))^2 )

influence <- sapply(1:nrow(DAT), f)
  • $\begingroup$ Thanks but how do you determine how big the sum of squared differences has to be to for a point to be influential?. $\endgroup$ – user53020 Jan 23 '17 at 16:06
  • $\begingroup$ @user53020 Rather than taking any particular threshold, I would take the values as a relative measure of influence and look for any that stand out from the rest, as per this answer $\endgroup$ – michael Jan 24 '17 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.