residuals.rma {metafor}R Documentation

Residual Values based on 'rma' Objects

Description

The residuals, rstandard, and rstudent functions can be used to compute residuals, corresponding standard errors, and standardized residuals for models fitted with the rma.uni, rma.mh, rma.peto, and rma.mv functions.

Usage

## S3 method for class 'rma'
residuals(object, type="response", ...)

## S3 method for class 'rma.uni'
rstandard(model, digits, ...)
## S3 method for class 'rma.mh'
rstandard(model, digits, ...)
## S3 method for class 'rma.mv'
rstandard(model, digits, ...)
## S3 method for class 'rma.peto'
rstandard(model, digits, ...)

## S3 method for class 'rma.uni'
rstudent(model, digits, progbar=FALSE, ...)
## S3 method for class 'rma.mh'
rstudent(model, digits, progbar=FALSE, ...)
## S3 method for class 'rma.peto'
rstudent(model, digits, progbar=FALSE, ...)

Arguments

object

an object of class "rma" (for residuals).

type

the type of residuals which should be returned (by residuals). The alternatives are: "response" (default), "rstandard", "rstudent", and "pearson".

model

an object of class "rma.uni", "rma.mh", "rma.peto", or "rma.mv" (for rstandard and rstudent).

digits

integer specifying the number of decimal places to which the printed results should be rounded (if unspecified, the default is to take the value from the object).

progbar

logical indicating whether a progress bar should be shown (only for rstudent) (the default is FALSE).

...

other arguments.

Details

The observed residuals (obtained with residuals) are simply equal to the ‘observed - fitted’ values. These can be obtained with residuals(object) (using the default type="response").

Dividing the observed residuals by the model-implied standard errors of the observed effect sizes or outcomes yields Pearson (or semi-standardized) residuals. These can be obtained with residuals(object, type="pearson").

Dividing the observed residuals by their corresponding standard errors yields (internally) standardized residuals. These can be obtained with rstandard or residuals(object, type="rstandard").

The rstudent function (or residuals(object, type="rstudent")) calculates externally standardized residuals (also called standardized deleted residuals or (externally) studentized residuals). The externally standardized residual for the ith case is obtained by deleting the ith case from the dataset, fitting the model based on the remaining cases, calculating the predicted value for the ith case based on the fitted model, taking the difference between the observed and the predicted value for the ith case (the deleted residual), and then standardizing the deleted residual.

If a particular study fits the model, its standardized residual follows (asymptotically) a standard normal distribution. A large standardized residual for a study therefore may suggest that the study does not fit the assumed model (i.e., it may be an outlier).

See also influence.rma.uni for other leave-one-out diagnostics that are useful for detecting influential cases in models fitted with the rma.uni function.

Value

Either a vector with the residuals of the requested type (for residuals) or an object of class "list.rma", which is a list containing the following components:

resid

observed residuals (for rstandard) or deleted residuals (for rstudent).

se

corresponding standard errors.

z

standardized residuals (internally standardized for rstandard or externally standardized for rstudent).

The "list.rma" object is formated and printed with print.list.rma.

Note

Right now, the externally standardized residuals are calculated by refitting the model k times. Depending on how large k is, it may take a few moments to finish the calculations.

It may not be possible to fit the model after deletion of the ith case from the dataset. This will result in NA values for that case when calling rstudent.

For objects of class "rma.mh" and "rma.peto", rstandard also computes Pearson (or semi-standardized) residuals.

Author(s)

Wolfgang Viechtbauer wvb@metafor-project.org
package website: http://www.metafor-project.org/
author homepage: http://www.wvbauer.com/

References

Hedges, L. V., & Olkin, I. (1985). Statistical methods for meta-analysis. San Diego, CA: Academic Press.

Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1–48. http://www.jstatsoft.org/v36/i03/.

Viechtbauer, W., & Cheung, M. W.-L. (2010). Outlier and influence diagnostics for meta-analysis. Research Synthesis Methods, 1, 112–125.

See Also

rma.uni, rma.mh, rma.peto, rma.glmm, rma.mv, influence.rma.uni

Examples

### meta-analysis of the log risk ratios using a random-effects model
res <- rma(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
rstudent(res)

### mixed-effects model with absolute latitude as a moderator
res <- rma(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, mods = ~ ablat,
           data=dat.bcg)
rstudent(res)

[Package metafor version 2.0-0 Index]