Atlas
statminds
Categorical Effect (Risk-Ratio Model)The underlying model family class (e.g. GLM, linear model, categorical matrix, log-linear).Parametric ReferenceStatistical methods that assume a specific probability distribution family (typically normal).12-stage workflow

Relative Risk (RR) Test

The engine for Incidence Discovery. Relative Risk (RR) audits the ratio of probabilities between two groups, revealing the definitive change in event-likelihood across prospective trajectories.

Model familyCategorical Effect (Risk-Ratio Model)
Hypothesistwo-tailed (can be one-tailed for directional hypotheses)
AliasesRR Test · Risk Ratio · Incidence Ratio Audit
G1
Incidence Audit
Determine if the probability of an outcome significantly differs between treatment and control groups.
G2
Temporal Risk Mapping
Quantify how much an intervention 'Increases' or 'Decreases' the likelihood of future events.
G3
Prospective Signal Isolation
Isolate the true incidence ratio in cohort studies and clinical trials where the total group N is known.
Visual Overview Dashboard
1

What is it?

Relative Risk (RR) Test is a specialized statistical test used to evaluate proportions, multivariate mean vectors, or clinical equivalence margins.

The engine for Incidence Discovery. Relative Risk (RR) audits the ratio of probabilities between two groups, revealing the definitive change in event-likelihood across prospective trajectories.

2

Goals & Indications

  • Incidence Audit: Determine if the probability of an outcome significantly differs between treatment and control groups.
  • Temporal Risk Mapping: Quantify how much an intervention 'Increases' or 'Decreases' the likelihood of future events.
  • Prospective Signal Isolation: Isolate the true incidence ratio in cohort studies and clinical trials where the total group N is known.
3

Core Idea Diagram

EstimateEquivalence Zone
4

Claims tested

H₀: H₀: RR = 1 (no association; risk is equal in both groups)
Hₐ: Hₐ: RR ≠ 1 (association exists; risk differs between exposed and unexposed groups)
5

How it works

  1. Construct 2x2 contingency table for prospective cohort counts.
  2. Calculate risk in exposed a/(a+b) and unexposed c/(c+d).
  3. Compute relative risk: RR = Risk_exposed / Risk_unexposed.
  4. Evaluate log-RR standard error and confidence bounds.
6

Assumptions

Independence of observations: Each subject contributes one observation
Prospective, cohort, or RCT design: Study design allows incidence calculation
Incidence data: Outcome is incident cases, not existing cases
7

Important Note

RR = [a/(a+b)] / [c/(c+d)] from 2×2 table with prospective data. RR > 1 indicates increased risk in exposed group; RR < 1 indicates decreased risk. RR is more interpretable than OR when outcome incidence is known. Confidence interval excluding 1.0 indicates statistical significance at α level.

8

Worked Example

MetricEstimatep-value
Test Statistic3.120.015

Relative Risk (RR) Cohort Laboratory

Relative Risk measures the ratio of event probabilities between exposed and unexposed cohorts in prospective/RCT designs.

The 12-Stage Precision Workflow
01Risk Parity
Hypotheses
We test the null of 'Risk Unity' (RR = 1.0) against the discovery of a non-zero shift in population incidence.
02Prospective Design
Assumptions
The ultimate prerequisite: RR is only valid for cohort or experimental designs where the total 'At-Risk' pool is observed over time.
03Incidence Density
Diagnostics
Auditing the 'Base Rate' of the event—RR is highly intuitive for common events where Odds Ratios become misleading.
04focus
Testing the risk of 'Flare-up' in FlowMotion practitioners vs. Usual Care over a 6-month prospective window.
05Odds Ratio Pivot
Alternatives
Knowing when to switch to Odds Ratios if you are working with retrospective 'Case-Control' data where group totals are arbitrary.
06Log-Risk Strike
Significance
Reporting the 95% Confidence Interval for the ratio—if 1.0 is excluded, the incidence shift is mathematically verified.
07Risk Percentage
Effect Size
Interpreting RR: 1.2 indicates a 20% increase in risk; 0.8 indicates a 20% reduction in risk compared to control.
08Event Stability
Sample Size
Calculating the N required to ensure the incidence estimates are stable enough to produce a tight, authoritative confidence interval.
09The Incidence Narrative
Reporting
Reporting RR and CI: 'FlowMotion reduced the risk of re-injury by 40% (RR = 0.60, 95% CI [0.45, 0.80]).'
10epitools / riskratio
Software
Executing 'riskratio()' commands, ensuring the rows and columns represent 'Exposed' and 'Outcome' correctly.
11focus
The fatal error of reporting RR for Case-Control studies—a mathematical impossibility that invalidates the entire manuscript.
12focus
Tracing the model back to the mid-century evolution of cohort-study forensics and the formalization of clinical trial metrics.
01Hypothesis test logic

Hypotheses

Pragmatic null and alternative hypotheses defined in mathematical notation.

A hypothesis is a question sharpened to a point. Ambiguity is the enemy of inference.
Logic Core
Null · H₀

H₀: RR = 1 (no association; risk is equal in both groups)

Alternative · Hₐ

Hₐ: RR ≠ 1 (association exists; risk differs between exposed and unexposed groups)

Why it matters two-tailed (can be one-tailed for directional hypotheses)

RR = [a/(a+b)] / [c/(c+d)] from 2×2 table with prospective data. RR > 1 indicates increased risk in exposed group; RR < 1 indicates decreased risk. RR is more interpretable than OR when outcome incidence is known. Confidence interval excluding 1.0 indicates statistical significance at α level.

02Model diagnostics

Assumptions

The core mathematical criteria needed to ensure that statistical testing remains unbiased and valid.

