# [R-meta] combining Means + SD at post, withD + 95% CI

Michael Dewey ||@t@ @end|ng |rom dewey@myzen@co@uk
Mon Mar 27 14:32:59 CEST 2023

```Dear Jorge

I think the conv.wald() function in metafor will calculate the variance
for you. You do need an up-to-date version of metafor.

Michael

On 26/03/2023 21:28, Jorge Teixeira via R-sig-meta-analysis wrote:
>   Hi all.
>
> I did this to combine studies that provided M+SD, with others for which I
> had only MD + 95% CI or p-value.
>
>
> *Questions: *
>
> i)   Is the Vi well calculated below, as the code was given by GPT?  n per
> group is irrelevant here, right?
>
> ii)  Is there a more elegant way to do this?
>
> iii) Can this method backfire in some way or is there something in
> particular that I should have in mind?
>
>
> Thanks! Code below:
>
> library(metafor)
>
> #
> dat <- structure(list(study = c("AA", "BB", "CC",
>                                  "EE", "DDD"), en = c(9, 41, 29, 8, 13
>                                  ), em = c(32, 27.5, 28.7, 22.8, 30.5), esd
> = c(1.9, 3.8, 5.2,
>
>     3.8, 4.9), cn = c(8, 26, 28, 10, 14), cm = c(30.1, 24.9, 26.9,
>
>                                                  24.7, 30.2), csd = c(2.4,
> 3.6, 3, 4.3, 5.1)), row.names = c(NA,
>
>
>                                  -5L), class = c("tbl_df", "tbl",
> "data.frame"))
>
> #
> dat <- escalc(measure="MD", m1i=em, sd1i=esd, n1i=en, m2i=cm, sd2i=csd,
> n2i=cn, data=dat)
>
>
> # Now lets had study "XING", which has a MD of 8 (95%CI: 4, 12), n=60;
> p=0.001
>
> sampling variance = (CI / 1.96) ^ 2 / (2 * sample size)
>
> (8 / 1.96) ^ 2 / (2 * 6) = 1.388
>
>
> # Create a new row for study XING
> new_row <- data.frame(study = "XING", en = NA, em = NA, esd = NA, cn = NA,
> cm = NA, csd = NA, yi = 8, vi = 1.388)
>
> # Add the new row to dat
> dat <- rbind(dat, new_row)
>
> #
> res <- rma(yi, vi,  data=dat)
> res
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-meta-analysis mailing list @ R-sig-meta-analysis using r-project.org
> To manage your subscription to this mailing list, go to:
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

```