fbms {FBMS} | R Documentation |
Fit a BGNLM model using Genetically Modified Mode Jumping Markov Chain Monte Carlo (MCMC) sampling. Or Fit a BGLM model using Modified Mode Jumping Markov Chain Monte Carlo (MCMC) sampling.
Description
This function fits a model using the relevant MCMC sampling. The user can specify the formula, family, data, transforms, and other parameters to customize the model.
Usage
fbms(
formula = NULL,
family = "gaussian",
data = NULL,
transforms = NULL,
loglik.pi = gaussian.loglik,
loglik.alpha = gaussian.loglik.alpha,
P = 10,
runs = 10,
cores = 1,
verbose = FALSE,
...
)
Arguments
formula |
A formula object specifying the model structure. Default is NULL. |
family |
The distribution family of the response variable. Currently supports "gaussian" and "binomial". Default is "gaussian". |
data |
A data frame containing the variables in the model. If NULL, the variables are taken from the environment of the formula. Default is NULL. |
transforms |
A list of transformations for BGNLM model. Default is NULL. |
loglik.pi |
The log-likelihood function for estimating the marginal likelihood and posterior modes (only used if family = "custom") |
loglik.alpha |
The log-likelihood function for the alpha parameter in the model. Default is gaussian.loglik.alpha. |
P |
The number of GMJMCMC generations. Default is 10. |
runs |
The number of parallel chains in case of parallel processing. Default is 2. |
cores |
The number of CPU cores to use for parallel processing. Default is 2. |
verbose |
If TRUE, print detailed progress information during the fitting process. Default is FALSE. |
... |
Additional parameters to be passed to the underlying MCMC fitting functions. |
Value
An object containing the results of the fitted model and MCMC sampling.
See Also
mjmcmc
, gmjmcmc
, gmjmcmc.parallel
Examples
# Fit a Gaussian multivariate time series model
fbms_result <- fbms(
X1 ~ .,
family = "gaussian",
data = data.frame(matrix(rnorm(600), 100)),
P = 10,
runs = 1,
cores = 1
)
summary(fbms_result)
plot(fbms_result)