Build your analysis on rock, not sand. Verify the mathematical foundation before building the model.
Integrity Shield
7
Assumptions
5
Critical / High Severity
How to check
Quick
Verify study design: confirm no repeated measures on same subjects; check for family/site clustering; review sampling design for independence
Rigorous
Calculate intraclass correlation (ICC) if clustering suspected; verify each subject ID appears only once; check for correlation in exposure-outcome pairs within clusters; review study protocol for randomization or stratified sampling
If violated
If clustered data (e.g., patients within hospitals, siblings within families) → use GEE (generalized estimating equations) with log-binomial model and exchangeable correlation structure, or use mixed-effects log-binomial model with random effects for clusters. If repeated measures → use GEE with subject-level correlation structure. If matched cohort → use conditional models or stratified analysis. Clustered data inflates Type I error if ignored
How to check
Quick
Verify study design: Cohort/RCT samples by exposure status (exposed/unexposed) and follows forward in time to measure outcome incidence. Case-control samples by outcome status retrospectively. Check if denominators (person-time or total at risk) are known for exposed and unexposed groups
Rigorous
Review study protocol: confirm sampling scheme was by exposure (not outcome); verify follow-up period documented; check if incidence rates or cumulative incidence are calculable. If prevalence data only (cross-sectional), RR may overestimate true incidence RR
If violated
If case-control design → CANNOT calculate RR; use odds ratio (OR) instead. Case-control sampling fixes outcome marginals, making incidence unknowable. If cross-sectional (prevalence data) → technically prevalence ratio (PR), not incidence RR; PR may overestimate incidence RR if outcome is common or chronic. If retrospective cohort with full exposure history → RR is valid if sampling was by exposure. State design clearly when reporting RR
odds ratio testlogistic regression
How to check
Quick
Verify outcome definition: incidence counts new cases developing during follow-up period in initially disease-free cohort. Prevalence counts existing cases at a single time point (includes old + new cases). Check if baseline screening excluded prevalent cases
Rigorous
Review study methods: confirm (1) baseline assessment excluded prevalent cases; (2) follow-up period defined; (3) outcomes are incident events (first occurrence). If survival analysis used, confirm outcome is time-to-first-event, not status at one time point. Cross-sectional designs measure prevalence, not incidence
If violated
If prevalence data (cross-sectional) → report as prevalence ratio (PR), not incidence RR. PR conflates incidence rate with disease duration; PR > RR when disease is chronic. If retrospective cohort without baseline disease status → acknowledge inability to distinguish incident vs prevalent cases. If mixture of incident and prevalent cases → restrict analysis to incident cases only or use survival analysis (hazard ratio) to handle varying follow-up
How to check
Quick
Verify study design ensures exposure was measured before outcome occurred: cohort/RCT measures exposure at baseline then follows for outcome. Check if exposure could be consequence of early disease (protopathic bias). Review timeline in study protocol
Rigorous
Examine temporal ordering: (1) Exposure measured at baseline before outcome onset; (2) Baseline assessment excluded subclinical disease; (3) Exposure not modified by early symptoms. For time-varying exposures, use landmark analysis or time-dependent covariates in Cox models. If exposure-outcome order unclear, causal interpretation invalid
If violated
If cross-sectional → exposure and outcome measured simultaneously; temporal sequence unknowable; report as association only, not causal effect. If reverse causation plausible (e.g., depression → unemployment vs unemployment → depression) → use longitudinal data with lagged exposures, instrumental variables, or Mendelian randomization. If subclinical disease influenced baseline exposure → exclude participants with prevalent disease or early outcomes (<6 months). Never claim causality without clear temporal precedence
How to check
Quick
Check outcome frequency: ideally ≥5 events per cell (exposed/outcome, exposed/no-outcome, unexposed/outcome, unexposed/no-outcome). Very rare outcomes (<1%) yield wide CIs and unstable estimates. Calculate total events in each exposure group
Rigorous
Examine confidence interval width: extremely wide CI (e.g., RR 95% CI [0.3, 15.0]) indicates insufficient precision. Check if outcome is rare relative to sample size. Use exact methods (Fisher's exact) if total events < 10. For very rare outcomes, consider using incidence rate ratios with person-time denominators (Poisson regression) instead of cumulative incidence RR
If violated
If very few events (total < 10): (1) Use exact confidence intervals (mid-p or Fisher's exact); (2) Report point estimate with caution and wide CI; (3) Acknowledge limited precision. If rare outcome: (1) Use Poisson regression with offset for person-time (incidence rate ratio, IRR); (2) Increase sample size or extend follow-up; (3) Pool with other studies in meta-analysis. If zero cells, consider continuity correction (+0.5) or exact methods. Never over-interpret RR with < 5 events per exposure group
poisson regressionnegative binomial regressionfisher exact
How to check
Quick
Identify potential confounders: variables associated with both exposure and outcome but not on causal pathway. Use DAG (directed acyclic graph) to visualize relationships. Check if known confounders (age, sex, smoking, etc.) were measured and adjusted
Rigorous
Compare crude vs adjusted RR: if RR changes substantially (>10-15%) after adjustment, confounding present. Use multivariable log-binomial or modified Poisson regression to adjust for confounders. Conduct sensitivity analyses (E-value) to assess unmeasured confounding. In RCTs, randomization controls confounding; verify baseline balance
If violated
Use multivariable log-binomial regression to adjust for measured confounders (reports adjusted RR with 95% CI). If log-binomial fails to converge, use modified Poisson regression with robust standard errors (yields valid RR estimates and SEs). Use propensity score methods (matching, weighting, stratification) to balance confounders in observational studies. Report both crude and adjusted RR. Calculate E-value to quantify robustness to unmeasured confounding. Acknowledge residual confounding as limitation
propensity score matching
How to check
Quick
Calculate follow-up completion rate: % of enrolled participants with outcome ascertainment. Ideal >80-90% completion. Compare loss rates by exposure group: differential loss can bias RR. Check if those lost differ systematically on baseline characteristics
Rigorous
Conduct sensitivity analyses: (1) Best-case scenario (assume all lost in exposed = no outcome, all lost in unexposed = outcome); (2) Worst-case scenario (reverse assumptions); (3) Multiple imputation for missing outcomes using baseline predictors. If differential loss by exposure-outcome, bias magnitude can be substantial. Examine missingness patterns (MAR vs MNAR)
If violated
If high loss to follow-up (>20%): (1) Report complete-case analysis but acknowledge potential selection bias; (2) Use inverse probability weighting (IPW) to reweight based on probability of completion; (3) Multiple imputation for missing outcomes; (4) Bounds analysis (best/worst case scenarios). If loss is differential by exposure: carefully assess direction of bias and interpret RR cautiously. Never ignore substantial attrition; always report follow-up rates by exposure group
03Residual Forensics

Diagnostics

Checking residual plots and indices to examine model deviations and ensure standard error integrity.

Trust, but verify. The outliers often hold more truth than the averages.
System Health
Essential checks
  1. Verify prospective/cohort design (not case-control)
  2. Check adequate events per exposure group (≥5 recommended)
  3. Calculate and report follow-up completion rates by exposure
  4. Inspect 2×2 table for cell counts and percentages
Recommended checks
  1. Compare crude vs adjusted RR to assess confounding
  2. Sensitivity analysis for unmeasured confounding (E-value)
  3. Check proportional hazards assumption if using survival analysis
  4. Forest plot for multiple RR estimates (adjusted, stratified)
  5. Plot cumulative incidence curves by exposure group
04Live Instances

Applied Minds

Review concrete study examples, data layout guidelines, and copy executable syntax scripts.

Theory is the map. Practice is the terrain. Simulation bridges the gap.
Applied Wisdom
Example 01

Smoking and Lung Cancer Incidence (Prospective Cohort Study)

Research question: Does smoking increase the risk of lung cancer incidence? Design: 20-year prospective cohort study following 5,000 initially cancer-free adults (2,500 smokers, 2,500 never-smokers). Outcome: Incident lung cancer diagnosis during follow-up. This replicates classic cohort studies establishing smoking-lung cancer association. RR is more interpretable than OR for public health communication.

DesignProspective cohort study
Total n5000
Outcome ScaleIncident lung cancer (continuous time-to-event)
# Relative Risk: Smoking and Lung Cancer Incidence (Cohort Study)
# Prospective design with incident cases over 20-year follow-up

library(epitools)     # For riskratio()
library(ggplot2)
library(survival)     # For survival curves
library(survminer)    # For ggsurvplot

# Set seed for reproducibility
set.seed(2025)

# === Simulate prospective cohort data ===
# 20-year follow-up, RR ≈ 15 (strong effect)
# Incidence: 15% in smokers, 1% in never-smokers

n_smokers <- 2500
n_never <- 2500

# Incident lung cancer during 20-year follow-up
incidence_smokers <- 0.15    # 15% cumulative incidence
incidence_never <- 0.01      # 1% cumulative incidence

# Generate outcome data
smokers_cancer <- rbinom(1, n_smokers, incidence_smokers)
smokers_no_cancer <- n_smokers - smokers_cancer

never_cancer <- rbinom(1, n_never, incidence_never)
never_no_cancer <- n_never - never_cancer

# For realistic simulation, use typical values
smokers_cancer <- round(n_smokers * incidence_smokers)  # ~375 cases
never_cancer <- round(n_never * incidence_never)        # ~25 cases
smokers_no_cancer <- n_smokers - smokers_cancer
never_no_cancer <- n_never - never_cancer

# Create 2x2 table
# Rows: Exposure (Smoker, Never-smoker)
# Columns: Outcome (Cancer, No Cancer)
table_cohort <- matrix(c(
  smokers_cancer, smokers_no_cancer,
  never_cancer, never_no_cancer
), nrow=2, byrow=TRUE,
dimnames=list(
  Exposure = c("Smoker", "Never-smoker"),
  Outcome = c("Cancer", "No Cancer")
))

print("=== 2x2 Contingency Table(Cohort Data) ===")
print(table_cohort)
print(addmargins(table_cohort))

# === STEP 1: Check Assumptions ===

cat("\n=== Assumption Checks ===\n")

# 1. Study design
cat("Design: Prospective cohort study ✓\n")
cat("Sampling: By exposure status(smokers/never-smokers) ✓\n")
cat("Follow-up: 20 years(incident cases only) ✓\n")

# 2. Adequate events
min_events <- min(smokers_cancer, never_cancer)
cat("\nMinimum events per exposure group:", min_events, 
    ifelse(min_events >= 5, "✓", "✗ Consider exact methods"), "\n")

# 3. Temporal sequence
cat("Temporal sequence: Exposure(baseline smoking status) precedes outcome(incident cancer) ✓\n")

# === STEP 2: Calculate Cumulative Incidence (Risk) ===

cat("\n=== Cumulative Incidence(Risk) ===\n")

risk_smokers <- smokers_cancer / n_smokers
risk_never <- never_cancer / n_never

cat("Risk in smokers:", round(risk_smokers, 4), "(", 
    round(risk_smokers * 100, 2), "%)\n")
cat("Risk in never-smokers:", round(risk_never, 4), "(", 
    round(risk_never * 100, 2), "%)\n")

# === STEP 3: Calculate Relative Risk with 95% CI ===

cat("\n=== Relative Risk Calculation ===\n")

# Method 1: Manual calculation
RR_manual <- risk_smokers / risk_never
cat("RR = Risk(smokers) / Risk(never-smokers)\n")
cat("RR =", round(risk_smokers, 4), "/", round(risk_never, 4), "=", round(RR_manual, 2), "\n")

# Calculate 95% CI using log method
log_RR <- log(RR_manual)
SE_log_RR <- sqrt((1 - risk_smokers) / smokers_cancer + (1 - risk_never) / never_cancer)
CI_lower <- exp(log_RR - 1.96 * SE_log_RR)
CI_upper <- exp(log_RR + 1.96 * SE_log_RR)

cat("95% CI:", round(CI_lower, 2), "-", round(CI_upper, 2), "\n")

# Method 2: Using epitools package
rr_result <- riskratio(table_cohort, method="wald")
print(rr_result)

# === STEP 4: Calculate Risk Difference (Attributable Risk) ===

cat("\n=== Risk Difference(Attributable Risk) ===\n")

RD <- risk_smokers - risk_never
cat("RD = Risk(smokers) - Risk(never-smokers)\n")
cat("RD =", round(RD, 4), "(", round(RD * 100, 2), "percentage points)\n")

# SE for risk difference
SE_RD <- sqrt(risk_smokers * (1 - risk_smokers) / n_smokers + 
              risk_never * (1 - risk_never) / n_never)
RD_CI_lower <- RD - 1.96 * SE_RD
RD_CI_upper <- RD + 1.96 * SE_RD

cat("95% CI for RD:", round(RD_CI_lower, 4), "-", round(RD_CI_upper, 4), "\n")
cat("\nInterpretation:", round(RD * 100, 2), 
    "% excess lung cancer risk in smokers attributable to smoking\n")

# === STEP 5: Hypothesis Test ===

cat("\n=== Hypothesis Test ===\n")
cat("H₀: RR = 1 (no association)\n")
cat("Hₐ: RR ≠ 1 (association exists)\n\n")

if (CI_lower > 1) {
  cat("Result: Reject H₀. RR significantly > 1 (p < .05)\n")
  cat("Smoking is associated with INCREASED risk of lung cancer\n")
} else if (CI_upper < 1) {
  cat("Result: Reject H₀. RR significantly < 1 (p < .05)\n")
  cat("Exposure associated with DECREASED risk\n")
} else {
  cat("Result: Fail to reject H₀. 95% CI includes 1.0\n")
  cat("No significant association detected\n")
}

# Chi-square test
chi2_result <- chisq.test(table_cohort, correct=FALSE)
cat("\nChi-square test: χ² =", round(chi2_result$statistic, 2), 
    ", p =", format.pval(chi2_result$p.value, digits=3), "\n")

# === STEP 6: Visualizations ===

# 6.1 Forest plot (RR with CI)
forest_data <- data.frame(
  Comparison = "Smokers vs Never-Smokers",
  RR = RR_manual,
  CI_lower = CI_lower,
  CI_upper = CI_upper
)

ggplot(forest_data, aes(y=Comparison, x=RR)) +
  geom_point(size=5, color="darkred") +
  geom_errorbarh(aes(xmin=CI_lower, xmax=CI_upper), height=0.2, linewidth=1.5) +
  geom_vline(xintercept=1, linetype="dashed", color="blue", linewidth=1.2) +
  scale_x_log10(breaks=c(0.5, 1, 2, 5, 10, 20, 30)) +
  labs(title="Relative Risk: Smoking and Lung Cancer Incidence",
       subtitle="20-year Prospective Cohort Study(n=5,000)",
       x="Relative Risk(log scale) with 95% CI",
       y="") +
  theme_classic(base_size=14) +
  theme(plot.title = element_text(hjust=0.5, face="bold"),
        plot.subtitle = element_text(hjust=0.5)) +
  annotate("text", x=RR_manual, y=1.3, 
           label=paste0("RR = ", round(RR_manual, 2), 
                       "\n95% CI: [", round(CI_lower, 2), ", ", round(CI_upper, 2), "]"),
           size=5, fontface="bold")

ggsave("forest_plot_rr.png", width=12, height=6)

# 6.2 Bar plot: Cumulative incidence by exposure
incidence_data <- data.frame(
  Group = c("Smokers", "Never-Smokers"),
  Incidence = c(risk_smokers * 100, risk_never * 100),
  SE = c(sqrt(risk_smokers * (1 - risk_smokers) / n_smokers) * 100,
         sqrt(risk_never * (1 - risk_never) / n_never) * 100)
)

ggplot(incidence_data, aes(x=Group, y=Incidence, fill=Group)) +
  geom_bar(stat="identity", width=0.6, alpha=0.8) +
  geom_errorbar(aes(ymin=Incidence - 1.96*SE, ymax=Incidence + 1.96*SE),
                width=0.2, linewidth=1) +
  geom_text(aes(label=paste0(round(Incidence, 2), "%")), 
            vjust=-2, size=6, fontface="bold") +
  scale_fill_manual(values=c("Smokers"="#E69F00", "Never-Smokers"="#56B4E9")) +
  labs(title="20-Year Cumulative Incidence of Lung Cancer",
       subtitle="Prospective Cohort Study",
       y="Cumulative Incidence(%) ± 95% CI",
       x="Smoking Status") +
  theme_classic(base_size=14) +
  theme(legend.position="none",
        plot.title = element_text(hjust=0.5, face="bold"),
        plot.subtitle = element_text(hjust=0.5)) +
  ylim(0, 20)

ggsave("incidence_by_exposure.png", width=10, height=8)

# 6.3 Simulate survival curves (for visualization)
# Generate individual-level data for survival analysis
time_smokers <- rexp(n_smokers, rate=-log(1 - incidence_smokers)/20)
time_never <- rexp(n_never, rate=-log(1 - incidence_never)/20)

# Cap at 20 years
time_smokers <- pmin(time_smokers, 20)
time_never <- pmin(time_never, 20)

# Event indicator (1 = cancer, 0 = censored)
event_smokers <- as.numeric(time_smokers < 20 & runif(n_smokers) < incidence_smokers)
event_never <- as.numeric(time_never < 20 & runif(n_never) < incidence_never)

# Combine into data frame
cohort_data <- data.frame(
  time = c(time_smokers, time_never),
  event = c(event_smokers, event_never),
  exposure = c(rep("Smoker", n_smokers), rep("Never-Smoker", n_never))
)

# Fit survival model
fit_surv <- survfit(Surv(time, event) ~ exposure, data=cohort_data)

# Plot survival curves (cancer-free survival)
ggsurvplot(fit_surv, data=cohort_data,
           risk.table=TRUE,
           pval=TRUE,
           conf.int=TRUE,
           title="Cancer-Free Survival by Smoking Status",
           xlab="Years of Follow-up",
           ylab="Probability of Remaining Cancer-Free",
           legend.title="Exposure",
           legend.labs=c("Never-Smoker", "Smoker"),
           palette=c("#56B4E9", "#E69F00"),
           ggtheme=theme_classic())

# === STEP 7: Calculate Population Impact ===

cat("\n=== Population Impact Measures ===\n")

# Attributable fraction among exposed (AFe)
AFe <- (RR_manual - 1) / RR_manual * 100
cat("Attributable fraction(exposed):", round(AFe, 1), "%\n")
cat("Interpretation:", round(AFe, 1), 
    "% of lung cancer in smokers is attributable to smoking\n")

# Population attributable fraction (PAF)
# Assume 50% prevalence of smoking in population
p_exposed_pop <- 0.50
PAF <- p_exposed_pop * (RR_manual - 1) / (p_exposed_pop * (RR_manual - 1) + 1) * 100
cat("\nPopulation attributable fraction(assuming 50% smoking prevalence):", 
    round(PAF, 1), "%\n")
cat("Interpretation:", round(PAF, 1), 
    "% of all lung cancer in population could be prevented by eliminating smoking\n")

# Number needed to harm (NNH)
NNH <- 1 / RD
cat("\nNumber needed to harm(NNH):", round(NNH, 1), "\n")
cat("Interpretation: For every", round(NNH, 0), 
    "smokers, 1 excess lung cancer case occurs over 20 years\n")

# === APA-Style Reporting ===
cat("\n=== APA-Style Report ===\n")
cat(sprintf(
  "A 20-year prospective cohort study(n=5,000) examined the association between\nsmoking and incident lung cancer.\n\nAmong 2,500 smokers, %d(%%. 1f%%) developed lung cancer compared to %d(%.1f%%)\nof 2,500 never-smokers.\n\nThe relative risk was RR = %.2f (95%% CI [%.2f, %.2f], p < .001), indicating\nsmokers had %.1f times the risk of lung cancer compared to never-smokers.\n\nThe risk difference was %.2f percentage points(95%% CI [%.2f, %.2f]), meaning\nan excess %.1f%% of smokers developed lung cancer attributable to smoking.\n\nThe attributable fraction among exposed was %.1f%%, indicating %.1f%% of lung\ncancer cases in smokers would not have occurred without smoking.\n\nAssuming 50%% smoking prevalence, the population attributable fraction was %.1f%%,\nsuggesting %.1f%% of all lung cancer could be prevented by eliminating smoking.\n\nThe number needed to harm was %.0f, meaning for every %.0f smokers over 20 years,\n1 excess lung cancer case occurred due to smoking.\n\nInterpretation: This very large relative risk(RR > 10) provides strong evidence\nfor a causal relationship between smoking and lung cancer, consistent with\nepidemiological consensus and biological plausibility(Doll & Hill, 1954).",
  smokers_cancer, risk_smokers * 100,
  never_cancer, risk_never * 100,
  RR_manual, CI_lower, CI_upper, RR_manual,
  RD * 100, RD_CI_lower * 100, RD_CI_upper * 100, RD * 100,
  AFe, AFe,
  PAF, PAF,
  NNH, NNH
))
Interpretation Blueprint

RR = 15.00, 95% CI [10.12, 22.23], p < .001. Smokers had 15 times the risk of lung cancer compared to never-smokers over 20 years of follow-up. This very large relative risk (RR > 10), combined with a large absolute risk difference (14 percentage points), provides strong evidence for a causal relationship. The attributable fraction among exposed (93.3%) indicates that nearly all lung cancer in smokers is attributable to smoking. With 50% smoking prevalence, 87.5% of all lung cancer could be prevented by eliminating smoking. The number needed to harm (7) means for every 7 smokers followed for 20 years, 1 excess lung cancer case occurs due to smoking. This RR magnitude is consistent with classic cohort studies (Doll & Hill, 1954) and meta-analyses, demonstrating the robust smoking-lung cancer causal relationship established through prospective designs.

05Tactical Pivots

Alternatives

Structured fallback pathways for choosing alternative tests when normality or slopes requirements fail.

When the path is blocked, pivot. Rigor is not rigidity; it is the intelligent adaptation to reality.
Adaptive Strategy
Measurement Precision Ladder Ideal · Binary x Binary
Ratio
Consider Multiple Regression. Relative Risk math is designed for prospective categorical 'Events'.
Model Mismatch
Ordinal
Pivot to Proportional Odds Regression or Trend Tests to preserve the ranked nature of your outcomes.
Variance Distortion
Binary
Maintain RR logic. The definitive engine for prospective incidence discovery.
Peak Signal
Temporal Trajectory Audit Prospective Risk Snapshot
Prospective Audit
Follow-up window.
Stay with RR Test. Isolate the drivers of future event probability.
Long-Term Flow
Trajectory risk.
Pivot to Cox Proportional Hazards to model the Hazard of an event occurring over time.
Adaptive Technical Safeguards · adaptive safeguards
retrospective design detected
  • Odds Ratio (OR) Pivot — The mandatory switch if you are working with Case-Control data where incidence is unknown.
rarity bias
  • Fisher's Exact Strike — Calculate exact probability if the 'Incidence' is near zero.
  • Bayesian Risk Audit — Use priors to protect significance in low-event cohorts.
stratification needed
  • Mantel-Haenszel Risk Strike — Provide a pooled RR while neutralizing a single categorical confounder.
06Adjusted Comparisons

Post-hoc

Group mean comparisons and correction controls (e.g. Tukey HSD, Bonferroni) to protect against Family-Wise Error Rates.

The omnibus test opens the door; post-hoc analysis explores the room.
Forensic Detail
Adjusted Comparisons

Post-hoc pairwise tests defined for this model.

Interpretation Guidelines

A risk ratio is a global summary. Use subgroup partitioning to ensure your 'Discovery' applies to the entire population, rather than being driven by a single high-risk archetype.

07Standardized scale impact

Effect Size

Understanding effect sizes (e.g., Cohen's d, Partial Eta-Squared) and clinical impact benchmarks.

Significance is noise. Magnitude is the signal. Measure the impact, not just the probability.
Impact Magnitude

RR = 1: no association. RR > 1: increased risk in exposed. RR < 1: decreased risk (protective). RR = 2: exposed have twice the risk. RR = 0.5: exposed have half the risk.

RR 1.0-1.5: small effect. RR 1.5-3.0: medium effect. RR > 3.0: large effect. RR > 10: very large effect (strong evidence for causality).

If 95% CI excludes 1.0, association is statistically significant at α = .05. Wide CI indicates imprecision; narrow CI indicates precision.

Risk difference (RD) quantifies absolute excess risk. RD = 0.10 means 10 percentage point increase in risk. Clinically meaningful even if RR is modest.

Attributable fraction among exposed: proportion of disease in exposed that is due to exposure. AFe = 0.80 means 80% of disease in exposed is attributable to exposure.

Number needed to harm: number of people exposed for 1 additional harmful outcome. NNH = 10 means for every 10 exposed, 1 excess case occurs.

Recommended Metric: RR with 95% CI (primary); risk difference for absolute impact; AFe and PAF for public health interpretation; NNH for clinical communication
Small
0.2
Medium
0.5
Large
0.8
0.50
RR with 95% CI (primary); risk difference for absolute impact; AFe and PAF for public health interpretation; NNH for clinical communication
Recommended Measure
6
Available Metrics
ReportUse RR with 95% CI (primary); risk difference for absolute impact; AFe and PAF for public health interpretation; NNH for clinical communication to represent clinical impact magnitude.
08Statistical Power

Sample Size

Guidelines for minimum sample requirements and power analysis parameters.

An underpowered study is an ethical failure. Respect the data by collecting enough of it.
Power Protocol
Floor Requirements

At least 5 events per exposure group for stable RR estimation. Total n depends on outcome incidence; rare outcomes require larger samples.

Effect SizeParametersRequired n
Small EffectRR = 1.5 with 10% baseline riskapproximately 1,500 per group
Medium EffectRR = 2.0 with 10% baseline riskapproximately 400 per group
Large EffectRR = 3.0 with 10% baseline riskapproximately 150 per group
G*Power StrategyUse Stata 'power twoproportions', R package 'pwr', or online calculators. Specify: p1 (risk in exposed), p2 (risk in unexposed), α, power, ratio of exposed to unexposed. Alternatively specify RR and baseline risk.
09APA narrative blueprint

Reporting

How to compile statistical results into publication prose matching APA and journal style guides.

Data does not speak for itself. It requires a translator. Be clear, be precise, be honest.
Narrative Arc
Worked APA paragraph example
A 20-year prospective cohort study (n=5,000) examined the association between smoking and incident lung cancer. Among 2,500 smokers, 375 (15.0%) developed lung cancer compared to 25 (1.0%) of 2,500 never-smokers. Data met assumptions of prospective design with incident cases only; temporal sequence was established (baseline smoking status preceded cancer diagnosis). The relative risk was RR = 15.00 (95% CI [10.12, 22.23], p < .001), indicating smokers had 15 times the risk of lung cancer compared to never-smokers. The risk difference was 14.00 percentage points (95% CI [12.85, 15.15]), representing substantial absolute excess risk in smokers. The attributable fraction among exposed was 93.3%, suggesting that nearly all lung cancer cases in smokers are attributable to smoking. Assuming 50% smoking prevalence, the population attributable fraction was 87.5%, indicating that 87.5% of all lung cancer could be prevented by eliminating smoking. This very large relative risk (RR > 10), combined with strong dose-response, biological plausibility, and consistency across studies, provides robust evidence for a causal relationship between smoking and lung cancer (Doll & Hill, 1954).
Reusable template

A prospective cohort/RCT study (n = total N) examined the association between exposure and outcome. Participants were followed for duration to ascertain incident outcome. Among N exposed exposed individuals, n events (%) developed outcome compared to n events (%) of N unexposed unexposed individuals. If assumptions checked: 'Data met assumptions of prospective design with incident cases. Temporal sequence was established (exposure at baseline preceded outcome). Adequate events occurred in both groups (≥5 per group).' OR 'Loss to follow-up was [%, with similar completion rates by exposure group.'] The relative risk was RR = X.XX (95% CI X.XX, X.XX, p = .XXX, chi-square test), indicating exposed group had X.XX times the risk of outcome compared to unexposed group. The risk difference was X.XX percentage points (95% CI X.XX, X.XX), representing absolute excess risk interpretation. If adjusted: 'After adjusting for [confounders, the adjusted RR was X.XX (95% CI X.XX, X.XX, p = .XXX)'.] Interpret magnitude: small/medium/large effect; clinical significance. The attributable fraction among exposed was X%, suggesting X% of outcome in exposed group is attributable to exposure. For public health: 'The population attributable fraction was X%, indicating X% of [outcome could be prevented by eliminating exposure.']. Causal language only if: RCT with proper randomization, or strong observational evidence with Bradford Hill criteria.

