or2rr: Transform OR to RR

Description Usage Arguments Details Value Author(s) References Examples

View source: R/or2rr.R

Description

The function transforms a given odds-ratio (OR) to the respective relative risk (RR).

Usage

1
or2rr(or, p0, p1)

Arguments

or

numeric vector: OR (odds-ratio).

p0

numeric vector of length 1: incidence of the outcome of interest in the nonexposed group.

p1

numeric vector of length 1: incidence of the outcome of interest in the exposed group.

Details

The function transforms a given odds-ratio (OR) to the respective relative risk (RR). It can also be used to transform the limits of confidence intervals.

The formulas can be derived by combining the formulas for RR and OR; see also Zhang and Yu (1998).

Value

relative risk.

Author(s)

Matthias Kohl Matthias.Kohl@stamats.de

References

Zhang, J. and Yu, K. F. (1998). What's the relative risk? A method of correcting the odds ratio in cohort studies of common outcomes. JAMA, 280(19):1690-1691.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## We use data from Zhang and Yu (1998)

## OR to RR using OR and p0
or2rr(14.1, 0.05)

## compute p1
or2rr(14.1, 0.05)*0.05

## OR to RR using OR and p1
or2rr(14.1, p1 = 0.426)

## OR and 95% confidence interval
or2rr(c(14.1, 7.8, 27.5), 0.05)

## Logistic OR and 95% confidence interval
logisticOR <- rbind(c(14.1, 7.8, 27.5),
                    c(8.7, 5.5, 14.3),
                    c(27.4, 17.2, 45.8),
                    c(4.5, 2.7, 7.8),
                    c(0.25, 0.17, 0.37),
                    c(0.09, 0.05, 0.14))
colnames(logisticOR) <- c("OR", "2.5%", "97.5%")
rownames(logisticOR) <- c("7.4", "4.2", "3.0", "2.0", "0.37", "0.14")
logisticOR

## p0
p0 <- c(0.05, 0.12, 0.32, 0.27, 0.40, 0.40)

## Compute corrected RR
## helper function
or2rr.mat <- function(or, p0){
  res <- matrix(NA, nrow = nrow(or), ncol = ncol(or))
  for(i in seq_len(nrow(or)))
    res[i,] <- or2rr(or[i,], p0[i])
  dimnames(res) <- dimnames(or)
  res
}
RR <- or2rr.mat(logisticOR, p0)
round(RR, 2)

## Results are not completely identical to Zhang and Yu (1998)
## what probably is caused by the fact that the logistic OR values
## provided in the table are rounded and are not exact values.

Example output

[1] 8.519637
[1] 0.4259819
[1] 8.5194
[1]  8.519637  5.820896 11.827957
        OR  2.5% 97.5%
7.4  14.10  7.80 27.50
4.2   8.70  5.50 14.30
3.0  27.40 17.20 45.80
2.0   4.50  2.70  7.80
0.37  0.25  0.17  0.37
0.14  0.09  0.05  0.14
       OR 2.5% 97.5%
7.4  8.52 5.82 11.83
4.2  4.52 3.57  5.51
3.0  2.90 2.78  2.99
2.0  2.31 1.85  2.75
0.37 0.36 0.25  0.49
0.14 0.14 0.08  0.21

MKmisc documentation built on Aug. 8, 2021, 5:06 p.m.