# [R-meta] Difference in Proportions Meta-Analysis

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Tue Jul 7 22:38:55 CEST 2020

```Dear Nelly,

Looks right. And yes, for an analysis with log odds ratios, just change measure="RR" to measure="OR". The back-transformation is still exp.

Best,
Wolfgang

>-----Original Message-----
>From: ne gic [mailto:negic4 using gmail.com]
>Sent: Monday, 06 July, 2020 17:08
>To: Viechtbauer, Wolfgang (SP)
>Cc: r-sig-meta-analysis using r-project.org
>Subject: Re: [R-meta] Difference in Proportions Meta-Analysis
>
>Dear Wolfgang & list,
>
>This is what I have done, so I cross check with you again.
>
>Following your suggestion, I computed the number events for both groups with
>p*n and called the resulting event counts ai and ci. The n1i and n2i were
>already available from the risk tables.
>
>To get a RR as the measure I did this: Is this correct?
>
>mydat <- escalc(measure="RR", ai = ai, n1i = n1i, ci = ci, n2i = n2i, data =
>bmi_gc, slab=paste(author))
>
>res <- rma(yi, vi, data=mydat, method="REML")
>
>forest(res, digits = 2, atransf = exp )
>
>### add text with Q-value, dfs, p-value, and I^2 statistic
>text(-1, -1, pos=4, cex=0.8, bquote(paste(" (Q = ",
>                                            .(formatC(res\$QE, digits=2,
>format="f")), ", df = ", .(res\$k - res\$p),
>                                            ", p = ", .(formatC(res\$QEp,
>digits=2, format="f")), "; ", I^2, " = ",
>                                            .(formatC(res\$I2, digits=1,
>format="f")), "%)")))
>
>To get an OR as the measure, does it suffice to just change the RR to OR or
>do I need to change e.g. atransf to something else downstream of the code?
>especially the back-transformation.
>
>Apologies if this is trivial or repetitive, but I really haven't got the
>hang of this yet.
>
>Sincerely,
>nelly
>
>On Wed, Jun 10, 2020 at 4:13 PM Viechtbauer, Wolfgang (SP)
><wolfgang.viechtbauer using maastrichtuniversity.nl> wrote:
>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 using gmail.com]
>>Sent: Wednesday, 10 June, 2020 13:13
>>To: Viechtbauer, Wolfgang (SP)
>>Cc: r-sig-meta-analysis using 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
>>
>>Sincerely,
>>nelly
>>
>>On Mon, Jun 8, 2020 at 6:48 PM Viechtbauer, Wolfgang (SP)
>><wolfgang.viechtbauer using 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
```