View source: R/flexreg_Augmentation.R
| flexreg | R Documentation |
The function fits some flexible regression models for bounded continuous responses (e.g., proportions and rates) via a Bayesian approach to inference based on Hamiltonian Monte Carlo algorithm.
Available regression models are the flexible beta regression model (type = "FB", default), the variance inflated beta (type = "VIB"), the beta (type = "Beta"), as well as their augmented versions.
flexreg(
formula,
zero.formula = NULL,
one.formula = NULL,
data,
type = "FB",
link.mu = "logit",
prior.beta = "normal",
hyperparam.beta = NULL,
prior.omega0 = "normal",
hyperparam.omega0 = NULL,
prior.omega1 = "normal",
hyperparam.omega1 = NULL,
hyperparam.p = NULL,
hyperparam.w = NULL,
hyperparam.k = NULL,
link.phi = NULL,
prior.phi = NULL,
hyperparam.phi = NULL,
prior.psi = NULL,
hyperparam.psi = NULL,
n.chain = 1,
n.iter = 5000,
warmup.perc = 0.5,
thin = 1,
verbose = TRUE,
...
)
formula |
an object of class " |
zero.formula |
an object of class " |
one.formula |
an object of class " |
data |
an optional |
type |
a character specifying the type of regression model. Current options are |
link.mu |
a character specifying the link function for the mean model (mu). Currently, |
prior.beta |
a character specifying the prior distribution for the regression coefficients of the mean model, |
hyperparam.beta |
a positive numeric (vector of length 1) specifying the hyperprior scale parameter for the prior distribution of |
prior.omega0 |
a character specifying the prior distribution for the regression coefficients of the augmented model in zero, |
hyperparam.omega0 |
a positive numeric (vector of length 1) specifying the hyperprior scale parameter for the prior distribution of |
prior.omega1 |
a character specifying the prior distribution for the regression coefficients of the augmented model in one, |
hyperparam.omega1 |
a positive numeric (vector of length 1) specifying the hyperprior scale parameter for the prior distribution of |
hyperparam.p |
a vector of length 2 with positive elements specifying the hyperparameters for the beta prior distribution of |
hyperparam.w |
a vector of length 2 with positive elements specifying the hyperparameters for the beta prior distribution of |
hyperparam.k |
a vector of length 2 with positive elements specifying the hyperparameters for the beta prior distribution of |
link.phi |
a character specifying the link function for the precision model (phi). Currently, |
prior.phi |
a character specifying the prior distribution for precision parameter |
hyperparam.phi |
a positive numeric (vector of length 1) specifying the hyperprior parameter for the prior distribution of |
prior.psi |
a character specifying the prior distribution for the regression coefficients of the precision model |
hyperparam.psi |
a positive numeric (vector of length 1) specifying the hyperprior scale parameter for the prior distribution of |
n.chain |
a positive integer specifying the number of Markov chains. The default is 1. |
n.iter |
a positive integer specifying the number of iterations for each chain (including warm-up). The default is 5000. |
warmup.perc |
the percentage of iterations per chain to discard. |
thin |
a positive integer specifying the period for saving samples. The default is 1. |
verbose |
a logical (with default |
... |
additional arguments from |
Let Y be a continuous bounded random variable whose distribution can be specified in the type argument and \mu be the mean of Y.
The flexreg function links the parameter \mu to a linear predictor through a function g_1(\cdot) specified in link.mu:
g_1(\mu) = \bold{x}^t \bold{\beta},
where \bold{\beta} is the vector of regression coefficients for the mean model.
The prior distribution and the related hyperparameter of \bold{\beta} can be specified in prior.beta and hyperparam.beta, respectively.
By default, the precision parameter \phi is assumed to be constant.
The prior distribution and the related hyperparameter of \phi can be specified in prior.phi and hyperparam.phi.
It is possible to extend the model by linking \phi to an additional (possibly overlapping) set of covariates through a proper link
function g_2(\cdot) specified in the link.phi argument:
g_2(\phi) = \bold{z}^t \bold{\psi},
where \bold{\psi} is the vector of regression coefficients for the precision model.
The prior distribution and the related hyperparameter of \bold{\psi} can be specified in prior.psi and hyperparam.psi.
In the function flexreg, the regression model for the mean and, where appropriate, for the precision parameter can be specified in the
formula argument with a formula of type y ~ x1 + x2 | z1 + z2 where covariates on the left of "|" are included in the regression model
for the mean, whereas covariates on the right of "|" are included in the regression model for the precision.
If the second part is omitted, i.e., y ~ x1 + x2, the precision is assumed constant for each observation.
In presence of zero values in the response, one has to link the parameter q_0, i.e., the probability of augmentation in zero, to an additional (possibly overlapping) set of covariates through a logit link function:
g_3(q_{0}) = \bold{x}_{0}^t \bold{\omega_0},
where \bold{\omega_0} is the vector of regression coefficients for the augmented model in zero.
The prior distribution and the related hyperparameter of \bold{\omega_0} can be specified in prior.omega0 and hyperparam.omega0.
In presence of one values in the response, one has to link the parameter q_1, i.e., the probability of augmentation in one, to an additional (possibly overlapping) set of covariates through a logit link function:
g_4(q_{1}) = \bold{x}_{1}^t \bold{\omega_1},
where \bold{\omega_1} is the vector of regression coefficients for the augmented model in one.
The prior distribution and the related hyperparameter of \bold{\omega_1} can be specified in prior.omega1 and hyperparam.omega1.
If both the augmented models in zero and one are specified, the link function is a bivariate logit.
In flexreg function, the augmented models in zero and/or one can be specified in the
zero.formula and/or one.formula arguments with a formula of type ~ x.
Left hand side in zero.formula and one.formula can be omitted; if specified, they have to be the same as left hand side in formula.
The flexreg function returns an object of class `flexreg`, i.e. a list with the following elements:
call |
the function call. |
type |
the type of regression model. |
formula |
the overall formula. |
aug |
a character specifing the absence of the augmentation ( |
link.mu |
a character specifing the link function in the mean model. |
link.phi |
a character specifing the link function in the precision model. |
model |
a list of objects of class |
response |
the response variable, assuming values in (0, 1). |
design.X |
the design matrix for the mean model. |
design.Z |
the design matrix for the precision model (if defined). |
design.X0 |
the design matrix for the augmented model in zero (if defined). |
design.X1 |
the design matrix for the augmented model in one (if defined). |
Di Brisco, A. M., Migliorati, S. (2020). A new mixed-effects mixture model for constrained longitudinal data. Statistics in Medicine, 39(2), 129–145. doi:10.1002/sim.8406
Di Brisco, A. M., Migliorati, S., Ongaro, A. (2020). Robustness against outliers: A new variance inflated regression model for proportions. Statistical Modelling, 20(3), 274–309. doi:10.1177/1471082X18821213
Ferrari, S.L.P., Cribari-Neto, F. (2004). Beta Regression for Modeling Rates and Proportions. Journal of Applied Statistics, 31(7), 799–815. doi:10.1080/0266476042000214501
Migliorati, S., Di Brisco, A. M., Ongaro, A. (2018) A New Regression Model for Bounded Responses. Bayesian Analysis, 13(3), 845–872. doi:10.1214/17-BA1079
## Not run:
data("Reading")
FB <- flexreg(accuracy.adj ~ iq, data = Reading, type="FB")
# Regression model with one augmentation:
AFB1 <- flexreg(accuracy ~ dyslexia | iq + dyslexia + iq:dyslexia,
one.formula = ~ iq + dyslexia, data = Reading, type="FB")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.