R/cooks_dist_gamm.R
cooks_dist_gamm.Rd
cooks_dist_gamm
is a helper function for model_gamm
and
plot_diagnostics
and calculates the Cook`s distance for objects
of class `gamm`. The Cook`s 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)
gamm_model | The ‘gam‘ sublist from a model object of class |
---|
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.
# Using a model of the Baltic Sea demo data cooks_dist_gamm(gamm_model = model_gamm_ex$model[[49]]$gam)#> [1] 0.0460675187 0.1080646017 0.0503192828 0.1067891853 0.0575550841 #> [6] 0.0255400410 0.0234023740 0.0048989219 0.0002499257 0.0381821247 #> [11] 0.0099427739 0.2407901638 0.2051295214 0.0810731214 0.0156367638 #> [16] 0.0533046271 0.0083600003 0.0008566615 0.0029952101 0.0024327747 #> [21] 0.0121084485 0.0017002941 0.0011592551 0.0174526702 0.0191117427 #> [26] 0.0074871620 0.0036439743