Computes residuals as the difference between observed values and fitted
values. For type = "response", returns Y - fitted(object).
For type = "pearson", returns response residuals scaled by the
standard deviation the family assigns to a response with that fitted value
\(\mu\) (fitted(object), which for a Poisson fit already carries
the exposure):
| family | variance |
| normal | \(\sigma^2_e\), the posterior mean residual variance |
| binary | \(\mu (1 - \mu)\) |
| poisson | \(\mu + \mu^2 (e^{\sigma^2_e} - 1)\), the variance of a count when \(y \sim \mathrm{Poisson}(e^z)\) and \(z \sim N(\eta, \sigma^2_e)\) |
| ordinal | the variance of the category distribution at the posterior-mean linear predictor; with explicit cutpoints the posterior-mean cutpoints, with data-induced cutpoints those that reproduce the observed category shares (the rule the posterior predictive draws use) |
A cell whose variance is zero has no standardised residual and is
NA.
Value
An n x n matrix (unipartite) or nA x nB matrix (bipartite) of
residuals. Entries where the original data was NA remain NA.