Residuals for grouped objects
Computes a version of Bayesian latent residuals for grouped
models.
## S3 method for class 'grouped' residuals(object, standardized = FALSE, B = 100, ...)
object |
an object of class |
standardized |
logical; if |
B |
the number of multiple imputations to be used to estimate the residuals. |
... |
additional parameters; currently none is used. |
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β,
where Z_i denotes the value of the underlying true response of the ith sample unit, x_i^t is the covariate vector of the ith sample unit, β 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:
Simulate new parameter values, say θ^*, from N(\hat{θ}, C(\hat{θ})),
where \hat{θ} are the MLEs (including both β and σ, see grouped
)
and C(\hat{θ}) is their large sample covariance matrix.
Draw a value, say z_i^*, from the predictive distribution Z_i|Y_i under θ^*
and compute the residuals r_i^*=z_i^*-x_i^tβ^*. In fact, p(z_i|y_i; θ^*=(β^*, σ^*))
is a truncated F distribution in the interval given by y_i, where F denotes the distribution
implied by the value of the distribution
argument used in grouped
.
Repeat steps 1-2 B
times and combine the estimates using the known formulas of MI.
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.
an object of class resid.grouped
with the following components:
residuals |
a vector of the estimated residuals. |
mat.res |
a numeric matrix containing the B realization of the latent residuals.
If |
nam.res |
a character vector specifying the sample units names. |
B |
the value of the |
standardized |
the value of the |
fitted |
a numeric vector of the fitted values of |
Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl
Johnson, V. and Albert, J. (1999), Ordinal Data Modeling, New York: Springer-Verlag.
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.