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, ...)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.
An object of class mjmcmc, mjmcmc_parallel, gmjmcmc, or gmjmcmc_merged,
containing the results from the corresponding model search algorithms.
Logical; if TRUE, uses labeled feature names when naming the model coefficients.
Alternatively, a character vector of feature names. Default is FALSE.
Additional arguments passed to methods.
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:
mjmcmcSelects the top model from a single MJMCMC run.
mjmcmc_parallelIdentifies the best chain, then selects the best model from that chain.
gmjmcmcSelects the best population and model within that population.
gmjmcmc_mergedFinds the best chain and population before extracting the top model.
data(exoplanet)
result <- fbms(semimajoraxis ~ ., data = exoplanet, method = "mjmcmc")
get.best.model(result)
Run the code above in your browser using DataLab