Open daniel1noble opened 7 years ago
Bring this new dependency function BACK into the covariance matrix function
VmCovMat <- function(data, es_var, depend, cor = 0.5){ data$dep<-paste(data[,"study"], data[,depend], sep="_") tmp <- reshape::expand.grid.df(data.frame(sd1 = sqrt(data[, es_var]), stdy1 = data[,"dep"]), data.frame(sd2 = sqrt(data[, es_var]), stdy2 = data[,"dep"])) tmp$cor <- ifelse((tmp$stdy1 == tmp$stdy2) & (tmp$sd1 != tmp$sd2), cor, 0) tmp$cov <- tmp$cor * tmp$sd1 * tmp$sd2 corMat <- matrix(tmp$cov , nrow = nrow(data), ncol = nrow(data)) diag(corMat) <- data[,es_var] return(corMat) }
Bring this new dependency function BACK into the covariance matrix function