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

Jorge Teixeira jorgemmtte|xe|r@ @end|ng |rom gm@||@com
Sun Mar 26 22:28:11 CEST 2023

``` 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]]

```