This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Regression Analysis 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
log, log10, sqrt, inverse 1/Y, or square Y^2. A transformation that is invalid for the data (e.g. log with non-positive Y) is skipped and the untransformed model is fitted. Predictions are back-transformed to the original scale; log back-transformation yields the median, not the mean, response
Variable Selection
Stepwise (optional)
AIC-based MASS::stepAIC(); direction both (default), forward, or backward; initial and final AIC are reported. Reported p-values and confidence intervals do not account for the selection step
Coefficient
Inference
Estimates
Estimate, standard error, t value, and p-value from summary()
Significance
Star codes assigned with symnum() at cut points 0.001 / 0.01 / 0.05
Intervals & standardised
95% confidence intervals via confint(); standardised coefficients via effectsize::standardize_parameters(method = "refit")
Model Fit
ANOVA
Sequential (Type I) decomposition via anova()
Metrics
R², adjusted R², residual standard error, F-statistic and p-value, AIC, BIC, RMSE, MAE, and the leave-one-out PRESS statistic (DAAG::press()). All are computed on the model (possibly transformed) scale
Regression
Assumptions
Multicollinearity
car::vif() (VIF; GVIF for categorical predictors); low < 5, moderate 5–10, high > 10; computed only when the model has more than two coefficients. For the GVIF case the reported GVIF^(1/(2·Df)) is squared before these thresholds are applied
Heteroscedasticity
car::ncvTest() non-constant error variance score test (Breusch-Pagan); p < 0.05 indicates heteroscedasticity
Residual normality
Shapiro-Wilk on residuals (shapiro.test()) for 3 ≤ n ≤ 5000; moments::jarque.test() for n > 5000
Autocorrelation
Durbin-Watson test, two-sided (lmtest::dwtest(alternative = "two.sided")); the verdict follows the test p-value, with the statistic (≈ 2 independent, < 2 positive, > 2 negative) giving the direction. ACF of residuals is computed when n ≥ 10
Influence
Diagnostics
Measures & thresholds
Leverage (hatvalues(), flag > 2p/n), Cook's distance (flag > 4/n), standardised and studentised residuals (|studentised| > 2 potential, > 3 extreme), and DFFITS
Hold-out
Validation
(ML mode, optional)
Split
Random train/test split of the complete-case data; training fraction user-set, default 80% (clamped to 50–95%); set.seed(123) for reproducibility
Test metrics
RMSE, MSE, test-set SSE, test R² = 1 − SSE/SST, and an approximate adjusted test R², computed on predictions back-transformed to the original response scale. Distinct from the leave-one-out PRESS reported under Model Fit
Prediction
Intervals
predict(); the fitted regression line is displayed with a 95% confidence band
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.
5.1 Model Fitting and Variable Selection
data(mtcars)model_full <-lm(mpg ~ wt + hp + disp, data = mtcars)# optional AIC-based stepwise selection# direction: "both" (default), "forward", or "backward"model <- MASS::stepAIC(model_full, direction ="both", trace =FALSE)AIC(model_full); AIC(model)
car::vif(model) # multicollinearity (VIF / GVIF)car::ncvTest(model) # non-constant error variance (heteroscedasticity)# normality of residuals: Shapiro-Wilk up to n = 5000, Jarque-Bera beyondr <-residuals(model)if (length(r) >5000) moments::jarque.test(as.numeric(r)) elseshapiro.test(r)lmtest::dwtest(model, alternative ="two.sided") # autocorrelation (Durbin-Watson)acf(residuals(model), plot =FALSE) # ACF of residuals (n >= 10)
For a GVIF matrix (categorical predictors) the last column, GVIF^(1/(2·Df)), is on a standard-deviation scale and is squared before the usual VIF thresholds (5 / 10) are applied:
v <- car::vif(model)if (is.matrix(v)) v[, ncol(v)]^2else v # values on the VIF scale
5.6 Response Transformation and Back-Transformation
# a transformation is applied on the model's left-hand side, e.g. log(mpg) ~ ...model_log <-lm(log(mpg) ~ wt + hp, data = mtcars)# predictions are returned to the original response scale for reporting;# note that exp() of a log-scale prediction estimates the MEDIAN responsepred_log <-predict(model_log, newdata = mtcars)exp(pred_log)
5.7 Prediction
newdata <-data.frame(wt =3.0, hp =120, disp =160)predict(model, newdata) # fitted valuepredict(model, newdata, interval ="confidence", level =0.95) # mean response# the regression-line plot displays the 95% confidence band around the fit
5.8 Hold-out Validation (Machine-Learning Mode)
df <-na.omit(mtcars)n <-nrow(df)set.seed(123) # reproducible splittrain_pct <-80# user-set, clamped to 50-95idx <-sample(seq_len(n), size =floor((train_pct /100) * n))trainSet <- df[idx, ]testSet <- df[-idx, ]fit <-lm(mpg ~ wt + hp + disp, data = trainSet)preds <-predict(fit, newdata = testSet) # back-transformed if Y was transformedactual <- testSet$mpgss_res <-sum((actual - preds)^2)ss_tot <-sum((actual -mean(actual))^2)sqrt(mean((actual - preds)^2)) # RMSEmean((actual - preds)^2) # MSEss_res # test-set SSE (not leave-one-out PRESS)1- ss_res / ss_tot # test R-squared
Explore the entire Regression Analysis module in preview mode using our demo datasets. To submit suggestions or report a workflow issue, please use the discussion section below, or visit the official RAISINS website.
6 RAISINS Native Statistical Framework
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/
Zeileis, A., & Hothorn, T. (2002). Diagnostic Checking in Regression Relationships. R News, 2(3), 7-10. https://CRAN.R-project.org/doc/Rnews/
Ben-Shachar, M. S., Lüdecke, D., & Makowski, D. (2020). effectsize: Estimation of Effect Size Indices and Standardized Parameters. Journal of Open Source Software, 5(56), 2815. https://doi.org/10.21105/joss.02815
Maindonald, J. H., & Braun, W. J. (2024). DAAG: Data Analysis and Graphics Data and Functions (R package version 1.25.7). https://CRAN.R-project.org/package=DAAG
Komsta, L., & Novomestky, F. (2022). moments: Moments, Cumulants, Skewness, Kurtosis and Related Tests (R package version 0.14.1). https://CRAN.R-project.org/package=moments
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
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