Description Usage Arguments Details Value Author(s) References Examples
BBreg
is used to fit beta-binomial regression models, where the estimation is performed using maximum likelihood.
1 |
formula |
an object of class |
n |
the maximum score of the binomial trials. |
data |
an optional data frame, list or environment (or object coercible by |
The probability parameter of the beta-binomial distribution p is connected to a vector of regression parameters by means of a logit link function model. The relationship between the covariables X_1,…,X_t and the probablity parameter of each observation p_i, i=1,…,m where m is the number of observations, is defined as
p_i=exp(x_i'β)/(1+exp(x_i'β)),
where β is a (t+1)\times 1 vector of regression parameter, and x_i is the ith row of a full design matrix X composed by the covariables.
The marginal density of the beta-binomial distribution can be explicity calculated, so if we replace the previous equation on the probability parameter of the density function we can perform estimations by maximum likelihood in the distribution parameters. Forcina and Franconi (1988) presented an iterative weighted least square method to perfom estimation on the both, regression parameters and, the dispersion parameter of the beta-binomial distribution.
If the estimation of the dispersion parameter φ in the iterative weigthing least squares method is lower than 0.05/[(n-1)-0.05)], where n is the number of trials, the function will use the usual logistic regression based on a binomial distribution, as a lower estimation of the dispersion parameter than the given value means that there is no dispersion problem in the model.
BBreg
returns an object of class "BBreg
".
The function summary
(i.e., summary.BBreg
) can be used to obtain or print a summary of the results.
The generic accessor functions coefficients
, fitted.values
and residuals
can be used to extract various useful features of the value returned by BBreg
.
coefficients |
the estimated value of the regression coefficients. |
vcov |
the variance and covariance matrix of the estimated coefficients of the regression. |
phi.coefficient |
the logarithm of the estimated value of the dispersion parameter of a beta-binomial distribution model. |
phi.var |
the variance of the logarithm of the estimated dispersion parameter. |
fitted.values |
the fitted mean values, obtained by transforming the linear predictors by the inverse of the link function. |
residuals |
the working residuals, that is the residuals in the final iteration of the IWLS fit. |
df |
degrees of freedom of the model. |
deviance |
the deviance of the model, i.e., minus twice the maximized log-likelihood. |
iter |
number of iterations in the iterative weighted least squares method. |
X |
the model matrix. |
y |
the dependent variable in the model. |
n |
the maximum score of the Binomial trials. |
noObs |
number of observations in the data frame. |
call |
the matched call. |
formula |
the formula supplied. |
Josu Najera
Dae-Jin Lee
Forcina A. & Franconi L. (1988): Regression analysis with Beta-Binomial distribution, Revista di Statistica Applicata, 21.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # We will generate a beta-binomial response variable fixing some values of
# the regression parameters and simualting a random effect. Then we are going
# to proof that we reach the same values.
# We generate the outcome variable fromm a simulated covariable.
set.seed(11)
k <- 100
n <- 10
x <- rnorm(k,5,3)
# We calculate the probability parameter as in the proposed methodology.
p <- 1/(1+exp(-(2*x-10)))
phi <- 1.2
# We simulate a beta-binomial random variable for those parameters.
y <- rBB(k,n,p,phi)
# We perform the beta-binomial regression
BBreg(y~x,n)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.