| Type: | Package |
| Title: | Dynamically Weighted Modified Maximum Likelihood (DWMML) Ridge Regression |
| Version: | 0.1.1 |
| Description: | 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 of Sazak (2019) <doi:10.1080/00949655.2019.1571060> with ridge penalization to address both outlier sensitivity and variance inflation due to multicollinearity. The ridge parameter is selected automatically using the approach implemented in the 'ridgregextra' package (Karadag, Sazak, and Aydin, 2023) https://CRAN.R-project.org/package=ridgregextra, described further in Karadag, Sazak, and Aydin (2026) <doi:10.1080/02664763.2026.2655681>, which targets a variance inflation factor (VIF) close to but not below 1, removing the need for manual tuning. Returns comprehensive outputs (coefficients, fitted values, residuals, mean squared error (MSE), standard errors, R-squared, and adjusted R-squared) through a simple x/y interface. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.0.0) |
| Imports: | MASS, stats, Styperidge.reg |
| Suggests: | isdals, mctest |
| Enhances: | ridgregextra |
| URL: | https://github.com/filizkrdg/dwmmlRidge |
| BugReports: | https://github.com/filizkrdg/dwmmlRidge/issues |
| RoxygenNote: | 7.3.2 |
| NeedsCompilation: | no |
| Packaged: | 2026-06-22 18:02:59 UTC; pc |
| Author: | Filiz Karadag |
| Maintainer: | Filiz Karadag <filiz.karadag@ege.edu.tr> |
| Repository: | CRAN |
| Date/Publication: | 2026-06-26 10:10:02 UTC |
Weighted least squares regression
Description
Fits a weighted least squares (WLS) regression model with an intercept
term. Weights can be supplied as a vector, a single-column data frame, or
a square weight matrix. If a vector or data frame is supplied, it is
internally converted to a diagonal weight matrix.
In the example below, the weight vector W is generated from a
Uniform(0, 1) distribution purely to illustrate how to call the function.
In practice, users should provide weights that reflect the structure of
their data (e.g., from variance estimates or a robust weighting scheme).
Usage
Weightedls.reg(x, y, W)
Arguments
x |
Explanatory variables. A data.frame or matrix with observations in rows and predictors in columns. |
y |
Dependent variable. A numeric vector, data.frame, or matrix. For a
univariate response, this should be a length- |
W |
Observation weights. Can be
If |
Value
A list with the following components:
- beta
Numeric matrix (
(p+1) x 1). Estimated regression coefficients, including the intercept in the first row.- e
Numeric matrix (
n x 1). Residuals (y - yhat).- ew
Numeric matrix (
n x 1). Weighted residuals (W^(1/2) %*% e).- yhat
Numeric matrix (
n x 1). Fitted values (X %*% beta).- yhatw
Numeric matrix (
n x 1). Fitted values in the weighted space (Xw %*% beta).- MSE
Numeric scalar. Mean squared error computed from weighted residuals.
- F
Numeric scalar. Overall model F statistic based on the weighted ANOVA decomposition.
- sig
Numeric scalar. P-value associated with
F.- varbeta
Numeric matrix (
(p+1) x (p+1)). Estimated covariance matrix ofbeta.- stdbeta
Numeric vector (length
p+1). Standard errors ofbeta.- R2
Numeric scalar. Weighted coefficient of determination (R-squared).
- R2adj
Numeric scalar. Adjusted weighted R-squared.
- anovatable
A
data.frame. ANOVA-style table with sums of squares, degrees of freedom, mean squares,F, and p-value.- confint
Numeric matrix (
2 x (p+1)). Confidence intervals forbeta; first row is lower, second row is upper.
Examples
if (requireNamespace("isdals", quietly = TRUE)) {
data(bodyfat, package = "isdals")
x <- bodyfat[, -1]
y <- bodyfat[, 1]
n <- nrow(x)
W <- runif(n, min = 0, max = 1)
fit <- Weightedls.reg(x, y, W)
fit$beta
fit$R2
fit$anovatable
}
DWMML3 Ridge Regression Estimator
Description
Full regression results using the DWMML3 Ridge Regression Estimator
Usage
dwmmlR.reg(x, y)
Arguments
x |
A numeric vector or matrix of predictor variables. |
y |
A numeric vector or matrix of response values. |
Value
A list containing 'esttabledataframe', 'stdtabledataframe', and additional model diagnostics.
See Also
Weightedridge.reg for the underlying
weighted ridge regression implementation,
ridgereg_k for the ridge parameter
selection method used internally by Styperidge.reg.
Examples
if (requireNamespace("mctest", quietly = TRUE)) {
data(Hald, package = "mctest")
x <- Hald[, -1]
y <- Hald[, 1]
fit <- dwmmlR.reg(x, y)
fit$esttabledataframe
}
if (requireNamespace("isdals", quietly = TRUE)) {
data(bodyfat, package = "isdals")
x <- bodyfat[, -1]
y <- bodyfat[, 1]
fit <- dwmmlR.reg(x, y)
fit$esttabledataframe
}