Package: riskdiff 0.3.0

riskdiff: Risk Difference Estimation with Multiple Link Functions and Inverse Probability of Treatment Weighting

Calculates risk differences (or prevalence differences for cross-sectional data) and Number Needed to Treat (NNT) using generalized linear models with automatic link function selection. Provides robust model fitting with fallback methods, support for stratification and adjustment variables, inverse probability of treatment weighting (IPTW) for causal inference with NNT calculations, and publication-ready output formatting. Handles model convergence issues gracefully and provides confidence intervals using multiple approaches. Methods are based on approaches described in Mark W. Donoghoe and Ian C. Marschner (2018) "logbin: An R Package for Relative Risk Regression Using the Log-Binomial Model" <doi:10.18637/jss.v086.i09> for robust GLM fitting, Peter C. Austin (2011) "An Introduction to Propensity Score Methods for Reducing the Effects of Confounding in Observational Studies" <doi:10.1080/00273171.2011.568786> for IPTW methods, and standard epidemiological methods for risk difference estimation as described in Kenneth J. Rothman, Sander Greenland and Timothy L. Lash (2008, ISBN:9780781755641) "Modern Epidemiology".

Authors:John D. Murphy [aut, cre]

riskdiff_0.3.0.tar.gz
riskdiff_0.3.0.zip(r-4.7)riskdiff_0.3.0.zip(r-4.6)riskdiff_0.3.0.zip(r-4.5)
riskdiff_0.3.0.tgz(r-4.6-any)riskdiff_0.3.0.tgz(r-4.5-any)
riskdiff_0.3.0.tar.gz(r-4.7-any)riskdiff_0.3.0.tar.gz(r-4.6-any)
riskdiff_0.3.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
riskdiff/json (API)

# Install 'riskdiff' in R:
install.packages('riskdiff', repos = c('https://jackmurphy2351.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/jackmurphy2351/riskdiff/issues

Datasets:

On CRAN:

Conda:

biostatisticsepidemiologypublic-health

5.53 score 2 stars 21 scripts 243 downloads 12 exports 28 dependencies

Last updated from:e229bdce16. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK179
source / vignettesOK203
linux-release-x86_64OK181
macos-release-arm64OK183
macos-oldrel-arm64OK266
windows-develOK130
windows-releaseOK150
windows-oldrelOK151
wasm-releaseOK114

Exports:calc_iptw_weightscalc_risk_diffcalc_risk_diff_iptwcheck_iptw_assumptionscreate_balance_plotscreate_forest_plotcreate_rd_tablecreate_simple_tablecreate_summary_tableformat_risk_diffget_quality_legendget_valid_boundary_types

Dependencies:clicpp11dplyrfarvergenericsggplot2gluegtableisobandlabelinglifecyclemagrittrpillarpkgconfigpurrrR6RColorBrewerrlangS7scalesstringistringrtibbletidyselectutf8vctrsviridisLitewithr

Causal Inference with IPTW in riskdiff
Introduction | When to Use IPTW | Key Assumptions | Basic IPTW Analysis | Step 1: Calculate IPTW Weights | Step 2: Check IPTW Assumptions | Step 3: Visualize Balance | Step 4: Estimate Causal Risk Difference | Different Types of Causal Effects | Average Treatment Effect (ATE) | Average Treatment Effect on the Treated (ATT) | Average Treatment Effect on the Controls (ATC) | Causal Number Needed to Treat | NNT for Different Causal Estimands | Advanced Options | Bootstrap Confidence Intervals | Different Propensity Score Models | Weight Stabilization and Trimming | Troubleshooting Common Issues | Poor Balance | Extreme Propensity Scores | Model Specification | Sensitivity Analysis | Best Practices | Reporting IPTW Results | Conclusion | References

Last update: 2025-09-30
Started: 2025-06-22

Getting Started with Risk Differences
Why Risk Differences Matter in Public Health | Understanding the Example Data | Your First Risk Difference Analysis | Understanding the Output | Interpreting Risk Differences | Adjusted Analyses | Stratified Analysis | Visualizing Your Results | Number Needed to Treat (NNT) | Common Pitfalls and Solutions | 1. Model Convergence Issues | 2. Very Rare Outcomes | 3. Missing Data | Quick Reference | Basic Syntax | Interpretation Guide | When to Use Risk Differences | Next Steps | Getting Help

Last update: 2025-09-30
Started: 2025-06-22

complete-example

Last update: 2025-06-22
Started: 2025-06-22

technical-details

Last update: 2025-06-22
Started: 2025-06-22