Skip to contents

Performs logistic regression analysis to calculate odds ratios for binary outcomes. This function provides comprehensive odds ratio tables, forest plots, and optional nomogram generation for clinical prediction. It supports both categorical and continuous explanatory variables and includes diagnostic metrics for binary predictors.

Details

The function performs the following analyses:

  • Logistic regression using finalfit package

  • Odds ratio calculation with 95% confidence intervals

  • Forest plot generation for visualization

  • Optional nomogram creation for clinical prediction

  • Likelihood ratio calculations for diagnostic metrics

  • Sensitivity and specificity analysis for binary predictors

The function automatically cleans variable names using janitor::clean_names() and preserves original variable labels for display. It handles missing data through complete case analysis.

International Usage

For international users, the function includes an outcomeLevel parameter to explicitly specify which outcome level represents the positive case. This is important for correct interpretation of likelihood ratios and diagnostic metrics.

Nomogram Features

When showNomogram is enabled, the function generates:

  • Interactive nomogram for risk prediction

  • Diagnostic metrics (sensitivity, specificity, likelihood ratios)

  • Contingency table analysis

  • User guidance for interpretation

References

Harrison, E., Drake, T., & Ots, R. (2019). finalfit: Quickly create elegant regression results tables and plots when modelling. R package version 0.9.7.

See also

finalfit, rms

Author

ClinicoPath Development Team

Super classes

jmvcore::Analysis -> ClinicoPath::oddsratioBase -> oddsratioClass

Examples

if (FALSE) { # \dontrun{
# Basic odds ratio analysis
result <- oddsratio(
  data = clinical_data,
  explanatory = c("age", "gender", "smoking"),
  outcome = "mortality"
)

# With nomogram and specified outcome level
result <- oddsratio(
  data = clinical_data,
  explanatory = c("age", "treatment"),
  outcome = "recurrence",
  outcomeLevel = "Yes",
  showNomogram = TRUE
)
} # }