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.
Value
An R6 class generator object for the oddsratioClass backend; used internally by the jamovi analysis wrapper and not called directly.
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. The regression uses complete cases for the selected outcome and explanatory variables only.
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:
Prediction nomogram based on the fitted logistic model
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.
Super classes
jmvcore::Analysis -> oddsratioBase -> oddsratioClass
Methods
Inherited methods
jmvcore::Analysis$.createImage()jmvcore::Analysis$.createImages()jmvcore::Analysis$.createPlotObject()jmvcore::Analysis$.getSessionTemp()jmvcore::Analysis$.load()jmvcore::Analysis$.render()jmvcore::Analysis$.save()jmvcore::Analysis$.savePart()jmvcore::Analysis$.setCheckpoint()jmvcore::Analysis$.setParent()jmvcore::Analysis$.setReadDatasetHeaderSource()jmvcore::Analysis$.setReadDatasetSource()jmvcore::Analysis$.setResourcesPathSource()jmvcore::Analysis$.setStatePathSource()jmvcore::Analysis$addAddon()jmvcore::Analysis$asProtoBuf()jmvcore::Analysis$asSource()jmvcore::Analysis$check()jmvcore::Analysis$init()jmvcore::Analysis$optionsChangedHandler()jmvcore::Analysis$postInit()jmvcore::Analysis$print()jmvcore::Analysis$readDataset()jmvcore::Analysis$run()jmvcore::Analysis$serialize()jmvcore::Analysis$setError()jmvcore::Analysis$setStatus()jmvcore::Analysis$translate()oddsratioBase$initialize()
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
)
} # }