Dynamically Weighted Modified Maximum Likelihood (DWMML) Ridge Regression.
dwmmlRidge: An R Package for the DWMML Ridge Regression
This R package implements the dynamically weighted modified maximum likelihood ridge (DWMMLR) regression estimator: a robust and multicollinearity-aware linear regression estimator that combines the DWMML3 weighting procedure with ridge penalization. The method targets two common hurdles in linear modeling simultaneously: sensitivity to outliers and inflated variance due to multicollinearity.
The DWMML estimators were originally introduced by Sazak (2019) for univariate location and scale estimation, where three variants were proposed — DWMML1, DWMML2, and DWMML3 — differing in their balance between efficiency and robustness. The DWMML3 estimators, being asymptotically fully efficient and extremely robust, were selected for adaptation to ridge regression in this package. The ridge parameter k is selected automatically via the approach implemented in the ridgregextra R package (Karadağ and Sazak, 2022; Karadağ et al., 2023; Karadağ, Sazak & Aydın, 2026), which targets variance inflation factor (VIF) values close to but not below 1 as addressed in Kutner et al. (2004). This automatic and principled approach for selecting the ridge parameter enhances model interpretability and stability. This package offers a robust ridge regression solution adept at addressing issues of multicollinearity and outliers, providing DWMMLR estimates without requiring manual adjustment of the ridge parameter.
Functions
There are two functions in this package:
Weightedls.reg(sub-function): Given a data set and a user-supplied weight vectorW, it returns the weighted least squares regression results (coefficients, fitted values, residuals, standard errors, and related diagnostics).dwmmlR.reg(main function): Givenxandy, it automatically determines the ridge parameter and returns the DWMML ridge regression results end-to-end.
Features
- Robust ridge regression using the DWMML3 weighting procedure (dynamically downweights outliers while stabilizing estimates under high collinearity).
- Asymptotically fully efficient under the normal distribution, with extreme robustness under outlier contamination, especially for large sample sizes and high correlations.
- Automatic ridge parameter selection via
ridgregextra(Karadağ et al., 2023; Karadağ, Sazak & Aydın, 2026), ensuring VIF values remain at or above 1 following Kutner et al. (2004); no manual tuning required. - Comprehensive outputs: coefficients, fitted values, residuals, model mean squared error (MSE), coefficient standard errors, R² and adjusted R² values.
- Simple main entry point (
dwmmlR.reg) with a familiar x/y interface.
Installation
Installing the development version from GitHub
Make sure you have devtools installed first:
install.packages("devtools")
Then install the package:
devtools::install_github("filizkrdg/dwmmlRidge")
Installing from CRAN
install.packages("dwmmlRidge")
When you install dwmmlRidge, the required Styperidge.reg package will be installed automatically via dependencies. For example data, you can install and load the isdals package (it contains the bodyfat data set).
Example Usage
library(isdals)
data(bodyfat)
x <- bodyfat[, -1]
y <- bodyfat[, 1]
## Run dwmmlR.reg to get ridge regression results
## using the DWMML ridge regression estimator
dwmmlridge <- dwmmlR.reg(x, y)
dwmmlridge$MSE
dwmmlridge$stdbeta
## Run Weightedls.reg to fit a weighted least squares regression
## using x, y, and W (weights); returns coefficients, fitted values,
## residuals, standard errors, and diagnostics
n <- nrow(x)
W <- runif(n, min = 0, max = 1)
weightedlsreg <- Weightedls.reg(x, y, W)
weightedlsreg$MSE
weightedlsreg$stdbeta
References
- Karadağ, F. and Sazak, H. S. (2022). "R Algorithm for Ridge Parameter Estimation in Ridge Regression." Why R? Turkey 2022 Conference, online, Verbal, Summary Text, p. 13. Link
- Karadağ, F., Sazak, H. S., and Aydın, O. (2023). ridgregextra: Ridge Regression Parameter Estimation. R package version 0.1.1. CRAN
- Kutner, M. H., Nachtsheim, C. J., Neter, J., and Li, W. (2004). Applied Linear Statistical Models.
- Karadağ, F., Sazak, H. S., and Aydın, O. (2026). "ridgregextra: an alternative R package for ridge regression parameter estimation." Journal of Applied Statistics, 1–23. https://doi.org/10.1080/02664763.2026.2655681
- Sazak, H. S. (2019). "The combined dynamically weighted modified maximum likelihood estimators of the location and scale parameters." Journal of Statistical Computation and Simulation, 89(5), 751–762. https://doi.org/10.1080/00949655.2019.1571060
Contact
For any questions, please contact:
- Filiz Karadağ — [email protected]
- Hakan Savaş Sazak — [email protected]
- Olgun Aydın — [email protected].