fbms | R Documentation |
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.
fbms(
formula = NULL,
family = "gaussian",
beta_prior = list(type = "g-prior"),
model_prior = NULL,
extra_params = NULL,
data = NULL,
impute = FALSE,
loglik.pi = NULL,
method = "mjmcmc",
verbose = TRUE,
...
)
formula |
A formula object specifying the model structure. Default is NULL. |
family |
The distribution family of the response variable. Currently supports "gaussian", "binomial", "poisson", "gamma", and "custom". Default is "gaussian". |
beta_prior |
Type of prior as a string (default: "g-prior" with a = max(n, p^2)). Possible values include:
- "beta.prime": Beta-prime prior (GLM/Gaussian, no additional args)
- "CH": Compound Hypergeometric prior (GLM/Gaussian, requires
|
model_prior |
a list with parameters of model priors, by default r should be provided |
extra_params |
extra parameters to be passed to the loglik.pi function |
data |
A data frame or matrix containing the data to be used for model fitting. If the outcome variable is in the first column of the data frame, the formula argument in fbms can be omitted, provided that all other columns are intended to serve as input covariates. |
impute |
TRUE means imputation combined with adding a dummy column with indicators of imputed values, FALSE (default) means only full data is used. |
loglik.pi |
Custom function to compute the logarithm of the posterior mode based on logarithm of marginal likelihood and logarithm of prior functions (needs specification only used if family = "custom") |
method |
Which fitting algorithm should be used, currently implemented options include "gmjmcmc", "gmjmcmc.parallel", "mjmcmc" and "mjmcmc.parallel" with "mjmcmc" being the default and 'mjmcmc' means that only linear models will be estimated |
verbose |
If TRUE, print detailed progress information during the fitting process. Default is TRUE. |
... |
Additional parameters to be passed to the underlying method. |
An object containing the results of the fitted model and MCMC sampling.
mjmcmc
, gmjmcmc
, gmjmcmc.parallel
# Fit a Gaussian multivariate time series model
fbms_result <- fbms(
X1 ~ .,
family = "gaussian",
method = "gmjmcmc.parallel",
data = data.frame(matrix(rnorm(600), 100)),
transforms = c("sin","cos"),
P = 10,
runs = 1,
cores = 1
)
summary(fbms_result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.