residuals.betareg {betareg} | R Documentation |
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).
## S3 method for class 'betareg' residuals(object, type = c("sweighted2", "deviance", "pearson", "response", "weighted", "sweighted"), ...)
object |
fitted model object of class |
type |
character indicating type of residuals. |
... |
currently not used. |
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.
Cribari-Neto, F., and Zeileis, A. (2010). Beta Regression in R. Journal of Statistical Software, 34(2), 1–24. doi: 10.18637/jss.v034.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.
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)