residuals.VCA {VCA}R Documentation

Extract Residuals of a 'VCA' Object

Description

Function extracts marginal or conditional residuals from a 'VCA' object, representing a linear mixed model.

Usage

## S3 method for class 'VCA'
residuals(
  object,
  type = c("conditional", "marginal"),
  mode = c("raw", "student", "standard", "pearson"),
  quiet = FALSE,
  ...
)

Arguments

object

(VCA) object

type

(character) string specifying the type of residuals to be returned, valid options are "marginal" and "conditional" or abbreviations

mode

(character) string or abbreviation specifying the specific transformation applied to a certain type of residuals. There are "raw" (untransformed), "standardized", "studentized" and "pearson" (see details) residuals.

quiet

(logical) TRUE = will suppress any warning, which will be issued otherwise

...

additional parameters

Details

There are two types of residuals which can be extraced from a 'VCA' object. Marginal residuals correspond to e_m = y - \hat{y}, where \hat{y} = Xb with X being the design matrix of fixed effects and b being the column vector of fixed effects parameter estimates. Conditional residuals are defined as e_c = y - Xb - Zg, where Z corresponds to the designs matrix of random effects g. Whenever 'obj' is a pure-error model, e.g. 'y~1' both options will return the same values y - Xb and b corresponds to the intercept. Each type of residuals can be standardized, studentized, or transformed to pearson-type residuals. The former corresponds to a transformation of residuals to have mean 0 and variance equal to 1 ((r - \bar{r})/\sigma_{r}). Studentized residuals emerge from dividing raw residuals by the square-root of diagonal elements of the corresponding variance-covariance matrix. For conditional residuals, this is Var(c) = P = RQR, with Q = V^{-1}(I - H), H = XT being the hat-matrix, and T = (X^{T}V^{-1}X)^{-1}X^{T}V^{-1}. For marginal residuals, this matrix is Var(m) = O = V - Q. Here, >^{T}< denotes the matrix transpose operator, and >^{-1}< the regular matrix inverse. Pearson-type residuals are computed in the same manner as studentized, only the variance-covariance matrices differ. For marginal residuals this is equal to Var(y) = V, for conditional residuals this is Var(c) = R (see getV for details).

Author(s)

Andre Schuetzenmeister andre.schuetzenmeister@roche.com

References

Hilden-Minton, J. A. (1995). Multilevel diagnostics for mixed and hierarchical linear models. Dissertation, University of California, Los Angeles.

Nobre, J. S. & Singer, J. M. (2007). Residual analysis for linear mixed models. Biometrical Journal, 49, 863-875.

Schuetzenmeister, A. and Piepho, H.P. (2012). Residual analysis of linear mixed models using a simulation approach. Computational Statistics and Data Analysis, 56, 1405-1416

See Also

ranef, anovaVCA, anovaMM

Examples

## Not run: 
data(VCAdata1)
datS1 <- VCAdata1[VCAdata1$sample==1,]
fit1  <- anovaVCA(y~(lot+device)/(day)/(run), datS1) 

# default is conditional (raw) residuals
resid(fit1)
resid(fit1, "m")

# get standardized version
resid(fit1, mode="stand")		# conditional residuals (default)
resid(fit1, "marg", "stand")		# marginal residuals

# get studentized version, taking their 
# covariances into account
resid(fit1, mode="stud")		# conditional residuals (default)
resid(fit1, "marg", "stud")		# marginal residuals

## End(Not run)


[Package VCA version 1.5.1 Index]