gam_model_probs {stgam} | R Documentation |
model probabilities of the different GAM models generated by
evaluate_models'Calculates the model probabilities of the different GAM models generated by
evaluate_models'
gam_model_probs(res_tab, n = 10)
res_tab |
a table generated by |
n |
the number of models to retain and generate probabilities for |
A ranked data table in tibble
format of the top n
models, their form, BIC and model or (Pr(M|D)
) or relative (Pr(M)
) probability value. Model probability indicates the probability of the each model being the correct model and the relative probabilities provide a measure of the doubt about the differences in model specification, when compared to the best or highest ranked model. The relative probabilities are needed when large BIC values generate near zero probability values.
library(dplyr)
library(purrr)
library(glue)
library(mgcv)
data(productivity)
data = productivity |> filter(year == "1970")
svc_res_gam = evaluate_models(data, STVC = FALSE)
mod_comp_svc <- gam_model_probs(svc_res_gam, n = 10)
# print out the terms
mod_comp_svc|> select(-f)