Learn R Programming

grouped (version 0.6-0)

residuals.grouped: Residuals for grouped objects

Description

Computes a version of Bayesian latent residuals for grouped models.

Usage

## S3 method for class 'grouped':
residuals(object, standardized = FALSE, B = 100, ...)

Arguments

object
an object of class grouped.
standardized
logical; if TRUE the standardized residuals are computed.
B
the number of multiple imputations to be used to estimate the residuals.
...
additional parameters; currently none is used.

Value

  • an object of class resid.grouped with the following components:
  • residualsa vector of the estimated residuals.
  • mat.resa numeric matrix containing the $B$ realization of the latent residuals. If standardized = TRUE, then mat.res contains the values of $r_i^*/\sigma^*$. See Details above.
  • nam.resa character vector specifying the sample units names.
  • Bthe value of the B argument defined above.
  • standardizedthe value of the standardized argument defined above.
  • fitteda numeric vector of the fitted values of object.

Details

In a grouped-data setting the ordinary definition of residuals is problematic since, in fact the value of the true response is known only up to the interval in which it lies. A possible solution to this problem provides the notion of Bayesian residuals (see e.g., Johnson and Albert, Section 3.4). In particular, the Bayesian residuals in the grouped-data setting are defined as follows: $$r_i=Z_i - x_i^t\beta,$$ where $Z_i$ denotes the value of the underlying true response of the $i$th sample unit, $x_i^t$ is the covariate vector of the $i$th sample unit, $\beta$ are the regression coefficients and let also $Y_i$ denote the observed data. An estimation for $r_i$ can be obtained under the following Multiple Imputation (MI) scheme: [object Object],[object Object],[object Object] This procedure explicitly acknowledges the ignorance of the true parameter values by drawing from their large sample posterior distribution while taking into account the sampling error.

References

Johnson, V. and Albert, J. (1999), Ordinal Data Modeling, New York: Springer-Verlag.

See Also

grouped, summary.resid.grouped

Examples

Run this code
m1 <- grouped(cbind(lo, up) ~ treat * x, link = "logit", data = Sdata)
resid(m1)
    
m2 <- grouped(equispaced(r, n) ~ x1 * x2, link = "logit", data = Seeds)
resid(m2)

Run the code above in your browser using DataLab