get.best.model {FBMS} | R Documentation |
Extract the Best Model from MJMCMC or GMJMCMC Results
Description
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.
Usage
get.best.model(result, labels = FALSE)
Arguments
result |
An object of class |
labels |
Logical; if |
Details
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.
Value
A list containing the details of the best model:
prob
A numeric value representing the model's probability.
model
A logical vector indicating which features are included in the best model.
crit
The criterion value used for model selection (e.g., marginal likelihood or posterior probability).
alpha
The intercept parameter of the best model.
coefs
A named numeric vector of model coefficients, including the intercept and selected features.
Examples
result <- gmjmcmc(matrix(rnorm(600), 100), P = 2, gaussian.loglik, NULL, c("p0", "exp_dbl"))
get.best.model(result)