Residual Values based on 'rma' Objects
## S3 method for class 'rma' residuals(object, type="response", ...) ## S3 method for class 'rma.uni' rstandard(model, digits, type="marginal", ...) ## S3 method for class 'rma.mh' rstandard(model, digits, ...) ## S3 method for class 'rma.peto' rstandard(model, digits, ...) ## S3 method for class 'rma.mv' rstandard(model, digits, cluster, ...) ## 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, ...) ## S3 method for class 'rma.mv' rstudent(model, digits, progbar=FALSE, cluster, reestimate=TRUE, parallel="no", ncpus=1, cl=NULL, ...)
object |
an object of class |
type |
the type of residuals which should be returned. For |
model |
an object of class |
cluster |
optional vector specifying a clustering variable to use for computing cluster-level multivariate standardized residuals (only for |
reestimate |
logical indicating whether variance/correlation components should be re-estimated after deletion of the ith study/cluster when computing externally standardized residuals (the default is |
parallel |
character string indicating whether parallel processing should be used (the default is |
ncpus |
integer specifying the number of processes to use in the parallel processing. |
cl |
optional snow cluster to use if |
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 |
... |
other arguments. |
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 (which yields the deleted residual), and then standardizing the deleted residual based on its standard error.
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).
For "rma.uni"
objects, rstandard.rma.uni
also can compute conditional residuals (when type="conditional"
), which are the deviations of the observed outcomes from the best linear unbiased predictions (BLUPs) of the study-specific true outcomes (see blup.rma.uni
).
For "rma.mv"
objects, one can specify a clustering variable (via the cluster
argument). If specified, rstandard
and rstudent
also compute cluster-level multivariate (internally or externally) standardized residuals. If all outcomes within a cluster fit the model, then the multivariate standardized residual for the cluster follows (asymptotically) a chi-square distribution with kᵢ degrees of freedom (where kᵢ denotes the number of outcomes within the cluster).
See also influence.rma.uni
and influence.rma.mv
for other leave-one-out diagnostics that are useful for detecting influential cases in models fitted with the rma.uni
and rma.mv
functions.
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 |
se |
corresponding standard errors. |
z |
standardized residuals (internally standardized for |
When a clustering variable is specified for "rma.mv"
objects, the returned object is a list with the first element (named obs
) as described above and a second element (named cluster
of class "list.rma"
with:
X2 |
cluster-level multivariate standardized residuals. |
k |
number of outcomes within the clusters. |
The "list.rma"
object is formatted and printed with print.list.rma
.
Right now, the externally standardized residuals (obtained with rstudent
) are calculated by refitting the model k times (where k is the number of studies/clusters). Depending on how large k is, it may take a few moments to finish the calculations. For complex models fitted with rma.mv
, this can become computationally expensive.
On machines with multiple cores, one can usually speed things up by delegating the model fitting to separate worker processes, that is, by setting parallel="snow"
or parallel="multicore"
and ncpus
to some value larger than 1 (only for objects of class "rma.mv"
). Parallel processing makes use of the parallel
package, using the makePSOCKcluster
and parLapply
functions when parallel="snow"
or using mclapply
when parallel="multicore"
(the latter only works on Unix/Linux-alikes). With parallel::detectCores()
, one can check on the number of available cores on the local machine.
Alternatively (or in addition to using parallel processing), one can also set reestimate=FALSE
, in which case any variance/correlation components in the model are not re-estimated after deleting the ith study/cluster from the dataset. Doing so only yields an approximation to the externally standardized residuals (and the cluster-level multivariate standardized residuals) that ignores the influence of the ith study/cluster on the variance/correlation components, but is considerably faster (and often yields similar results).
It may not be possible to fit the model after deletion of the ith study/cluster from the dataset. This will result in NA
values for that study/cluster when calling rstudent
.
Also, for "rma.mv"
objects with a clustering variable specified, it may not be possible to compute the cluster-level multivariate standardized residual for a particular cluster (if the var-cov matrix of the residuals within a cluster is not of full rank). This will result in NA
for that cluster.
For objects of class "rma.mh"
and "rma.peto"
, rstandard
actually computes Pearson (or semi-standardized) residuals.
Wolfgang Viechtbauer wvb@metafor-project.org http://www.metafor-project.org/
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. https://www.jstatsoft.org/v036/i03.
Viechtbauer, W., & Cheung, M. W.-L. (2010). Outlier and influence diagnostics for meta-analysis. Research Synthesis Methods, 1, 112–125.
### 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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.