| get.best.model | R Documentation |
This function retrieves the best model from the results of MJMCMC, MJMCMC parallel, GMJMCMC, or GMJMCMC merged runs
based on the maximum criterion value (crit). The returned list includes the model probability, selected features,
criterion value, intercept parameter, and named coefficients.
get.best.model(result, labels = FALSE)
result |
An object of class |
labels |
Logical; if |
The function identifies the best model by selecting the one with the highest crit value. Selection logic depends on the class of the result object:
"mjmcmc"Selects the top model from a single MJMCMC run.
"mjmcmc_parallel"Identifies the best chain, then selects the best model from that chain.
"gmjmcmc"Selects the best population and model within that population.
"gmjmcmc_merged"Finds the best chain and population before extracting the top model.
A list containing the details of the best model:
probA numeric value representing the model's probability.
modelA logical vector indicating which features are included in the best model.
critThe criterion value used for model selection (e.g., marginal likelihood or posterior probability).
alphaThe intercept parameter of the best model.
coefsA named numeric vector of model coefficients, including the intercept and selected features.
result <- gmjmcmc(x = matrix(rnorm(600), 100),
y = matrix(rnorm(100), 100),
P = 2, transforms = c("p0", "exp_dbl"))
get.best.model(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.