Package 'dwmmlRidge'

Title: Dynamically Weighted Modified Maximum Likelihood (DWMML) Ridge Regression
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.
Authors: Filiz Karadag [aut, cre] (ORCID: <https://orcid.org/0000-0002-0116-7772>), Hakan Savas Sazak [aut] (ORCID: <https://orcid.org/0000-0001-6123-1214>), Olgun Aydin [aut] (ORCID: <https://orcid.org/0000-0002-7090-0931>)
Maintainer: Filiz Karadag <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2026-06-27 09:37:36 UTC
Source: https://github.com/filizkrdg/dwmmlridge

Help Index


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
}

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-n vector or an n x 1 matrix.

W

Observation weights. Can be

  • a numeric vector of length n, or

  • a single-column data.frame of length n, or

  • an n x n weight matrix.

If W is a vector or data.frame, the function converts it to diag(W) internally.

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 of beta.

stdbeta

Numeric vector (length p+1). Standard errors of beta.

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 for beta; 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
}