residuals.overglm | R Documentation |
Computes various types of residuals to assess the individual quality of model fit for regression models based on the negative binomial, beta-binomial, and random-clumped binomial distributions, which are alternatives to the Poisson and binomial regression models under the presence of overdispersion.
## S3 method for class 'overglm'
residuals(
object,
type = c("quantile", "standardized", "response"),
plot.it = FALSE,
identify,
...
)
object |
an object of class overglm. |
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"); and (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 type
-type residuals.
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 <- overglm(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 <- overglm(art ~ fem + kid5 + 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)
###### Example 3: Agents to stimulate cellular differentiation
data(cellular)
fit3 <- overglm(cbind(cells,200-cells) ~ tnf + ifn, family="bb(logit)", data=cellular)
residuals(fit3, 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.