gam_model_probs {stgam}R Documentation

Calculates the ⁠model probabilities of the different GAM models generated by ⁠evaluate_models'

Description

Calculates the ⁠model probabilities of the different GAM models generated by ⁠evaluate_models'

Usage

gam_model_probs(res_tab, n = 10)

Arguments

res_tab

a table generated by evaluate_models

n

the number of models to retain and generate probabilities for

Value

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.

Examples

library(dplyr)
library(purrr)
library(glue)
library(mgcv)
data(productivity)
input_data = productivity |> filter(year == "1970")
svc_res_gam = evaluate_models(input_data, STVC = FALSE)
mod_comp_svc <- gam_model_probs(svc_res_gam, n = 10)
# print out the terms and probabilities
mod_comp_svc|> select(-f)

[Package stgam version 0.0.1.1 Index]