Skip to content
Prev 2461 / 5636 Next

[R-meta] Extracting residuals from rma.mv function

Dear Rafael,

I don't understand the details of what you are trying to do, but you can obtain residuals from a 'rma.mv' model with resid(). However, that will only give you the residuals and no indication of their precision. With rstandard(), you can get get the residuals ('resid') and the corresponding standard errors ('se'). If the model you have fitted accounted for phylogenetic non-independence and differences in the precision of the effect sizes, then so will the residuals and corresponding standard errors.

However, note that residuals are not independent (that is even the case in simple regression models outside of the meta-analytic context). With:

vcov(res, type="resid")

(assuming the model object is called 'res') you can get the full var-cov matrix of the residuals. You will note that this is not a diagonal matrix. The standard errors are just the square root of the diagonal elements:

sqrt(diag(vcov(res, type="resid")))

So, whatever you intend to do with the residuals may require that you not only account for differences in their precision, but also their covariances.

Best,
Wolfgang