metami | R Documentation |

Multiple imputation allows for the uncertainty about the missing data by generating several different plausible imputed data sets and appropriately combining results obtained from each of them. Let `\hat{\theta}_{*m}`

be the estimated coefficient from the `m`

th imputed dataset for one of the `p`

dimensions in the multivariate outcome, where `m=1,\dots,M`

. The coefficient from MI `\bar{\theta}`

is simply just an arithmetic mean of the individual coefficients estimated from each of the `M`

meta-analysis. We have

`\bar{\theta}=\frac{\sum_{m=1}^{M}\hat{\theta}_{*m}}{M}.`

Estimation of the standard error for each variable is little more complicated. Let `V_W`

be the within imputation variance, which is the average of the variance of the estimated coefficient from each imputed dateset:

`V_W=\frac{\sum_{m=1}^{M}V ({\hat{\theta}_{*m}})}{M},`

where `V ({\hat{\theta}_{*m}})`

is the variance of the estimator calculated from generalized least squares methods using the imputed dataset. Let `V_B`

be the between imputation variance, which is calculated as

`V_B=\frac{\sum_{m=1}^{M}({\hat{\theta}_{*m}}-\bar{\theta})^2}{M-1}.`

From `V_W`

and `V_B`

, the variance of the pooled coefficients is calculated as

`V(\bar{\theta})=V_W+V_B+\frac{V_B}{M}`

The above variance is statistically principled since `V_W`

reflects the sampling variance and `V_B`

reflects the extra variance due to the missing data.

```
metami(data, M = 20, vcov = "r.vcov",
r.n.name, ef.name, x.name = NULL,
rvcov.method = "average", rvcov.zscore = TRUE,
type = NULL,
d = NULL, sdt = NULL, sdc = NULL,
nt = NULL, nc = NULL,
st = NULL, sc = NULL,
n_rt = NA, n_rc = NA,
r = NULL,
func = "mixmeta",
formula = NULL,
method = "fixed",
pool.seq = NULL,
return.mi = FALSE,
ci.level = 0.95)
```

`data ` |
A |

`M` |
Number of imputed data sets. |

`vcov ` |
Method for computing effect sizes; options including |

`r.n.name ` |
A string defining the column name for sample sizes in |

`ef.name ` |
A |

`x.name ` |
A vector that stores the column names in |

`rvcov.method` |
Method used for |

`rvcov.zscore ` |
Whether the correlation coefficients in |

`type ` |
A |

`d ` |
A |

`sdt ` |
A |

`sdc ` |
A vector defined in a similar way as |

`nt ` |
A |

`nc ` |
A vector defined in a similar way as |

`st ` |
A |

`sc ` |
A vector defined in a similar way as |

`n_rt` |
A |

`n_rc` |
A list defined in a similar way as |

`r` |
A |

`func` |
A string defining the function to be used for fitting the meta-analysis. Options include |

`formula` |
Formula used for the function |

`method` |
Method used for the function |

`pool.seq` |
A numeric vector indicating if the results are pooled from subsets of the |

`return.mi` |
Should the |

`ci.level` |
Significant level for the pooled confidence intervals. The default is 0.05. |

For the imputation phase, this function imports the `mice`

package that imputes incomplete multivariate data by chained equations. The pooling phase is performed via the Rubin's rules.

`coefficients` |
A data.frame that contains the pooled results from the |

`results.mi` |
A |

`data.mi ` |
A |

`result.seq` |
A list of results from the pooled results from the subsets of the |

Min Lu

Lu, M. (2023). Computing within-study covariances, data visualization, and missing data solutions for multivariate meta-analysis with metavcov. *Frontiers in Psychology*, 14:1185012.

Van Buuren, S. and Groothuis-Oudshoorn, K., 2011. mice: Multivariate imputation by chained equations in R. *Journal of statistical software*, 45(1), pp.1-67.

