Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

residuals.overglm

Residuals for Negative Binomial and Beta-Binomial Regression Models


Description

Calculates residuals for a fitted negative binomial or beta-binomial model.

Usage

## S3 method for class 'overglm'
residuals(
  object,
  ...,
  type = c("quantile", "standardized", "response"),
  plot.it = TRUE,
  identify
)

Arguments

object

an object of the class overglm obtained from the fit of a negative binomial or beta-binomial model.

...

further arguments passed to or from other methods.

type

an (optional) character string giving the type of residuals which should be returned. 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 ("pearson"); (3) the randomized quantile residuals ("quantile"). By default, type is set to be "quantile".

plot.it

an (optional) logical switch indicating if a plot of the residuals is required. By default, plot is set to be TRUE.

identify

an (optional) integer value indicating the number of individuals to identify on the plot of residuals. This is only appropriate when plot.it=TRUE.

Value

A vector with the observed residuals type type.

References

Dunn P.K. and Smyth G.K. (1996) Randomized Quantile Residuals. Journal of Computational and Graphical Statistics, 5, 236-244.

Examples

## Example 1
fit1 <- overglm(cbind(fetuses,litter-fetuses) ~ pht + tcpo, family="bb(logit)", data=ossification)
residuals(fit1,type="quantile",col="red", pch=20,col.lab="blue",
          col.axis="blue",col.main="black",family="mono",cex=0.8)

## Example 2
fit2 <- overglm(infections ~ location + frequency, family="nb1(log)", data=swimmers)
residuals(fit2,type="quantile",col="red", pch=20,col.lab="blue",
          col.axis="blue",col.main="black",family="mono",cex=0.8)

glmtoolbox

Set of Tools to Data Analysis using Generalized Linear Models

v0.1.0
GPL-2 | GPL-3
Authors
Luis Hernando Vanegas [aut, cre], Luz Marina Rondón [aut], Gilberto A. Paula [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.