cooks_dist_gamm is a helper function for model_gamm and plot_diagnostics and calculates the Cooks distance for objects of class gamm. The Cooks distance D is a leave-one-out deletion diagnostics to measure the influence of each observation. The generic cooks.distance function does not work on the class gamm.

cooks_dist_gamm(gamm_model)

## Arguments

gamm_model The ‘gam‘ sublist from a model object of class gamm.

## Value

The function returns a numerical vector of the same length then the data used for the GAMM fitting, with one D value for each IND observation.

plot_diagnostics, model_gamm
# Using a model of the Baltic Sea demo data
cooks_dist_gamm(gamm_model = model_gamm_ex$model[[49]]$gam)
#> [26] 0.0074871620 0.0036439743