model_gam applies Generalized Additive Models (GAMs) to each IND~pressure combination created in ind_init and returns a tibble with IND~pressure-specific GAM outputs.

model_gam(init_tbl, k = 5, family = stats::gaussian(), excl_outlier = NULL)

## Details

To evaluate the IND`s sensitivity and robustness time series of the IND are modeled as a smoothing function of one single pressure variable (using a subset of the data as training dataset, e.g. excluding the years of the annual time series). The GAMs are build using the default settings in the gam function and the smooth term function s). However, the user can adjust the distribution and link by modifying the family argument as well as the maximum level of non-linearity by setting the number of knots:

gam(ind ~ s(press, k = k), family = family, data = training_data)

In the presence of significant temporal auto-correlation, GAMs should be extended to Generalized Additive Mixed Models (GAMMs) by including auto-regressive error structures to correct for the auto-correlation (Pinheiro and Bates, 2000). This is implemented in the function model_gamm.

The returned tibble contains various model outputs needed for scoring the sensitivity and robustness subcriteria:

• p_val to identify whether an IND responds to a specific pressure

• r_sq for the strength of the IND response

• edf for the non-linearity of the IND response

• nrmse for the robustness of the established IND~pressure relationship

The robustness of the modeled pressure relationship based on the training data is evaluated by measuring how well the model prediction matches the test dataset, e.g. the last years. This is quantified by computing the absolute value of the normalized root mean square error (NRMSE) on the test dataset. The normalization to the mean of the observed test data allows for comparisons and a general scoring of the model robustness across INDs with different scales or units.

## References

Pinheiro, J.C., Bates, D.M. (2000) Mixed-Effects Models in S and S-Plus. Springer, New York, 548pp.

# Using the Baltic Sea demo data in this package dat_init <- ind_init( ind_tbl = ind_ex[, c("Sprat", "Cod")], press_tbl = press_ex[, c("Tsum", "Swin", "Fcod", "Fher")], time = ind_ex[ ,1]) gam_tbl <- model_gam(dat_init) # Any outlier? gam_tbl$pres_outlier #> [[1]] #> NULL #> #> [[2]] #> NULL #> #> [[3]] #> NULL #> #> [[4]] #> NULL #> #> [[5]] #> NULL #> #> [[6]] #> NULL #> #> [[7]] #> 1991 #> 13 #> #> [[8]] #> 2000 #> 22 #> # Exclude outliers by passing this list as input: gam_tbl_out <- model_gam(dat_init, excl_outlier = gam_tbl$pres_outlier) # \donttest{ # Using another error distribution ind_sub <- round(exp(ind_ex[ ,c(2,8,9)]),0) # to unlog data and convert to integers ind_tbl2 <- ind_init(ind_sub, press_ex, time = ind_ex\$Year) model_gam(ind_tbl2, family = poisson(link="log"))