Dear List, I aim to perform a meta-analysis and present a forest plot of the difference in proportions between two groups. For each group I have proportion and standard error (SE). It's straightforward to get the difference in the proportions, but am not sure how to handle the SEs, I presume I can't just subtract them. Is there a formula on how to handle SEs? Sincerely, nelly
[R-meta] Difference in Proportions Meta-Analysis
10 messages · Wolfgang Viechtbauer, Michael Dewey, ne gic
Dear Nelly, For two independent estimates, y1 and y2, with standard errors SE1 and SE2, the SE of their difference is: SE[y1 - y2] = sqrt(SE1^2 + SE2^2) Best, Wolfgang
-----Original Message----- From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On Behalf Of ne gic Sent: Monday, 08 June, 2020 12:37 To: r-sig-meta-analysis at r-project.org Subject: [R-meta] Difference in Proportions Meta-Analysis Dear List, I aim to perform a meta-analysis and present a forest plot of the difference in proportions between two groups. For each group I have proportion and standard error (SE). It's straightforward to get the difference in the proportions, but am not sure how to handle the SEs, I presume I can't just subtract them. Is there a formula on how to handle SEs? Sincerely, nelly
Dear Wolfgang, Thank you! Sincerely, nelly On Mon, Jun 8, 2020 at 12:42 PM Viechtbauer, Wolfgang (SP) <
wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
Dear Nelly, For two independent estimates, y1 and y2, with standard errors SE1 and SE2, the SE of their difference is: SE[y1 - y2] = sqrt(SE1^2 + SE2^2) Best, Wolfgang
-----Original Message----- From: R-sig-meta-analysis [mailto:
r-sig-meta-analysis-bounces at r-project.org]
On Behalf Of ne gic Sent: Monday, 08 June, 2020 12:37 To: r-sig-meta-analysis at r-project.org Subject: [R-meta] Difference in Proportions Meta-Analysis Dear List, I aim to perform a meta-analysis and present a forest plot of the difference in proportions between two groups. For each group I have proportion and standard error (SE). It's straightforward to get the difference in the proportions, but am not sure how to handle the SEs, I presume I can't just subtract them. Is there a formula on how to handle SEs? Sincerely, nelly
Dear Nelly I am not sure what software you use but both meta and metafor provide analysis of risk differences (which is what differences in proportions are) so you may get what you want directly there. Michael
On 08/06/2020 11:36, ne gic wrote:
Dear List, I aim to perform a meta-analysis and present a forest plot of the difference in proportions between two groups. For each group I have proportion and standard error (SE). It's straightforward to get the difference in the proportions, but am not sure how to handle the SEs, I presume I can't just subtract them. Is there a formula on how to handle SEs? Sincerely, nelly [[alternative HTML version deleted]]
_______________________________________________ R-sig-meta-analysis mailing list R-sig-meta-analysis at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
Dear Michael, Thanks. I am using metafor (or rather planning to for this). Initially I had performed two separate single arm meta-analysis of proportion as follows to get an estimate for each of the arms: rma(yi = arm1_prop_plogis, sei = arm1_se, slab=author_year , data=gastric_data, method="REML") rma(yi = arm2_prop_plogis, sei = arm2_se, slab=author_year , data=gastric_data, method="REML") But then it was pointed out that it would be more interesting to meta-analyze the difference in proportions from both arms, and hence my question. So what I have done is: 1. Calculate the raw proportion differences i.e. before using the R function "qlogis" 2. Calculate a single SE from the SE of both arms using the equation provided by Wolfgang. Then the two outputs are what I hope to provide as inputs to rma exactly as I had done before for the single arm analysis. Is there a more direct way to do this? or am I missing something? Thanks for your help, Sincerely, nelly On Mon, Jun 8, 2020 at 2:48 PM Michael Dewey <lists at dewey.myzen.co.uk> wrote:
Dear Nelly I am not sure what software you use but both meta and metafor provide analysis of risk differences (which is what differences in proportions are) so you may get what you want directly there. Michael On 08/06/2020 11:36, ne gic wrote:
Dear List, I aim to perform a meta-analysis and present a forest plot of the difference in proportions between two groups. For each group I have proportion and standard error (SE). It's straightforward to get the difference in the proportions, but am not sure how to handle the SEs, I presume I can't just subtract them. Is
there
a formula on how to handle SEs?
Sincerely,
nelly
[[alternative HTML version deleted]]
_______________________________________________ R-sig-meta-analysis mailing list R-sig-meta-analysis at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
-- Michael http://www.dewey.myzen.co.uk/home.html
I am not sure I really understand what you did. arm1_prop_plogis and arm2_prop_plogis actually sound like they are plogis()-transformed proportions, which doesn't make sense (plogis() is the inverse-logit transformation). The logit transformation is qlogis(). Not sure how you computed arm1_se and arm2_se. Why not use escalc(measure="PLO", ...), which will do things correctly for you?
But if you want to compare the two groups within studies directly, then you need to use measures such as the risk difference (measure="RD"), the log transformed risk ratio ("RR"), or the log transformed odds ratio ("OR"). In fact, the difference between two logit-transformed proportions *IS* the log transformed odds ratio.
So, just use escalc(measure="OR", ...) and then pass the 2x2 table counts via arguments 'ai', 'bi', 'ci', 'di' (or the 'event' counts via arguments 'ai' and 'ci' and the group sizes via 'n1i' and 'n2i'). See help(escalc) and search for "OR".
Best,
Wolfgang
-----Original Message----- From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On Behalf Of ne gic Sent: Monday, 08 June, 2020 15:09 To: Michael Dewey Cc: r-sig-meta-analysis at r-project.org Subject: Re: [R-meta] Difference in Proportions Meta-Analysis Dear Michael, Thanks. I am using metafor (or rather planning to for this). Initially I had performed two separate single arm meta-analysis of proportion as follows to get an estimate for each of the arms: rma(yi = arm1_prop_plogis, sei = arm1_se, slab=author_year , data=gastric_data, method="REML") rma(yi = arm2_prop_plogis, sei = arm2_se, slab=author_year , data=gastric_data, method="REML") But then it was pointed out that it would be more interesting to meta-analyze the difference in proportions from both arms, and hence my question. So what I have done is: 1. Calculate the raw proportion differences i.e. before using the R function "qlogis" 2. Calculate a single SE from the SE of both arms using the equation provided by Wolfgang. Then the two outputs are what I hope to provide as inputs to rma exactly as I had done before for the single arm analysis. Is there a more direct way to do this? or am I missing something? Thanks for your help, Sincerely, nelly On Mon, Jun 8, 2020 at 2:48 PM Michael Dewey <lists at dewey.myzen.co.uk> wrote:
Dear Nelly I am not sure what software you use but both meta and metafor provide analysis of risk differences (which is what differences in proportions are) so you may get what you want directly there. Michael On 08/06/2020 11:36, ne gic wrote:
Dear List, I aim to perform a meta-analysis and present a forest plot of the difference in proportions between two groups. For each group I have proportion and standard error (SE). It's straightforward to get the difference in the proportions, but am
not
sure how to handle the SEs, I presume I can't just subtract them. Is
there
a formula on how to handle SEs? Sincerely, nelly
Sorry, that was a typing mistake: I transformed the proportions using qlogis, then back transformed them using the plogis. Here is literally what I have done: On excel: 1. Calculated the difference in proportions between arm1 and arm2 (arm1 - arm2) to get arm12_prop_diff 2. Used the formula you provided to calculate the "joint" standard error (se_diff) In R: # Import the excel data. gastric_data$arm12_prop_diff <- as.numeric(gastric_data$arm12_prop_diff) gastric_data$se_diff <- as.numeric(gastric_data$se_diff) # Log transformation gastric_data$arm12_prop_qlogs_diff <- qlogis(gastric_data$arm12_prop_diff) # fit random-effects model pes.da=rma(yi = arm12_prop_qlogs_diff, sei = se_diff, slab=author , data=gastric_data, method="REML") forest(pes.da, xlab = "2-year survival difference (%)", order=order(gastric_data$arm12_prop_diff), atransf=plogis) Is this still not a reasonable way to go about this? On Mon, Jun 8, 2020 at 5:27 PM Viechtbauer, Wolfgang (SP) <
wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
I am not sure I really understand what you did. arm1_prop_plogis and
arm2_prop_plogis actually sound like they are plogis()-transformed
proportions, which doesn't make sense (plogis() is the inverse-logit
transformation). The logit transformation is qlogis(). Not sure how you
computed arm1_se and arm2_se. Why not use escalc(measure="PLO", ...), which
will do things correctly for you?
But if you want to compare the two groups within studies directly, then
you need to use measures such as the risk difference (measure="RD"), the
log transformed risk ratio ("RR"), or the log transformed odds ratio
("OR"). In fact, the difference between two logit-transformed proportions
*IS* the log transformed odds ratio.
So, just use escalc(measure="OR", ...) and then pass the 2x2 table counts
via arguments 'ai', 'bi', 'ci', 'di' (or the 'event' counts via arguments
'ai' and 'ci' and the group sizes via 'n1i' and 'n2i'). See help(escalc)
and search for "OR".
Best,
Wolfgang
-----Original Message----- From: R-sig-meta-analysis [mailto:
r-sig-meta-analysis-bounces at r-project.org]
On Behalf Of ne gic Sent: Monday, 08 June, 2020 15:09 To: Michael Dewey Cc: r-sig-meta-analysis at r-project.org Subject: Re: [R-meta] Difference in Proportions Meta-Analysis Dear Michael, Thanks. I am using metafor (or rather planning to for this). Initially I had performed two separate single arm meta-analysis of proportion as follows to get an estimate for each of the arms: rma(yi = arm1_prop_plogis, sei = arm1_se, slab=author_year , data=gastric_data, method="REML") rma(yi = arm2_prop_plogis, sei = arm2_se, slab=author_year , data=gastric_data, method="REML") But then it was pointed out that it would be more interesting to meta-analyze the difference in proportions from both arms, and hence my question. So what I have done is: 1. Calculate the raw proportion differences i.e. before using the R function "qlogis" 2. Calculate a single SE from the SE of both arms using the equation provided by Wolfgang. Then the two outputs are what I hope to provide as inputs to rma exactly
as
I had done before for the single arm analysis. Is there a more direct way to do this? or am I missing something? Thanks for your help, Sincerely, nelly On Mon, Jun 8, 2020 at 2:48 PM Michael Dewey <lists at dewey.myzen.co.uk> wrote:
Dear Nelly I am not sure what software you use but both meta and metafor provide analysis of risk differences (which is what differences in proportions are) so you may get what you want directly there. Michael On 08/06/2020 11:36, ne gic wrote:
Dear List, I aim to perform a meta-analysis and present a forest plot of the difference in proportions between two groups. For each group I have proportion and standard error (SE). It's straightforward to get the difference in the proportions, but am
not
sure how to handle the SEs, I presume I can't just subtract them. Is
there
a formula on how to handle SEs? Sincerely, nelly
No, this is not correct. You should not apply the logit-transformation to the difference and the SE is not correct either. You should apply the logit-transformation to the two proportions individually, compute the correct SE of the logit-transformed proportions, take the difference between the two logit-transformed proportions, and then you can use the equation to get the SE of this difference. But all of this can just be done in a single step with escalc(measure="OR", ...). As I mentioned, the difference between two logit-transformed proportions is the log odds ratio. Best, Wolfgang
-----Original Message-----
From: ne gic [mailto:negic4 at gmail.com]
Sent: Monday, 08 June, 2020 18:38
To: Viechtbauer, Wolfgang (SP)
Cc: r-sig-meta-analysis at r-project.org
Subject: Re: [R-meta] Difference in Proportions Meta-Analysis
Sorry, that was a typing mistake:
I transformed the proportions using?qlogis, then back transformed them using
the plogis.
Here is literally what I have done:
On excel:
1. Calculated the difference in proportions between arm1 and arm2 (arm1 -
arm2) to get arm12_prop_diff
2. Used the formula you provided to calculate the "joint" standard error
(se_diff)
In R:
# Import the excel data.
gastric_data$arm12_prop_diff <- as.numeric(gastric_data$arm12_prop_diff)
gastric_data$se_diff <- as.numeric(gastric_data$se_diff)
# Log transformation
gastric_data$arm12_prop_qlogs_diff <- qlogis(gastric_data$arm12_prop_diff)
# fit random-effects model
pes.da=rma(yi = arm12_prop_qlogs_diff, sei = se_diff, slab=author ,
data=gastric_data, method="REML")
forest(pes.da, xlab = "2-year survival difference (%)",
order=order(gastric_data$arm12_prop_diff), atransf=plogis)
Is this still not a reasonable way to go about this?
On Mon, Jun 8, 2020 at 5:27 PM Viechtbauer, Wolfgang (SP)
<wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
I am not sure I really understand what you did. arm1_prop_plogis and
arm2_prop_plogis actually sound like they are plogis()-transformed
proportions, which doesn't make sense (plogis() is the inverse-logit
transformation). The logit transformation is qlogis(). Not sure how you
computed arm1_se and arm2_se. Why not use escalc(measure="PLO", ...), which
will do things correctly for you?
But if you want to compare the two groups within studies directly, then you
need to use measures such as the risk difference (measure="RD"), the log
transformed risk ratio ("RR"), or the log transformed odds ratio ("OR"). In
fact, the difference between two logit-transformed proportions *IS* the log
transformed odds ratio.
So, just use escalc(measure="OR", ...) and then pass the 2x2 table counts
via arguments 'ai', 'bi', 'ci', 'di' (or the 'event' counts via arguments
'ai' and 'ci' and the group sizes via 'n1i' and 'n2i'). See help(escalc) and
search for "OR".
Best,
Wolfgang
-----Original Message----- From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-
project.org]
On Behalf Of ne gic Sent: Monday, 08 June, 2020 15:09 To: Michael Dewey Cc: r-sig-meta-analysis at r-project.org Subject: Re: [R-meta] Difference in Proportions Meta-Analysis Dear Michael, Thanks. I am using metafor (or rather planning to for this). Initially I had performed two separate single arm meta-analysis of proportion as follows to get an estimate for each of the arms: rma(yi = arm1_prop_plogis, sei = arm1_se, slab=author_year , data=gastric_data, method="REML") rma(yi = arm2_prop_plogis, sei = arm2_se, slab=author_year , data=gastric_data, method="REML") But then it was pointed out that it would be more interesting to meta-analyze the difference in proportions from both arms, and hence my question. So what I have done is: ? ?1. Calculate the raw proportion differences i.e. before using the R ? ?function "qlogis" ? ?2. Calculate a single SE from the SE of both arms using the equation ? ?provided by Wolfgang. Then the two outputs are what I hope to provide as inputs to rma exactly as I had done before for the single arm analysis. Is there a more direct way to do this? or am I missing something? Thanks for your help, Sincerely, nelly On Mon, Jun 8, 2020 at 2:48 PM Michael Dewey <lists at dewey.myzen.co.uk> wrote:
Dear Nelly I am not sure what software you use but both meta and metafor provide analysis of risk differences (which is what differences in proportions are) so you may get what you want directly there. Michael On 08/06/2020 11:36, ne gic wrote:
Dear List, I aim to perform a meta-analysis and present a forest plot of the difference in proportions between two groups. For each group I have proportion and standard error (SE). It's straightforward to get the difference in the proportions, but am
not
sure how to handle the SEs, I presume I can't just subtract them. Is
there
a formula on how to handle SEs? Sincerely, nelly
1 day later
Dear Wolfgang, I have taken time to read the entire escalc documentation ( https://wviechtb.github.io/metafor/reference/escalc.html ) and I am sorry to say I don't understand how I can do that in a single step with escalc(measure="OR", ...) as you previously mentioned. I would like to do this correctly following your suggestion so as to minimize any errors as I redo steps that can be done in fewer steps. For each of my two groups I have proportion and standard error. Could you kindly show me how I can do this using one of the available datasets please? Sincerely, nelly On Mon, Jun 8, 2020 at 6:48 PM Viechtbauer, Wolfgang (SP) <
wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
No, this is not correct. You should not apply the logit-transformation to the difference and the SE is not correct either. You should apply the logit-transformation to the two proportions individually, compute the correct SE of the logit-transformed proportions, take the difference between the two logit-transformed proportions, and then you can use the equation to get the SE of this difference. But all of this can just be done in a single step with escalc(measure="OR", ...). As I mentioned, the difference between two logit-transformed proportions is the log odds ratio. Best, Wolfgang
-----Original Message----- From: ne gic [mailto:negic4 at gmail.com] Sent: Monday, 08 June, 2020 18:38 To: Viechtbauer, Wolfgang (SP) Cc: r-sig-meta-analysis at r-project.org Subject: Re: [R-meta] Difference in Proportions Meta-Analysis Sorry, that was a typing mistake: I transformed the proportions using qlogis, then back transformed them
using
the plogis. Here is literally what I have done: On excel: 1. Calculated the difference in proportions between arm1 and arm2 (arm1 - arm2) to get arm12_prop_diff 2. Used the formula you provided to calculate the "joint" standard error (se_diff) In R: # Import the excel data. gastric_data$arm12_prop_diff <- as.numeric(gastric_data$arm12_prop_diff) gastric_data$se_diff <- as.numeric(gastric_data$se_diff) # Log transformation gastric_data$arm12_prop_qlogs_diff <- qlogis(gastric_data$arm12_prop_diff) # fit random-effects model pes.da=rma(yi = arm12_prop_qlogs_diff, sei = se_diff, slab=author , data=gastric_data, method="REML") forest(pes.da, xlab = "2-year survival difference (%)", order=order(gastric_data$arm12_prop_diff), atransf=plogis) Is this still not a reasonable way to go about this? On Mon, Jun 8, 2020 at 5:27 PM Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer at maastrichtuniversity.nl> wrote: I am not sure I really understand what you did. arm1_prop_plogis and arm2_prop_plogis actually sound like they are plogis()-transformed proportions, which doesn't make sense (plogis() is the inverse-logit transformation). The logit transformation is qlogis(). Not sure how you computed arm1_se and arm2_se. Why not use escalc(measure="PLO", ...),
which
will do things correctly for you? But if you want to compare the two groups within studies directly, then
you
need to use measures such as the risk difference (measure="RD"), the log
transformed risk ratio ("RR"), or the log transformed odds ratio ("OR").
In
fact, the difference between two logit-transformed proportions *IS* the
log
transformed odds ratio. So, just use escalc(measure="OR", ...) and then pass the 2x2 table counts via arguments 'ai', 'bi', 'ci', 'di' (or the 'event' counts via arguments 'ai' and 'ci' and the group sizes via 'n1i' and 'n2i'). See help(escalc)
and
search for "OR". Best, Wolfgang
-----Original Message----- From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-
project.org]
On Behalf Of ne gic Sent: Monday, 08 June, 2020 15:09 To: Michael Dewey Cc: r-sig-meta-analysis at r-project.org Subject: Re: [R-meta] Difference in Proportions Meta-Analysis Dear Michael, Thanks. I am using metafor (or rather planning to for this). Initially I had performed two separate single arm meta-analysis of proportion as follows to get an estimate for each of the arms: rma(yi = arm1_prop_plogis, sei = arm1_se, slab=author_year , data=gastric_data, method="REML") rma(yi = arm2_prop_plogis, sei = arm2_se, slab=author_year , data=gastric_data, method="REML") But then it was pointed out that it would be more interesting to meta-analyze the difference in proportions from both arms, and hence my question. So what I have done is: 1. Calculate the raw proportion differences i.e. before using the R function "qlogis" 2. Calculate a single SE from the SE of both arms using the equation provided by Wolfgang. Then the two outputs are what I hope to provide as inputs to rma exactly
as
I had done before for the single arm analysis. Is there a more direct way to do this? or am I missing something? Thanks for your help, Sincerely, nelly On Mon, Jun 8, 2020 at 2:48 PM Michael Dewey <lists at dewey.myzen.co.uk> wrote:
Dear Nelly I am not sure what software you use but both meta and metafor provide analysis of risk differences (which is what differences in proportions are) so you may get what you want directly there. Michael On 08/06/2020 11:36, ne gic wrote:
Dear List, I aim to perform a meta-analysis and present a forest plot of the difference in proportions between two groups. For each group I have proportion and standard error (SE). It's straightforward to get the difference in the proportions, but am
not
sure how to handle the SEs, I presume I can't just subtract them. Is
there
a formula on how to handle SEs? Sincerely, nelly
Hi Nelly, Don't you have the sample size on which the proportions are based? If not, the standard error of a proportion is SE[p] = sqrt[p(1-p)/n], so given p and SE[p], one can easily recover the sample size with n = p(1-p) / SE^2. Do this for both groups. Call the resulting sample sizes n1i and n2i. Also compute the number events with p*n. Do this for both groups. Call the resulting event counts ai and ci. Now you have everything to use escalc(measure="OR", ai, n1i, ci, n2i). Best, Wolfgang
-----Original Message----- From: ne gic [mailto:negic4 at gmail.com] Sent: Wednesday, 10 June, 2020 13:13 To: Viechtbauer, Wolfgang (SP) Cc: r-sig-meta-analysis at r-project.org Subject: Re: [R-meta] Difference in Proportions Meta-Analysis Dear Wolfgang, I have taken time to read the entire?escalc documentation (https://wviechtb.github.io/metafor/reference/escalc.html ) and I am sorry to say I don't understand how I can do that in a single step with escalc(measure="OR", ...) as you previously mentioned. I would like to do this correctly following your suggestion so as to minimize any errors as I redo steps that can be done in fewer steps. For each of my two groups I have proportion and standard error. Could you kindly show me how I can do this using one of the available datasets please? Sincerely, nelly On Mon, Jun 8, 2020 at 6:48 PM Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer at maastrichtuniversity.nl> wrote: No, this is not correct. You should not apply the logit-transformation to the difference and the SE is not correct either. You should apply the logit- transformation to the two proportions individually, compute the correct SE of the logit-transformed proportions, take the difference between the two logit-transformed proportions, and then you can use the equation to get the SE of this difference. But all of this can just be done in a single step with escalc(measure="OR", ...). As I mentioned, the difference between two logit-transformed proportions is the log odds ratio. Best, Wolfgang