calc_pred is a helper function for model_trend, model_gam, model_gamm and plot_model. It calculates for a list of Generalized Additive (Mixed) Models the predicted IND values as well as the upper and lower 95% confidence intervals based on a list of corresponding pressure values (observed or a regular spaced sequence).

calc_pred(model_list, obs_press)

Arguments

model_list A list of model objects of class gam or gamm. A list of vectors with pressure values (observed or an artificial sequence).

Value

The function returns a tibble with one row for each model and three columns:

pred

A list-column with the predicted IND values given the input pressure values.

ci_up

A list-column with the upper 95% confidence limit of the IND predictions.

ci_low

A list-column with the lower 95% confidence limit of the IND predictions.

model_trend, model_gam, model_gamm, plot_model
# Using the Baltic Sea demo data
model_list <- model_gam_ex$model obs_press <- ind_init_ex$press_train
x <- calc_pred(model_list, obs_press)