Description Usage Arguments Details Value Author(s) References Examples
Fit of the BerG regression model via maximum likelihood for a new parameterization of this distribution that is indexed by the mean and the dispersion index.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
formula |
a symbolic description of the model, of type y ~ x or y ~ x | z.See details below. |
data |
an optional data frame containing the variables in the formula. By default the variables are taken from environment(formula). |
link, link.phi |
character; specification of the link function in the
mean model. The links |
disp.test |
logical; if TRUE, the function |
control |
a list of control arguments specified via |
... |
arguments passed to |
y |
a numeric vector of the response variable, in counts. This argument
is used only in the |
X, Z |
model matrices associated with the mean and the dispersion index
parameters, respectively, which are used only in the |
The basic formula is of type y ~ x1 + x2 + ... + xp
which
specifies the model for the mean response only. Following the syntax of the
betareg
package (Cribari-Neto and Zeileis, 2010), the model for the dispersion index, say in terms of
z1, z2, ..., zk, is specified as y ~ x1 + x2 + ... + xp | z1 + z2 +
... +zk
using functionalities inherited from package Formula
(Zeileis and Croissant, 2010).
The glm.bg
function returns an object of class "bergrm",
which consists of a list with the following components. berg_fit
is
an auxiliary function that returns an unclassed list formed by some of the
components below. This function can be used to fit the BerG regression
in terms of the y, X, and Z objects instead of the formula.
a list containing the elements "mean" and "dispersion" that consist of the estimates of the coefficients associated with the mean and the dispersion index, respectively.
the link function used for the mean model, and for the dispersion index model, respectively.
asymptotic covariance matrix of the maximum likelihood estimator of the model parameters vector. Specifically, the inverse of the Fisher information matrix.
log-likelihood of the fitted model.
model Akaike information criteria.
model bayesian information criteria.
Sample size, number of coefficients in the mean model, and number of coefficients in the dispersion index model, respectively.
Logical. If TRUE
, the estimates obtained belong to
the parametric space.
a vector with the Pearson residuals.
a vector with the randomized quantile residuals.
a vector with the fitted means.
a vector with the fitted dispersion indexes.
a list containing the elements "eta1" and "eta2" that consist of the fitted linear predictor for the mean and the dispersion index.
the vector of the response.
model matrices associated with the mean and the dispersion parameter, respectively.
the function call.
the formula used to specify the model in glm.bg
.
Rodrigo M. R. Medeiros <rodrigo.matheus@live.com>
Bourguignon, M. & Medeiros, R. (2020). A simple and useful regression model for fitting count data.
Cribari-Neto F, Zeileis A (2010). Beta Regression in R. Journal of Statistical Software, 34, 1–24
Zeileis A, Croissant Y (2010). Extended Model Formulas in R: Multiple Parts and Multiple Responses. Journal of Statistical Software, 34, 1–13.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Dataset: grazing
data(grazing)
attach(grazing); head(grazing)
# Response variable (Number of understorey birds)
plot(table(birds), xlab = "Number of understorey birds", ylab = "Frequency")
# Explanatory variables
boxplot(split(birds, when), ylab = "Number of understorey birds",
xlab = "When the bird count was conduct", pch = 16)
boxplot(split(birds, grazed), ylab = "Number of understorey birds",
xlab = " Which side of the stockproof fence", pch = 16)
# Fit of the BerG regression model with varying dispersion
fit_disp <- glm.bg(birds ~ when + grazed | when + grazed, data = grazing)
summary(fit_disp)
# Fit of the BerG regression model with constant dispersion
fit <- glm.bg(birds ~ when + grazed, data = grazing, link.phi = "identity")
summary(fit)
# Diagnostic
plot(fit)
envel_berg(fit)
detach(grazing)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.