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?
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)