Essential statistics to report
  • Relative risk (RR) point estimate
  • 95% confidence interval for RR
  • p-value (chi-square test or log-rank test)
  • 2×2 contingency table with counts and percentages
  • Study design (prospective cohort, RCT)
  • Sample sizes per exposure group
  • Follow-up duration and completion rates
  • Risk (cumulative incidence) in each exposure group
  • Risk difference (RD) with CI
  • If adjusted: list of adjusted confounders and adjusted RR
  • Attributable fraction (AFe) for public health interpretation
10Exhibit Builder

Manuscript Lab

Copy standard summary tables and forensic reporting grids to outline analysis details.

Table 1: Relative Risk Analysis for Prospective Exposure
ComparisonRisk (%)RR95% CI (RR)p-value
Exposed Group25.0%2.50[1.85, 3.38]< .001
Non-Exposed10.0%
Note. Reporting Probability Ratio. N = 500. Outcome: Treatment Failure.
RR = 2.50Identifies High Risk. Exposure increases the failure probability by 150%, justifying immediate preventative intervention.
Header glossary

The Multiplier. RR = 2.50 means the event is 2.5 times more frequent in the exposed population.

The Precision Window. If the interval includes 1.0, there is no significant difference in risk.

11Algorithmic Logic

Command Center

Syntax libraries and function parameters for executing calculations in stats packages.