```
#####################################################################################
# Example: Craft2003 data
# Preparing input arguments for meta.mi() and fixed-effect model
#####################################################################################
# prepare a dataset with missing values and input arguments for meta.mi
Craft2003.mnar <- Craft2003[, c(2, 4:10)]
Craft2003.mnar[sample(which(Craft2003$C4 < 0), 6), "C4"] <- NA
dat <- Craft2003.mnar
n.name <- "N"
ef.name <- c("C1", "C2", "C3", "C4", "C5", "C6")
# fixed-effect model
obj <- metami(dat, M = 2, vcov = "r.vcov",
n.name, ef.name,
func = "metafixed")
########################
# Plotting the result
########################
computvcov <- r.vcov(n = Craft2003$N,
corflat = subset(Craft2003.mnar, select = C1:C6),
method = "average")
plotCI(y = computvcov$ef, v = computvcov$list.vcov,
name.y = NULL, name.study = Craft2003$ID,
y.all = obj$coefficients[,1],
y.all.se = obj$coefficients[,2])
########################
# Pooling from subsets
########################
# o1 <- metami(dat, M = 10, vcov = "r.vcov",
# n.name, ef.name,
# func = "metafixed",
# pool.seq = c(5, 10))
# pooled results from M = 5 imputed data sets
# o1$result.seq$M5$coefficients
# pooled results from M = 10 imputed data sets
# o1$result.seq$M10$coefficients
#########################################################################################
# Running random-effects and meta-regression model using packages "mixmeta" or "metaSEM"
#########################################################################################
# Restricted maximum likelihood (REML) estimator from the mixmeta package
# library(mixmeta)
# o2 <- metami(dat, M = 10, vcov = "r.vcov",
# n.name, ef.name,
# formula = as.formula(cbind(C1, C2, C3, C4, C5, C6) ~ 1),
# func = "mixmeta",
# method = "reml")
# maximum likelihood estimators from the metaSEM package
# library(metaSEM)
# o3 <- metami(dat, M = 10, vcov = "r.vcov",
# n.name, ef.name,
# func = "meta")
# meta-regression
# library(metaSEM)
# o4 <- metami(dat, M = 10, vcov = "r.vcov",
# n.name, ef.name, x.name = "p_male",
# func = "meta")
# library(mixmeta)
# o5 <- metami(dat, M = 20, vcov = "r.vcov",
# n.name, ef.name, x.name = "p_male",
# formula = as.formula(cbind(C1, C2, C3, C4, C5, C6) ~ p_male ),
# func = "mixmeta",
# method = "reml")
#####################################################################################
# Example: Geeganage2010 data
# Preparing input arguments for meta.mi() and fixed-effect model
#####################################################################################
# Geeganage2010.mnar <- Geeganage2010
# Geeganage2010.mnar$MD_SBP[sample(1:nrow(Geeganage2010),7)] <- NA
# r12 <- 0.71
# r13 <- 0.5
# r14 <- 0.25
# r23 <- 0.6
# r24 <- 0.16
# r34 <- 0.16
# r <- vecTosm(c(r12, r13, r14, r23, r24, r34))
# diag(r) <- 1
# mix.r <- lapply(1:nrow(Geeganage2010), function(i){r})
# o <- metami(data = Geeganage2010.mnar, M = 10, vcov = "mix.vcov",
# ef.name = c("MD_SBP", "MD_DBP", "RD_DD", "lgOR_D"),
# type = c("MD", "MD", "RD", "lgOR"),
# d = c("MD_SBP", "MD_DBP", NA, NA),
# sdt = c("sdt_SBP", "sdt_DBP", NA, NA),
# sdc = c("sdc_SBP", "sdc_DBP", NA, NA),
# nt = c("nt_SBP", "nt_DBP", "nt_DD", "nt_D"),
# nc = c("nc_SBP", "nc_DBP", "nc_DD", "nc_D"),
# st = c(NA, NA, "st_DD", "st_D"),
# sc = c(NA, NA, "sc_DD", "sc_D"),
# r = mix.r,
# func = "metafixed")
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.