get.mpm.model {FBMS} | R Documentation |
Retrieve the Median Probability Model (MPM)
Description
This function extracts the Median Probability Model (MPM) from a fitted model object. The MPM includes features with marginal posterior inclusion probabilities greater than 0.5. It constructs the corresponding model matrix and computes the model fit using the specified likelihood.
Usage
get.mpm.model(
result,
y,
x,
labels = F,
family = "gaussian",
loglik.pi = gaussian.loglik,
params = NULL
)
Arguments
result |
A fitted model object (e.g., from |
y |
A numeric vector of response values. For |
x |
A |
labels |
If specified, custom labels of covariates can be used. Default is |
family |
Character string specifying the model family. Supported options are:
If an unsupported family is provided, a warning is issued and the Gaussian likelihood is used by default. |
loglik.pi |
A function that computes the log-likelihood. Defaults to |
params |
Parameters of |
Value
A bgnlm_model
object containing:
prob
The log marginal likelihood of the MPM.
model
A logical vector indicating included features.
crit
Criterion label set to
"MPM"
.coefs
A named numeric vector of model coefficients, including the intercept.
Examples
## Not run:
# Simulate data
set.seed(42)
x <- data.frame(
PlanetaryMassJpt = rnorm(100),
RadiusJpt = rnorm(100),
PeriodDays = rnorm(100)
)
y <- 1 + 0.5 * x$PlanetaryMassJpt - 0.3 * x$RadiusJpt + rnorm(100)
# Assume 'result' is a fitted object from gmjmcmc or mjmcmc
result <- mjmcmc(cbind(y,x))
# Get the MPM
mpm_model <- get.mpm.model(result, y, x, family = "gaussian")
# Access coefficients
mpm_model$coefs
## End(Not run)