modal_regression {GUD} | R Documentation |
Bayesian Modal Regression
Description
Bayesian Modal Regression
Usage
modal_regression(formula, data, model, ...)
Arguments
formula |
a formula. |
data |
a dataframe. |
model |
a description of the error distribution. Can be one of "FG", "DTP" and "TPSC". |
... |
Arguments passed to |
Details
The Bayesian modal regression model based on the FG, DTP or TPSC distribution is defined as:
Y_{i} = \mathbf{X}_{i} \boldsymbol{\beta} + e_{i},
where e_{i}
follows the FG, DTP or TPSC distribution.
More details of the Bayesian modal regression model can be found at at Liu, Huang, and Bai (2024) https://arxiv.org/pdf/2211.10776.
Value
A draw
object from the posterior package.
References
Liu Q, Huang X, Bai R (2024). “Bayesian Modal Regression Based on Mixture Distributions.” Computational Statistics & Data Analysis, 108012. doi:10.1016/j.csda.2024.108012.
Examples
# Save current user's options.
old <- options()
# (Optional - Running Multiple Chains in Parallel)
options(mc.cores = 2)
if (require(MASS)) { # Need Boston housing data from MASS package.
# Fit the modal regression based on the FG distribution to the Boston housing data.
FG_model <- modal_regression(formula = medv ~ .,
data = Boston,
model = "FG",
chains = 2,
iter = 2000)
print(summary(FG_model), n = 17)
# Fit the modal regression based on the TPSC-Student-t distribution to the Boston housing data.
TPSC_model <- modal_regression(formula = medv ~ .,
data = Boston,
model = "TPSC",
chains = 2,
iter = 2000)
print(summary(TPSC_model), n = 17)
# Fit the modal regression based on the DTP-Student-t distribution to the Boston housing data.
DTP_model <- modal_regression(formula = medv ~ .,
data = Boston,
model = "DTP",
chains = 2,
iter = 2000)
print(summary(DTP_model), n = 17)
}
# reset (all) initial options
options(old)
[Package GUD version 1.0.2 Index]