# [R-meta] Condition to make variance-covariance matrix invertible with "rma.mv"

Federico Tedeschi federico@tede@chi @ending from univr@it
Mon Nov 12 14:08:49 CET 2018

```Dear all,

I'd like to understand how I can further investigate on the error message "Error in eigen(V, symmetric = TRUE, only.values = TRUE) : infinite or missing values in 'x' " with the "rma.mv" command.

In my case, I have realized that my problem is that the estimated between-study (BS) covariance is not positive definite. However, I've noticed that even by forcing the BS covariance matrix to be diagonal the model doesn't run. These are my data:

BOD <- structure(list(eff = c(-.109,.007,-.132,-.090,-.103,-.002,-.017,-.103,.075,-.074,-.222,-.004), group = c(1,2,1,2,1,2,1,2,1,2,1,2), v1i=c(0.003844,-0.0002555,0.005184,-0.000274,0.000784,-0.000052,0.002401,-0.000203,0.001156,-0.000186,0.009801,-0.0000405), v2i=c(-0.0002555,0.001156,-0.000274,0.001764,-0.000052,0.000049,-0.000203,0.001369,-0.000186,0.000441,-0.0000405,0.000081),outcome=c("dir","ind","dir","ind","dir","ind","dir","ind","dir","ind","dir","ind"), class = "data.frame"))

and these are the commands I run:

library(metafor)
V <- bldiag(V)
res <- rma.mv(eff, V, mods = ~ outcome - 1, random = ~ outcome | group, struct="DIAG", data=effcovmatrix, method="ML")
res <- rma.mv(eff, V, mods = ~ outcome - 1, random = ~ outcome | group, struct="DIAG", data=effcovmatrix, method="REML")

Both the ML and the REML methods lead to the same error message as above. I don't understand why the problem occurs even when I fix the BS covariance to 0: in such case, my understanding is that the variances of the effects should even be inflated (with non-positive-definiteness due to an implied correlation below -1, fixing the correlation to any admittable value leads to a lower covariance, thing that is compensated by inflating variances).
Is it because a first estimation of the BS covariance matrix is performed before the "structure" command is considered? Is there a way to overcome this problem?

[[alternative HTML version deleted]]

```