residuals.zeroinflation | R Documentation |
Computes various types of residuals to assess the individual quality of model fit in regression models to deal with zero-excess in count data.
## S3 method for class 'zeroinflation'
residuals(
object,
type = c("quantile", "standardized", "response"),
plot.it = FALSE,
identify,
...
)
object |
an object of class zeroinflation. |
type |
an (optional) character string which allows to specify the required type of residuals. The available options are: (1)
the difference between the observed response and the fitted mean ("response"); (2) the standardized difference between
the observed response and the fitted mean ("standardized"); (3) the randomized quantile residual ("quantile"). By
default, |
plot.it |
an (optional) logical switch indicating if the plot of residuals versus the fitted values is required. As default, |
identify |
an (optional) positive integer value indicating the number of individuals to identify on the plot of residuals versus the fitted values. This is only appropriate if |
... |
further arguments passed to or from other methods. If |
A vector with the observed residuals type type
.
Dunn P.K., Smyth G.K. (1996) Randomized Quantile Residuals. Journal of Computational and Graphical Statistics, 5, 236-244.
####### Example 1: Self diagnozed ear infections in swimmers
data(swimmers)
fit1 <- zeroalt(infections ~ frequency | location, family="nb1(log)", data=swimmers)
residuals(fit1, type="quantile", plot.it=TRUE, col="red", pch=20, col.lab="blue",
col.axis="blue", col.main="black", family="mono", cex=0.8)
####### Example 2: Article production by graduate students in biochemistry PhD programs
bioChemists <- pscl::bioChemists
fit2 <- zeroinf(art ~ fem + kid5 + ment | ment, family="nb1(log)", data = bioChemists)
residuals(fit2, type="quantile", plot.it=TRUE, col="red", pch=20, col.lab="blue",
col.axis="blue", col.main="black", family="mono", cex=0.8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.