zero.excess | R Documentation |
Allows to assess if the observed number of zeros is significantly higher than expected according to the fitted count regression model (poisson or negative binomial).
zero.excess(object, verbose = TRUE)
object |
an object of the class |
verbose |
an (optional) logical switch indicating if should the report of results be printed. By default, |
According to the formulated count regression model, we have that
Y_k\sim P(y;\mu_k,\phi)
for k=1,\ldots,n
are independent
random variables. Then, the expected number of zeros is the sum of
P(0;\hat{\mu}_k,\hat{\phi})
for k=1,\ldots,n
, where
\hat{\mu}_k
and \hat{\phi}
represent the estimates of
\mu_k
and \phi
, respectively, obtained from the fitted
model. Thus, the test statistic reduces to the standardized
difference between the observed and expected number of zeros. The
distribution of that statistic, under the null hypothesis, tends
to be the standard normal when the sample size, n
, tends to
infinity.
A matrix with 1 row and the following columns:
Observed | the observed number of zeros, |
Expected | the expected number of zeros, |
z-value | the value of the statistical test, |
Pr(>z) | the p-value of the statistical test. |
overglm, zeroinf
####### Example 1: Self diagnozed ear infections in swimmers
data(swimmers)
fit1 <- glm(infections ~ frequency + location, family=poisson, data=swimmers)
zero.excess(fit1)
fit2 <- overglm(infections ~ frequency + location, family="nb1", data=swimmers)
zero.excess(fit2)
####### Example 2: Article production by graduate students in biochemistry PhD programs
bioChemists <- pscl::bioChemists
fit1 <- glm(art ~ fem + kid5 + ment, family=poisson, data = bioChemists)
zero.excess(fit1)
fit2 <- overglm(art ~ fem + kid5 + ment, family="nb1", data = bioChemists)
zero.excess(fit2)
####### Example 3: Roots Produced by the Columnar Apple Cultivar Trajan
data(Trajan)
fit1 <- glm(roots ~ photoperiod, family=poisson, data=Trajan)
zero.excess(fit1)
fit2 <- overglm(roots ~ photoperiod, family="nbf", data=Trajan)
zero.excess(fit2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.