R/calc_pred.R
calc_pred.Rdcalc_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)
| model_list | A list of model objects of class `gam` or `gamm`. |
|---|---|
| obs_press | A list of vectors with pressure values (observed or an artificial sequence). |
The function returns a tibble with one row for each model and three columns:
predA list-column with the predicted IND values given the input pressure values.
ci_upA list-column with the upper 95% confidence limit of the IND predictions.
ci_lowA list-column with the lower 95% confidence limit of the IND predictions.
# 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)