This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Binary Logistic Regression module. It is intended to support computational reproducibility and software transparency. Detailed statistical methodology, mathematical derivations, and user guidance are provided separately in the official module documentation.
Any issues or updates required please comment here
stats::AIC(); residual & null deviance; likelihood-ratio test via stats::pchisq()
Pseudo R²
Cox & Snell, Nagelkerke, McFadden from stats::logLik()
Multicollinearity
car::vif()
Goodness of fit
Hosmer–Lemeshow decile-of-risk test (native implementation; stats::quantile(), stats::pchisq())
Linearity of the logit
Box–Tidwell refit: glm(. ~ . + I(x·log(x))), Wald p of the added term
Influence diagnostics
broom::augment() (.std.resid, .hat, .cooksd); stats::plogis() for predicted probabilities
Hold-out validation (ML mode)
base::sample() split + stats::predict(type = "response"); confusion matrix via base::table(); accuracy, sensitivity, specificity, precision, F1 from its cells
Discrimination (ML mode)
pROC::roc(levels = levels(y), direction = "<"), pROC::auc()
4 Default Methods & Parameters
Analysis
Step / Parameter
Default Method / Value
Model Fitting
Method
Binary logistic regression by maximum likelihood via glm() with binomial(link = "logit"); rows with missing values are removed listwise (na.omit()) before fitting
Outcome coding
The dependent variable is coerced to a factor; the second factor level is the modelled event (R convention). The outcome must carry exactly two distinct values
Categorical predictors
Character/logical predictors are converted to factors and dummy-coded; the reference level defaults to the first level and is user-adjustable (stats::relevel()), after which the model is refitted
Variable Selection
Stepwise (optional)
AIC-based MASS::stepAIC(trace = FALSE), backward elimination from the full model (the stepAIC default when no scope is supplied); the AIC trace and the final model are reported. Reported p-values and confidence intervals do not account for the selection step
Coefficient
Inference
Estimates
Estimate (log-odds), standard error, Wald z value, and p-value from summary()
Significance
Star codes at cut points 0.001 / 0.01 / 0.05 / 0.1
Odds ratios & intervals
OR = exp(β); 95% Wald confidence intervals exp(β ± qnorm(0.975)·SE) (not profile-likelihood; chosen to match the Wald z-tests in the same table)
Model Fit
Overall test
Likelihood-ratio χ² = null deviance − residual deviance, df = dfnull − dfresidual, p from pchisq(lower.tail = FALSE); AIC and −2 log-likelihood (deviance) reported alongside
car::vif() on the fitted GLM; low < 5, moderate 5–10, high > 10
Goodness of fit
Hosmer–Lemeshow decile-of-risk test with g = 10 groups from quantile(fitted(model)); duplicate breaks collapsed with unique(); df = groups − 2; reported as unavailable if fewer than 3 groups can be formed. p ≥ 0.05 indicates no evidence of poor fit
Linearity of the logit
Box–Tidwell check for each continuous predictor with all values > 0: the model is refitted with an added I(x·log(x)) term and the Wald p-value of that term is reported; predictors with zero/negative values are reported as not testable
Random train/test split of the complete-case data; training fraction user-set, default 80%; set.seed(123) for reproducibility. The model is fitted on the training rows only
Classification
Fixed threshold p̂ > 0.5 for the event class; confusion matrix via table(Observed, Predicted); accuracy = (TP+TN)/N, sensitivity = TP/(TP+FN), specificity = TN/(TN+FP), precision = TP/(TP+FP), F1 = 2·(precision·recall)/(precision+recall)
Discrimination
ROC curve and AUC via pROC::roc(test_outcome, predicted_probabilities, levels = levels(outcome), direction = "<")
5 R Code for Key Analytical Steps
The code blocks below demonstrate the exact computation behind each reported result using the mtcars dataset from the datasets package (outcome am, transmission type; predictors mpg and wt).
5.1 Model Fitting and Variable Selection
dat <-transform(mtcars, am =factor(am)) # second level "1" = modelled eventmodel_full <-glm(am ~ mpg + wt, data = dat, family =binomial(link ="logit"))# optional AIC-based stepwise selection (backward from the full model)model <- MASS::stepAIC(model_full, trace =FALSE)model$anova # AIC traceAIC(model_full); AIC(model)
RAISINS uses R for all its statistical computations. Every package used to generate major results is listed and demonstrated with examples, so results can be reproduced independently. These results are then organized and formatted on the RAISINS website along with visualisation to make them easier to use and interpret. RAISINS also has its own custom-built statistical tools for managing workflows, validating results, and generating reports. Details of these are not fully covered here, they’re shared with outside researchers only on request, and are subject to licensing terms.
7 Package References
R Core Team. (2025). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/
Venables, W. N., & Ripley, B. D. (2002). Modern Applied Statistics with S (4th ed.). Springer. https://www.stats.ox.ac.uk/pub/MASS4/
Fox, J., & Weisberg, S. (2019). An R Companion to Applied Regression (3rd ed.). Sage. https://socialsciences.mcmaster.ca/jfox/Books/Companion/
Robin, X., Turck, N., Hainard, A., Tiberti, N., Lisacek, F., Sanchez, J.-C., & Müller, M. (2011). pROC: an open-source package for R and S+ to analyze and compare ROC curves. BMC Bioinformatics, 12, 77. https://doi.org/10.1186/1471-2105-12-77
Robinson, D., Hayes, A., & Couch, S. (2025). broom: Convert Statistical Objects into Tidy Tibbles (R package version 1.0.13). https://CRAN.R-project.org/package=broom
Cox, D. R. (1958). The regression analysis of binary sequences. Journal of the Royal Statistical Society: Series B, 20(2), 215-232. https://doi.org/10.1111/j.2517-6161.1958.tb00292.x
Hosmer, D. W., Lemeshow, S., & Sturdivant, R. X. (2013). Applied Logistic Regression (3rd ed.). Wiley. https://doi.org/10.1002/9781118548387
Allaire, J. J., Xie, Y., Dervieux, C., McPherson, J., Luraschi, J., Ushey, K., Atkins, A., Wickham, H., Cheng, J., Chang, W., & Iannone, R. (2026). rmarkdown: Dynamic Documents for R (R package version 2.31). https://github.com/rstudio/rmarkdown