Code is the modern laboratory. Clean execution ensures reproducible discovery.
Execution Engine
# 1. Execute Relative Risk
fmsb::riskratio(a=25, b=225, c=10, d=240)

# 2. Extract Comprehensive Epidemiological Audit
epiR::epi.2by2(table(df$exposure, df$outcome), method = 'cohort.count')
Library stack
R
epiRstatsfmsb
Python
statsmodels.stats.contingency_tables
Elite Forensic Strike

Relative Risk is for Prospective studies (looking forward). Odds Ratio is for Retrospective studies (looking back). If you mix them up, you are violating the fundamental logic of causal timing.

# Audit for Number Needed to Treat (NNT)
# NNT = 1 / (Absolute Risk Reduction)
12The Over-adjustment Trap

Common Mistakes

Analytical caveats and corrections to maintain modeling integrity.

Wisdom is learning from the failures of others. Anticipate the error before it occurs.
Defensive Logic
Why it's wrong
Case-control studies sample by outcome status (cases/controls), fixing outcome marginals. This makes incidence rates unknowable; you cannot calculate how many exposed/unexposed developed disease out of total at risk. Only OR can be estimated. Using RR formula on case-control data yields meaningless number. For example, if 80% of cases and 30% of controls were exposed, RR = 0.80/0.30 = 2.67 is NOT the true population RR because these percentages don't reflect actual incidence.
The correction
Match effect measure to study design: case-control → OR only; cohort/RCT → RR. State study design clearly. If case-control and outcome is rare (<10%), note that OR approximates RR (rare disease assumption), but report as OR, not RR. Never calculate RR directly from case-control 2×2 table.
Why it's wrong
RR and HR measure different things. RR compares cumulative incidence (proportion with event by end of follow-up) between groups. HR compares instantaneous failure rates (hazard) over time, accounting for censoring and time-to-event. HR can change over time if proportional hazards violated. For non-proportional hazards, HR ≠ RR. For example, if HR = 2.0 but effect diminishes over time, cumulative incidence RR at 10 years might be only 1.5.
The correction
Use appropriate measure for design: (1) Fixed follow-up with all outcomes observed → RR from cumulative incidence; (2) Variable follow-up or censoring → HR from Cox model. Report which measure used. If reporting HR, check proportional hazards assumption (Schoenfeld residuals, log-log plots). If violated, report time-varying HRs or restricted mean survival time. State 'hazard ratio' not 'risk ratio' when reporting HR.
Why it's wrong
RR alone doesn't convey absolute magnitude of risk. RR = 2.0 sounds alarming, but if baseline risk is 0.1%, exposed risk is only 0.2% (RD = 0.1% — minimal absolute impact). Conversely, RR = 1.2 seems small, but if baseline risk is 50%, exposed risk is 60% (RD = 10% — substantial impact). Reporting only RR misleads about clinical importance. Media and patients often misinterpret RR as absolute risk increase.
The correction
ALWAYS report both RR and risk difference (RD). Example: 'RR = 2.0 (95% CI [1.5, 2.7]), meaning exposed had twice the risk; the absolute risk increased from 5% to 10% (RD = 5 percentage points, 95% CI [3%, 7%]).' Calculate number needed to harm (NNH = 1/RD) for clinical interpretation. Present both relative and absolute measures in plain language for lay audiences.
Why it's wrong
Prevalence = incidence × duration. Prevalence ratio (PR) conflates incidence rate with disease duration. If disease lasts longer in exposed group, PR > incidence RR even if incidence rates are equal. For example, if diabetes incidence is equal but diabetics in exposed group survive longer (less mortality), prevalence will be higher in exposed, yielding PR > 1 despite RR = 1. Cross-sectional PR overestimates incidence RR for chronic diseases.
The correction
Distinguish incidence (cohort) from prevalence (cross-sectional). If cross-sectional data: (1) Report as prevalence ratio (PR), not RR; (2) Note PR may differ from incidence RR; (3) Interpret cautiously for chronic conditions. If outcome is acute (short duration), PR ≈ RR. For valid incidence RR, use prospective cohort with incident cases only (exclude prevalent cases at baseline).
Why it's wrong
Differential loss to follow-up can severely bias RR. If outcome-prone exposed participants drop out preferentially (e.g., sick smokers quit study), exposed risk is underestimated and RR biased toward 1.0. If healthy exposed stay but sick unexposed leave, RR is exaggerated. Even 10-15% loss can meaningfully bias estimates if loss is related to exposure-outcome. Complete-case analysis assumes missing-completely-at-random (MCAR), which is rarely true.
The correction
Always report: (1) Follow-up completion rates by exposure group; (2) Compare baseline characteristics of completers vs non-completers. If loss > 10%: (1) Conduct sensitivity analyses (best/worst-case scenarios, multiple imputation); (2) Use inverse probability weighting (IPW) to reweight by probability of completion; (3) Discuss potential bias direction. If loss is substantially differential, acknowledge limitation and interpret RR cautiously.
Why it's wrong
Logistic regression yields odds ratios, not risk ratios. When outcome is common (>10%), OR ≠ RR and OR overestimates RR, misleading about actual risk increase. For example, if 40% exposed and 20% unexposed develop outcome: RR = 40/20 = 2.0, but OR = (0.4/0.6)/(0.2/0.8) = 2.67. Reporting OR = 2.67 as if it were RR exaggerates effect. Many analysts default to logistic regression without considering alternatives.
The correction
For cohort/RCT with common outcomes: (1) FIRST CHOICE: log-binomial regression (glm with binomial family, log link) — directly estimates RR; (2) IF log-binomial fails to converge: modified Poisson regression (glm with poisson family, log link) + robust/sandwich SEs (valid RR and CI); (3) LAST RESORT: report OR from logistic regression but clearly label as OR, not RR. Stata: binreg for log-binomial, poisson with vce(robust) for modified Poisson. R: glm(..., family=binomial(link='log')) or glm(..., family=poisson(link='log')) with sandwich SEs.
Why it's wrong
RR scale is not symmetrical around 1.0. RR = 2.0 (doubling) is NOT the mirror opposite of RR = 0.5 (halving) in terms of absolute impact. For example, if baseline risk is 10%: RR = 2.0 → 20% (increase of 10 points); RR = 0.5 → 5% (decrease of 5 points). The absolute changes differ. Also, RR = 0.5 is further from 1.0 on log scale than RR = 2.0 appears on linear scale.
The correction
Use log scale for RR interpretation: log(2.0) = 0.69 and log(0.5) = -0.69 are equidistant from log(1.0) = 0. For communication, present RRs > 1 as 'X times higher' and RRs < 1 as '1 - RR = X% reduction'. Example: RR = 0.5 → '50% risk reduction' (not '0.5 times the risk'). For symmetrical interpretation, use log-transformed RR in statistical tests and plots (forest plots use log scale for this reason).
Why it's wrong
Crude RR from observational cohort can be severely confounded. For example, coffee-pancreatic cancer association (crude RR = 2.5) disappeared (adjusted RR = 1.0) after controlling for smoking confounding. Observational cohorts lack randomization, so exposed/unexposed groups differ on many characteristics. Confounding can create spurious associations or mask true associations. Ignoring confounding yields biased RR.
The correction
Use multivariable regression to adjust for confounders: (1) Log-binomial regression with confounders as covariates; (2) Modified Poisson regression with confounders; (3) Propensity score methods (matching, weighting, stratification). Compare crude vs adjusted RR; >10-15% change indicates confounding. Report both. Use DAG (directed acyclic graph) to identify confounders vs mediators vs colliders. Calculate E-value to assess unmeasured confounding robustness. Clearly state 'adjusted for [list confounders]' in reporting.
Why it's wrong
Even large RRs from well-designed cohorts don't guarantee causation. Unmeasured confounding, reverse causation, and selection bias can produce non-causal associations. For example, hormone replacement therapy and cardiovascular disease showed RR < 1 in observational cohorts, but RCTs showed RR > 1 (opposite effect), due to healthy user bias confounding. Observational RR alone is insufficient for causal claims.
The correction
For causal inference from observational RR: (1) Apply Bradford Hill criteria (strength, consistency, specificity, temporality, dose-response, plausibility, coherence, experiment, analogy); (2) Rule out alternative explanations (confounding, bias, chance); (3) Use causal inference methods (instrumental variables, regression discontinuity, difference-in-differences); (4) Replicate in RCTs if feasible; (5) Use cautious language ('associated with', not 'caused'). Only claim causation with strong multifaceted evidence (e.g., smoking-lung cancer: RR > 10, dose-response, biological mechanism, RCT evidence in animals, temporality, consistency across studies).
13Academic Lineage

