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
[R-meta] combining Means + SD at post, withD + 95% CI
4 messages · Jorge Teixeira, Michael Dewey, Dr. Gerta Rücker
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 at r-project.org To manage your subscription to this mailing list, go to: https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
Dear Michael, thank you - that is indeed more elegant. Out of curiosity, is it possible to do this in ?meta? package too? Michael Dewey <lists at dewey.myzen.co.uk> escreveu no dia segunda, 27/03/2023 ?(s) 13:32:
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 at 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
Dear Jorge,
First of all, your formula for the variance of the XING study does not seems correct to me. I would expect for the sampling variance:
SE^2 = (CI.length / 1.96 /2)^2 = (8 / 1.96 / 2)^2 = 4.164931
(It is correct that you don't need the sample size.)
This gives with metafor:
estimate se zval pval ci.lb ci.ub
2.0751 1.0832 1.9156 0.0554 -0.0481 4.1982 .
Now how it works with meta:
# Your data
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"))
# Meta-analysis of continuous data with metacont()
m0 <- metacont(n.e = en, mean.e = em, sd.e = esd, n.c = cn, mean.c = cm, sd.c = csd,
data = dat)
# Use treatment effects (TE) and their standard errors (seTE) from m0, add the CI of study XING and conduct generic inverse variance meta-analysis
# metagen() will do the transformation from CI to TE and seTE
m1 <- metagen(TE = c(m0$TE, NA), seTE = c(m0$seTE, NA),
lower = c(NA, NA, NA, NA, NA, 4),
upper = c(NA, NA, NA, NA, NA, 12),
common = FALSE, method.tau = "REML")
m1
forest(m1)
Best,
Gerta
UNIVERSIT?TSKLINIKUM FREIBURG
Institute for Medical Biometry and Statistics
Dr. Gerta R?cker
Guest Scientist
Stefan-Meier-Stra?e 26 ? 79104 Freiburg
gerta.ruecker at uniklinik-freiburg.de
https://www.uniklinik-freiburg.de/imbi-en/employees.html?imbiuser=ruecker
-----Urspr?ngliche Nachricht-----
Von: R-sig-meta-analysis <r-sig-meta-analysis-bounces at r-project.org> Im Auftrag von Jorge Teixeira via R-sig-meta-analysis
Gesendet: Montag, 27. M?rz 2023 16:25
An: Michael Dewey <lists at dewey.myzen.co.uk>
Cc: Jorge Teixeira <jorgemmtteixeira at gmail.com>; R Special Interest Group for Meta-Analysis <r-sig-meta-analysis at r-project.org>
Betreff: Re: [R-meta] combining Means + SD at post, withD + 95% CI
Dear Michael, thank you - that is indeed more elegant.
Out of curiosity, is it possible to do this in ?meta? package too?
Michael Dewey <lists at dewey.myzen.co.uk> escreveu no dia segunda, 27/03/2023
?(s) 13:32:
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 at 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
_______________________________________________ R-sig-meta-analysis mailing list @ R-sig-meta-analysis at r-project.org To manage your subscription to this mailing list, go to: https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis