[R-meta] "Favours experimental/vaccinated", "Favours control" - Metafor

Michael Dewey ||@t@ @end|ng |rom dewey@myzen@co@uk
Wed Nov 1 14:49:58 CET 2023


Dear Andrzej

I am afraid your post and the calculation shows that you have not 
understood what meta-analysis is trying to do. Aggregating the values in 
each column and computing log(RR) is not what meta-analysis does.

I think you need to go back to the tutorial material you used when 
learning about meta-analysis and re-read it as otherwise you are in 
danger of mis-leading yourself again.

Michael

On 01/11/2023 07:55, Andrzej Andrzej via R-sig-meta-analysis wrote:
> Hi,
> Why when I calculated log(RR) by hand (still using bcg data):
> 
> library(metafor)
> # Define the data
> tpos <- sum(dat.bcg$tpos)
> tneg <- sum(dat.bcg$tneg)
> cpos <- sum(dat.bcg$cpos)
> cneg <- sum(dat.bcg$cneg)
> # Calculate RR
> RR <- (tpos / (tpos + tneg)) / (cpos / (cpos + cneg))
> # Calculate log RR
> log_RR <- log(RR)
> 
> log((1065 / (1065 + 189999)) / (1510 / (1510 + 164773)))   equals to
> -0.4880521,
> but doing everything like in your tutorial (escalc, rma, forest) ), it
> gives me value of -0.71, that is displayed under forest plot in RE Model
> row ?
> Why is the difference ? What am I missing ?
> https://wviechtb.github.io/metafor/reference/forest.rma.html
> best regards,
> Andrzej
> 
> pon., 30 paź 2023 o 19:06 Viechtbauer, Wolfgang (NP) <
> wolfgang.viechtbauer using maastrichtuniversity.nl> napisał(a):
> 
>> That would give you the log odds ratio, not risk ratio.
>>
>> But to shortcut the next 4-5 messages going back and forth:
>>
>> Once you have figured out the correct equation for the log risk ratio,
>> then start replacing Group 1 and Group 2 and Outcome 1 and Outcome 2 with
>> the appropriate values from the BCG dataset (or whatever dataset you are
>> working with).
>>
>> Then think about what a positive value for log(RR) would imply about the
>> probability of Outcome 1 in Group 1 relative to that of Group 2.
>>
>> Best,
>> Wolfgang
>>
>>> -----Original Message-----
>>> From: Andrzej Andrzej <xaf3111.developers using gmail.com>
>>> Sent: Monday, October 30, 2023 18:58
>>> To: Viechtbauer, Wolfgang (NP) <
>> wolfgang.viechtbauer using maastrichtuniversity.nl>
>>> Cc: R Special Interest Group for Meta-Analysis <r-sig-meta-analysis using r-
>>> project.org>
>>> Subject: Re: [R-meta] "Favours experimental/vaccinated", "Favours
>> control" -
>>> Metafor
>>>
>>> Here is the code for it:
>>> log_rr <- log((a/b)/(c/d))
>>> kind regards,
>>> Andrzej
>>>
>>> pon., 30 paź 2023 o 18:26 Viechtbauer, Wolfgang (NP)
>>> <mailto:wolfgang.viechtbauer using maastrichtuniversity.nl> napisał(a):
>>> At this point, I would like to turn around the question:
>>>
>>> How do you think a log risk ratio is computed in a table of the form:
>>>
>>>            Outcome 1   Outcome 2
>>> Group 1   a           b
>>> Group 2   c           d
>>>
>>> where a, b, c, and d are the counts for the respective cells?
>>>
>>> Best,
>>> Wolfgang
>>>
>>>> -----Original Message-----
>>>> From: Andrzej Andrzej <mailto:xaf3111.developers using gmail.com>
>>>> Sent: Monday, October 30, 2023 17:09
>>>> To: Viechtbauer, Wolfgang (NP)
>>> <mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>
>>>> Cc: R Special Interest Group for Meta-Analysis <r-sig-meta-analysis using r-
>>>> http://project.org>
>>>> Subject: Re: [R-meta] "Favours experimental/vaccinated", "Favours
>> control" -
>>>> Metafor
>>>>
>>>> Dear Wolfgang,
>>>> Thank you for your kind reply.
>>>> How is that ?
>>>> 1. "Since a low 'TB positive' count is desirable, a negative log risk
>> ratio
>>>> therefore indicates that the results of a study favor the vaccinated
>> group."
>>>> This is perfectly clear to me, but this next one, I quote:
>>>> 2. "In this case, a positive log risk ratio would indicate that the
>> results
>>>> favor the vaccinated group."
>>>> Whether log(RR) is negative or positive, the vaccinated group is
>> favoured
>>> anyway
>>>> ?
>>>> I do not understand this, please clarify.
>>>> best,
>>>> Andrzej
>>>>
>>>> pon., 30 paź 2023 o 15:46 Viechtbauer, Wolfgang (NP)
>>>> <mailto:mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>
>> napisał(a):
>>>> Dear Andrzej,
>>>>
>>>> In this example, the 2x2 table is of the form as shown here:
>>>>
>>>> https://wviechtb.github.io/metadat/reference/dat.bcg.html#details-1
>>>>
>>>> Since a low 'TB positive' count is desirable, a negative log risk ratio
>>>> therefore indicates that the results of a study favor the vaccinated
>> group.
>>>>
>>>> But one could just as well have computed the log risk ratios with:
>>>>
>>>> dat <- escalc(measure="RR", ai=cpos, bi=cneg,
>>>>                              ci=tpos, ti=tneg, data=dat)
>>>>
>>>> In this case, a positive log risk ratio would indicate that the
>> results favor
>>>> the vaccinated group.
>>>>
>>>> So, one really has to understand what is being computed and whether
>> positive
>>> or
>>>> negative values indicate which group is being favored.
>>>>
>>>> Best,
>>>> Wolfgang
>>>>
>>>>> -----Original Message-----
>>>>> From: R-sig-meta-analysis <mailto:mailto
>> :r-sig-meta-analysis-bounces using r-
>>> project.org>
>>>> On Behalf
>>>>> Of Andrzej Andrzej via R-sig-meta-analysis
>>>>> Sent: Sunday, October 29, 2023 18:25
>>>>> To: Michael Dewey <mailto:mailto:lists using dewey.myzen.co.uk>
>>>>> Cc: Andrzej Andrzej <mailto:mailto:xaf3111.developers using gmail.com>; R
>> Special
>>> Interest
>>>> Group for
>>>>> Meta-Analysis <mailto:mailto:r-sig-meta-analysis using r-project.org>
>>>>> Subject: Re: [R-meta] "Favours experimental/vaccinated", "Favours
>> control" -
>>>>> Metafor
>>>>>
>>>>> Thank you Michael,
>>>>> Yes, I do not know how to quote here, but I try:
>>>>> 1. "Do you mean whether to type   c("Favors control","Favors
>> experimental")
>>>>> or  c("Favors experimental", "Favors control")?"
>>>>> Yes, exactly I do mean that.
>>>>>
>>>>> 2. "If so the answer is that when you computed the effect size you
>> knew
>>>>> whetheh high values favoured experimental and so would be on the
>> right
>>>>> of the plot (the first option) or vice versa"
>>>>> Could you please guide me with explanation based on this code and WV
>> data,
>>>>> please:
>>>>> https://wviechtb.github.io/metadat/reference/dat.bcg.html
>>>>>
>>>>> library(metafor)
>>>>> data(dat.bcg)
>>>>> dat <- dat.bcg
>>>>>
>>>>> ### calculate log risk ratios and corresponding sampling variances
>>>>> dat <- escalc(measure="RR", ai=tpos, bi=tneg,
>>>>>                              ci=cpos, di=cneg, data=dat,
>>>>>                              slab=paste0(author, ", ", year))
>>>>> ### random-effects model
>>>>> res <- rma(yi, vi, data=dat)
>>>>> forest(res, addpred=TRUE, xlim=c(-16,7), at=seq(-3,2,by=1),
>> shade="zebra",
>>>>>         ilab=cbind(tpos, tneg, cpos, cneg),
>> ilab.xpos=c(-9.5,-8,-6,-4.5),
>>>>>         cex=0.75, header="Author(s) and Year")
>>>>> text(c(-9.5,-8,-6,-4.5), res$k+2, c("TB+", "TB-", "TB+", "TB-"),
>> cex=0.75,
>>>>> font=2)
>>>>> text(c(-8.75,-5.25),     res$k+3, c("Vaccinated", "Control"),
>> cex=0.75,
>>>>> font=2)
>>>>>
>>>>> 3. "whetheh high values favoured experimental and so would be on the
>> right
>>>>> of the plot (the first option) or vice versa"
>>>>> Could you please explain using that forest plot and bcg.data, where
>> are
>>>>> those higher values (in which group) so how should I label Log Risk
>> Ratio X
>>>>> axis according to RevMan 5 style with " Favours control" and "Favours
>>>>> vaccinated" ? I want to understand which way is correct, please.
>>>>> best regards,
>>>>> Andrzej
>>
> 
> 	[[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



More information about the R-sig-meta-analysis mailing list