How to calculate relative risk in R?
In input i have
The 5% increase in absolute risk - from 10% to 15% - is a 50% relative risk increase because you divide 5% by 10% (.05 ÷.10 =.50, or 50%). In other words, relative to the 10% absolute risk, the 15% absolute risk is 50% higher. You can say that using bleach results in a 50% increase in relative risk. Even though the relative risk increases. Relative Risk and Odds Ratios: Examples Calculating Relative Risk Calculating Relative Risk Imagine that the incidence of gun violence is compared in two cities, one with relaxed gun laws (A), the other with strict gun laws (B). In the city with relaxed gun laws, there were 50 shootings in a.
I am new in R programming language...
migrated from stats.stackexchange.comDec 21 '14 at 20:16
This question came from our site for people interested in statistics, machine learning, data analysis, data mining, and data visualization.
1 Answer
This is a fairly straightforward calculation; the relative risk is just (pos1/total1)/(pos2/total2)
where pos1
is the number of cases in the first group, pos2
in the second group, and the total
variables are the group totals
However, you're probably interested in the epitab
function of the epitools
package:
See ?epicalc
for input formats, but this should work for your example:
You should of course double-check that the results make sense; e.g. p0
is 4/20=0.2 for the first group, 40/208=0.192 for the second group. The risk ratio is ((16/20)/(168/208))=0.8/0.8076=1.009.
Not the answer you're looking for? Browse other questions tagged r or ask your own question.
In epidemiology, the relative risk reduction (RRR) or efficacy is the relative decrease in the risk of an adverse event in the exposed group compared to an unexposed group. It is computed as , where is the incidence in the exposed group, and is the incidence in the unexposed group. If the risk of an adverse event is increased by the exposure rather than decreased, term relative risk increase (RRI) is used, and computed as .[1][2] If the direction of risk change is not assumed, a term relative effect is used and computed as .[3]
- 1Numerical examples
Numerical examples[edit]
Risk reduction[edit]
![Realtive Realtive](https://www.researchgate.net/profile/Jay_Hertel/publication/23138534/figure/fig2/AS:277561252429859@1443187167752/Relative-risk-increase-or-relative-risk-reduction-demonstrated-by-the-7-studies-Hewson_Q320.jpg)
Example of risk reduction | |||
---|---|---|---|
Experimental group (E) | Control group (C) | Total | |
Events (E) | EE = 15 | CE = 100 | 115 |
Non-events (N) | EN = 135 | CN = 150 | 285 |
Total subjects (S) | ES = EE + EN = 150 | CS = CE + CN = 250 | 400 |
Event rate (ER) | EER = EE / ES = 0.1, or 10% | CER = CE / CS = 0.4, or 40% |
Equation | Variable | Abbr. | Value |
---|---|---|---|
CER - EER | absolute risk reduction | ARR | 0.3, or 30% |
(CER - EER) / CER | relative risk reduction | RRR | 0.75, or 75% |
1 / (CER − EER) | number needed to treat | NNT | 3.33 |
EER / CER | risk ratio | RR | 0.25 |
(EE / EN) / (CE / CN) | odds ratio | OR | 0.167 |
(CER - EER) / CER | preventable fraction among the unexposed | PFu | 0.75 |
Risk increase[edit]
Example of risk increase | |||
---|---|---|---|
Experimental group (E) | Control group (C) | Total | |
Events (E) | EE = 75 | CE = 100 | 115 |
Non-events (N) | EN = 75 | CN = 150 | 285 |
Total subjects (S) | ES = EE + EN = 150 | CS = CE + CN = 250 | 400 |
Event rate (ER) | EER = EE / ES = 0.5, or 50% | CER = CE / CS = 0.4, or 40% |
Equation | Variable | Abbr. | Value |
---|---|---|---|
EER − CER | absolute risk increase | ARI | 0.1, or 10% |
(EER − CER) / CER | relative risk increase | RRI | 0.25, or 25% |
1 / (EER − CER) | number needed to harm | NNH | 10 |
EER / CER | risk ratio | RR | 1.25 |
(EE / EN) / (CE / CN) | odds ratio | OR | 1.5 |
(EER − CER) / EER | attributable fraction among the exposed | AFe | 0.2 |
See also[edit]
References[edit]
- ^'Dictionary of Epidemiology - Oxford Reference'. doi:10.1093/acref/9780199976720.001.0001. Retrieved 2018-05-09.
- ^Szklo, Moyses; Nieto, F. Javier (2019). Epidemiology : beyond the basics (4th. ed.). Burlington, Massachusetts: Jones & Bartlett Learning. p. 97. ISBN9781284116595. OCLC1019839414.
- ^J., Rothman, Kenneth (2012). Epidemiology : an introduction (2nd ed.). New York, NY: Oxford University Press. p. 59. ISBN9780199754557. OCLC750986180.