Description Usage Arguments Details Value References Examples
View source: R/flexreg_binom.R
The function fits some flexible regression models for binomial data via a Bayesian approach to inference based on Hamiltonian Monte Carlo algorithm.
Available regression models are the flexible beta-binomial (type="FBB"
), the beta-binomial ("type=BetaBin"
), and the binomial one ("type=Bin"
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | flexreg_binom(
formula,
data,
type = "FBB",
n = NULL,
link.mu = "logit",
prior.beta = "normal",
hyperparam.beta = 100,
hyper.theta.a = NULL,
hyper.theta.b = NULL,
link.theta = NULL,
prior.psi = NULL,
hyperparam.psi = NULL,
n.iter = 5000,
burnin.perc = 0.5,
n.chain = 1,
thin = 1,
verbose = TRUE,
...
)
|
formula |
an object of class |
data |
an optional data frame, list, or object that is coercible to a data frame through |
type |
a character specifying the type of regression model. Current options are the flexible beta-binomial |
n |
the total number of trials. |
link.mu |
a character specifying the link function for the mean model (mu). Currently, |
prior.beta |
a character specifying the prior distribution for the |
hyperparam.beta |
a positive numeric (vector of length 1) specifying the hyperprior standard deviation parameter for the prior distribution of |
hyper.theta.a |
a numeric (vector of length 1) specifying the first shape parameter for the beta prior distribution of |
hyper.theta.b |
a numeric (vector of length 1) specifying the second shape parameter for the beta prior distribution of |
link.theta |
a character specifying the link function for the overdispersion model (theta). Currently, |
prior.psi |
a character specifying the prior distribution for |
hyperparam.psi |
a positive numeric (vector of length 1) specifying the hyperprior standard deviation parameter for the prior distribution of |
n.iter |
a positive integer specifying the number of iterations for each chain (including warmup). The default is 5000. |
burnin.perc |
the percentage of iterations per chain to discard. |
n.chain |
a positive integer specifying the number of Markov chains. The default is 1. |
thin |
a positive integer specifying the period for saving samples. The default is 1. |
verbose |
|
... |
additional arguments for |
Let Y be a random variable whose distribution can be specified in the type
argument and μ be the mean of Y/n.
The flexreg_binom
function links the parameter μ to a linear predictor through a function g(\cdot) specified in link.mu
:
g(μ_i) = x_i^t \bold{β},
where \bold{β} is the vector of regression coefficients for the mean model.
By default, link.theta="identity"
, meaning that the overdispersion parameter θ is assumed to be constant.
It is possible to extend the model by linking θ to an additional (possibly overlapping) set of covariates through a proper link
function q(\cdot) specified in the link.theta
argument:
q(θ_i) = z_i^t \bold{ψ},
where \bold{ψ} is the vector of regression coefficients for the overdispersion model.
In flexreg_binom
, the regression model for the mean and, where appropriate, for the overdispersion parameter can be specified in the
formula
argument with a formula of type y \sim x_1 + x_2 | z_1 + z_2 where covariates on the left of ("|") are included in the regression model
for the mean and covariates on the right of ("|") are included in the regression model for the overdispersion.
If the second part is omitted, i.e., y \sim x_1 + x_2, the overdispersion is assumed constant for each observation.
The flexreg_binom
function returns an object of class `flexreg`
, i.e. a list with the following elements:
|
the function call. |
|
the original formula. |
|
a character specifing the link function in the mean model. |
|
a character specifing the link function in the overdispersion model. |
|
an object of class |
|
the response variable, assuming values in (0, 1). |
|
the design matrix for the mean model. |
|
the design matrix for the overdispersion model (if defined). |
Ascari, R., and Migliorati, S. (2021). A new regression model for overdispersed binomial data accounting for outliers and an excess of zeros. Statistics in Medicine, 40(17), 3895–3914. doi:10.1002/sim.9005
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.