AndriSignorell / DescTools

Tools for Descriptive Statistics and Exploratory Data Analysis
http://andrisignorell.github.io/DescTools/
82 stars 18 forks source link

RelRisk() code doesn't match documentation #118

Closed martyoh closed 4 months ago

martyoh commented 1 year ago

Hi.

I think the documentation for the function RelRisk() does not correspond to its code.

Assuming the input is organized as in the documentation, the code (per line 6332 in StatsAndCIs.r) calculates

(n00 / (n00+n01)) / (n10 / (n10+n11))

i.e. ((unexposed&undiseased)/unexposed) / ((exposed&undiseased)/exposed)

I believe relative risk should rather be

((exposed& diseased)/exposed) / ((unexposed&diseased)/unexposed)

cf. https://www.ncbi.nlm.nih.gov/books/NBK430824/

AndriSignorell commented 5 months ago

Thanks for this hint. You're totally right, the documentation was not correct. This will be fixed with 0.99.53.6. You may have a look and close the issue, if ok.

martyoh commented 4 months ago

Great. Thanks!