Skip to content
Prev 5401 / 5636 Next

[R-meta] Non-positive definite covariance matrix for rma.mv

Dear Pia,

You use vcalc() as follows:
This assumes a correlation of 1 within clusters. An example:

dat <- data.frame(study=c(1,1,1,2,3,3), vi=runif(6, .01, .10))
V <- vcalc(vi, cluster=study, data=dat)
blsplit(V, dat$study, fun=cov2cor)

I don't think this is what you intended. If you have multiple observations within clusters, then you indicate this to the function via 'obs' combined with 'rho' to provide the correlation:

dat <- data.frame(study=c(1,1,1,2,3,3), obs=c(1,2,3,1,1,2), vi=runif(6, .01, .10))
V <- vcalc(vi, cluster=study, obs=obs, data=dat, rho=0.6)
blsplit(V, dat$study, fun=cov2cor)

Best,
Wolfgang