# residuals.betareg

##### Residuals Method for betareg Objects

Extract various types of residuals from beta regression models: raw response residuals (observed - fitted), Pearson residuals (raw residuals scaled by square root of variance function), deviance residuals (scaled log-likelihood contributions), and different kinds of weighted residuals suggested by Espinheira et al. (2008).

- Keywords
- regression

##### Usage

```
# S3 method for betareg
residuals(object,
type = c("sweighted2", "deviance", "pearson", "response", "weighted", "sweighted"),
…)
```

##### Arguments

- object
fitted model object of class

`"betareg"`

.- type
character indicating type of residuals.

- …
currently not used.

##### Details

The definitions of all residuals are provided in Espinheira et al. (2008):
Equation 2 for `"pearson"`

, last equation on page 409 for `"deviance"`

,
Equation 6 for `"weighted"`

, Equation 7 for `"sweighted"`

, and
Equation 8 for `"sweighted2"`

.

Espinheira et al. (2008) recommend to use `"sweighted2"`

, hence this is
the default in the `residuals()`

method. Note, however, that these are
rather burdensome to compute because they require operations of \(O(n^2)\)
and hence might be prohibitively costly in large sample.

##### References

Cribari-Neto, F., and Zeileis, A. (2010). Beta Regression in R.
*Journal of Statistical Software*, **34**(2), 1--24.
http://www.jstatsoft.org/v34/i02/.

Espinheira, P.L., Ferrari, S.L.P., and Cribari-Neto, F. (2008).
On Beta Regression Residuals.
*Journal of Applied Statistics*, **35**(4), 407--419.

Ferrari, S.L.P., and Cribari-Neto, F. (2004).
Beta Regression for Modeling Rates and Proportions.
*Journal of Applied Statistics*, **31**(7), 799--815.

##### See Also

##### Examples

```
# NOT RUN {
options(digits = 4)
data("GasolineYield", package = "betareg")
gy <- betareg(yield ~ gravity + pressure + temp10 + temp, data = GasolineYield)
gy_res <- cbind(
residuals(gy, type = "pearson"),
residuals(gy, type = "deviance"),
residuals(gy, type = "response"),
residuals(gy, type = "weighted"),
residuals(gy, type = "sweighted"),
residuals(gy, type = "sweighted2")
)
colnames(gy_res) <- c("pearson", "deviance", "response",
"weighted", "sweighted", "sweighted2")
pairs(gy_res)
# }
```

*Documentation reproduced from package betareg, version 3.1-3, License: GPL-2 | GPL-3*