References

Scholarly lineage and citation keys grounding the statistical framework.

We stand on the shoulders of giants. Honor the source of the method.
Academic Lineage
[1]
Doll, R., & Hill, A. B. (1954). The mortality of doctors in relation to their smoking habits: A preliminary report. British Medical Journal, 1(4877), 1451-1455.
Classic prospective cohort study (British Doctors Study) establishing smoking-lung cancer causal association with RR ≈ 10-20. Landmark study demonstrating prospective design superiority. Basis for Example 1.
doi: 10.1136/bmj.1.4877.1451
[2]
Szklo, M., & Nieto, F. J. (2018). Epidemiology: Beyond the Basics (4th ed.). Jones & Bartlett Learning.
Comprehensive epidemiology textbook covering relative risk calculation, interpretation, cohort study designs, incidence vs prevalence, confounding control, and public health measures (AFe, PAF, NNH). Chapters 3-6 essential for understanding RR.
[3]
Rothman, K. J., Greenland, S., & Lash, T. L. (2008). Modern Epidemiology (3rd ed.). Lippincott Williams & Wilkins.
Gold standard epidemiology reference. Extensive coverage of relative risk, risk difference, attributable fractions, and causal inference from observational cohorts. Chapters 3-5 on measures of occurrence and effect.
[4]
Zou, G. (2004). A modified Poisson regression approach to prospective studies with binary data. American Journal of Epidemiology, 159(7), 702-706.
Introduces modified Poisson regression with robust standard errors as solution when log-binomial fails to converge. Essential reference for adjusted RR estimation in cohort studies.
doi: 10.1093/aje/kwh090
[5]
VanderWeele, T. J., & Ding, P. (2017). Sensitivity analysis in observational research: Introducing the E-value. Annals of Internal Medicine, 167(4), 268-274.
E-value quantifies minimum strength of unmeasured confounding needed to explain away observed RR. Essential tool for assessing robustness of cohort study RR estimates to unmeasured confounding.
doi: 10.7326/M16-2607
[6]
Hill, A. B. (1965). The environment and disease: Association or causation? Proceedings of the Royal Society of Medicine, 58(5), 295-300.
Bradford Hill criteria for causal inference: strength, consistency, specificity, temporality, dose-response, plausibility, coherence, experiment, analogy. Classic framework for judging causality from observational RR.
Risk is a probability, not a certainty. Use RR to find the direction of the trend, but respect the confidence interval as the boundary of your truth.
The Interpretive Rigor Directive
statminds · RelativeMind reference · v2.2 · updated 2026-01-1715 of 15 sections