Background
When we calculate risk ratio, we divide the risk in one group with the risk of another group in the following manner (note: Group A versus Group B):
\[\begin{align*} Risk \, Ratio \, (RR) = \frac{risk_{A}}{risk_{B}} \end{align*}\]
But what about trying to estimate the ratio of the risk ratio?
\[\begin{align*} Ratio \, of \, Risk \, Ratio \, (RRR) = \frac{\frac{risk_{A}}{risk_{B}}}{\frac{risk_{C}}{risk_{D}}} \end{align*}\]
In other words, can we perform an estimation where we compare one risk ratio with another risk ratio?
The answer is, “Yes!” But it will requires some work on our part. As of the writing of this tutorial, I was unable to find an R package for doing this. However, David Altman and Martin Bland wrote a paper (link) that provides detailed instructions on how to do this.
Figure 1 - Table from Altman and Bland’s paper.
Motivating example
Let’s suppose we have a situation where there is a program that was
implemented, and we want to see whether the risk of events are different
before and after implementing the program. The first group
(EXP
) is the experimental arm that implemented the program.
The second group (CONTROL
) is the control arm that did not
implement the program.
Here is the data:
Figure 2 - Number of events before and after implementation for two groups.
The risk ratio for the EXP
group is 1.18. The proportion
of cases in the EXP
group is 1.1% (500 / 4500) in the
pre-period.
The risk ratio for the CONTROL
group is 1.20. The
proportion of cases in the CONTROL
group is 22.0% (330 /
1500) in the pre-period.
We want to know whether the risk ratio for the EXP
group
is statistically different from the risk ratio for the
CONTROL
group.
Step 1: Enter the data
We will use epitools
package to perform some of our
analysis.
First, we’ll need to enter the data as a matrix for the
EXP
and CONTROL
groups. Make sure to follow
the order of the values entered into the matrix. This will impact the
results.
#### NOTE
## See Altman's paper on RRR
## Citation: BMJ 2003;326:219
## URL:https://www.bmj.com/content/bmj/326/7382/219.full.pdf
## Load library
library("epitools")
#### STEP 1 - Enter data into a Matrix and estimate RR for each group:
#### CONTROL RR - Group 1
control_matrix <- matrix(
c(567, 41933, 500, 44500),
2,
2,
byrow = TRUE)
control_matrix
## [,1] [,2]
## [1,] 567 41933
## [2,] 500 44500
#### RR for Group 1
rr_control <- riskratio(control_matrix, rev = "b")
rr_control
## $data
## Outcome
## Predictor Disease2 Disease1 Total
## Exposed2 44500 500 45000
## Exposed1 41933 567 42500
## Total 86433 1067 87500
##
## $measure
## risk ratio with 95% C.I.
## Predictor estimate lower upper
## Exposed2 1.000000 NA NA
## Exposed1 1.200706 1.065454 1.353127
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## Exposed2 NA NA NA
## Exposed1 0.002681076 0.002786231 0.002664529
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
#### EXP RR - Group 2
exp_matrix <- matrix(
c(350, 1000, 330, 1170),
2,
2,
byrow = TRUE)
exp_matrix
## [,1] [,2]
## [1,] 350 1000
## [2,] 330 1170
#### RR for Group 2
rr_exp <- riskratio(exp_matrix, rev = "b")
rr_exp
## $data
## Outcome
## Predictor Disease2 Disease1 Total
## Exposed2 1170 330 1500
## Exposed1 1000 350 1350
## Total 2170 680 2850
##
## $measure
## risk ratio with 95% C.I.
## Predictor estimate lower upper
## Exposed2 1.000000 NA NA
## Exposed1 1.178451 1.033566 1.343647
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## Exposed2 NA NA NA
## Exposed1 0.0142166 0.01546824 0.01407933
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
Step 2: Estimate the standard error
Estimate the standard error using the method provided by Altman and Bland (doi: 10.1136/bmj.326.7382.219).
#### STEP 2 - Estimate the parameters for the Ratio of RR (RRR):
###### CONTROL RR
log_rr_control <- log(rr_control$measure[2,1]) ## log of RR
log_ll_control <- log(rr_control$measure[2,2]) ## log of LL
log_ul_control <- log(rr_control$measure[2,3]) ## log of UL
log_diff_control <- log_ul_control - log_ll_control
se_control <- log_diff_control*sqrt(2*1.96)
###### EXP RR
log_rr_exp <- log(rr_exp$measure[2,1]) ## log of RR
log_ll_exp <- log(rr_exp$measure[2,2]) ## log of LL
log_ul_exp <- log(rr_exp$measure[2,3]) ## log of UL
log_diff_exp <- log_ul_exp - log_ll_exp
se_exp <- log_diff_exp*sqrt(2*1.96)
Step 3: Estimate the lower and upper bounds of the 95% confidence interval (CI)
Using the methods from Altman and Bland (doi: 10.1136/bmj.326.7382.219), estimate the upper and lower bounds of the 95% CI.
##### Difference in log RR between Site and National
diff_logrr <- log_rr_exp - log_rr_control
diff_se <- sqrt((se_control^2) + (se_exp^2))
ci_ul <- diff_logrr + 1.96*diff_se
ci_ll <- diff_logrr - 1.96*diff_se
##### Ratio of RR (RRR)
rrr <- exp(diff_logrr)
rrr
## [1] 0.9814653
##### 95% CI for RRR
rrr_ul <- exp(ci_ul)
rrr_ll <- exp(ci_ll)
#### Test of interaction (P-value)
z_score <- diff_logrr / diff_se
p_value <- 2*pnorm(q = abs(z_score), lower.tail = FALSE)
Step 4: Generate the final results
Once the 95% CI have been estimated, you can generate the final output.
#### Print summary
print(round(cbind(rrr, rrr_ll, rrr_ul, p_value), 3))
## rrr rrr_ll rrr_ul p_value
## [1,] 0.981 0.248 3.891 0.979
Summary
The final results are presented in the following table:
Table - Risk difference, risk ratio, and ratio of risk ratios (RRR).
Although there is no R
package to statistically evaluate
the ratio of risk ratios (RRR), you can perform this analysis using the
method provided by Altman and Bland (doi: 10.1136/bmj.326.7382.219).
Note: I used a pre-post example, but there is the issue of autocorrelation between the pre-period and post-period. I ignored this for this example, but we need to actually think carefully about this issue when we perform this type of analysis.
Reference
Altman DG, Bland JM. Interaction revisited: the difference between two estimates. BMJ. 2003 Jan 25;326(7382):219. doi: 10.1136/bmj.326.7382.219. PMID: 12543843; PMCID: PMC1125071.
There is a website site that will perform this estimation. David J R Hutchon has developed an online calculator (link) that will estimate the Ratio or Risk Ratio (RRR).
Dislosure and Disclaimer
This is a work in process.
This is for educational use only.