Package {RSO}


Title: Ridge Selection Operator for Sparse Linear Regression
Version: 1.0.0
Description: Implements the Ridge Selection Operator (RSO) for variable selection in linear regression as proposed by Wu (2021) <doi:10.1080/00401706.2020.1791254>. The RSO method extends classical ridge regression by using individually penalized ridge parameters, inducing sparsity through reciprocal penalty parameters. This package provides a fast C++ implementation ('RSOFast') using 'Armadillo' linear algebra routines. The fast implementation precomputes matrix products, uses Cholesky factorization with primal/dual switching, and performs golden-section search for coordinate optimization.
License: GPL (≥ 3)
Encoding: UTF-8
RoxygenNote: 7.3.2
LinkingTo: Rcpp, RcppArmadillo
Imports: Rcpp
NeedsCompilation: yes
Packaged: 2026-06-30 11:07:05 UTC; murat
Author: Murat Genc [aut, cre], Adewale Lukman [aut]
Maintainer: Murat Genc <mgenc@cu.edu.tr>
Repository: CRAN
Date/Publication: 2026-07-06 11:50:14 UTC

RSO: Ridge Selection Operator for Sparse Linear Regression

Description

Implements the Ridge Selection Operator (RSO) for variable selection in linear regression as proposed by Wu (2021) doi:10.1080/00401706.2020.1791254. The RSO method extends classical ridge regression by using individually penalized ridge parameters, inducing sparsity through reciprocal penalty parameters. This package provides a fast C++ implementation ('RSOFast') using 'Armadillo' linear algebra routines. The fast implementation precomputes matrix products, uses Cholesky factorization with primal/dual switching, and performs golden-section search for coordinate optimization.

Author(s)

Maintainer: Murat Genc mgenc@cu.edu.tr

Authors:


Fast RSO (Ridge Selection Operator)

Description

Implements the modified coordinate descent algorithm for RSO as described in Wu (2021). Solves for optimal lambda parameters that minimize SSR subject to sum(lambda) = tau and lambda >= 0.

Usage

RSOFast(x, y, tau, penalty.factor = rep(1, ncol(x)), gaminit = NULL)

Arguments

x

Centered predictor matrix (n x p)

y

Centered response vector (n x 1)

tau

Regularization parameter (sum of lambda)

penalty.factor

Adaptive penalty factors (p x 1), default = 1 for RSO

gaminit

Initial lambda values. If NULL, uses tau/p for all.

Value

A list containing:

gamma

Optimal lambda vector (p x 1)

lambda

Alias for gamma

coefficients

Coefficient estimates (p x 1)

coef

Alias for coefficients

df

Degrees of freedom

ssr

Sum of squared residuals

iterations

Number of iterations

converged

Convergence status

n_selected

Number of selected variables

tau

Original tau parameter

References

Wu, Y. (2021). Can't ridge regression perform variable selection?. Technometrics, 63(2), 263-271. doi:10.1080/00401706.2020.1791254

Examples

n <- 100; p <- 10
x <- matrix(rnorm(n*p), n, p)
x <- scale(x, scale = FALSE)
y <- rnorm(n)
y <- y - mean(y)
result <- RSOFast(x, y, tau = 1.0, rep(1, p))


Individually Penalized Ridge Regression with Precomputed Matrices

Description

Computes the sum of squared residuals (SSR) for individually penalized ridge regression using precomputed X'X and X'y matrices. This is optimized for repeated calls with the same x matrix but different gam parameters (e.g., during grid search).

Usage

ridgeRegPrecomp(x, y, gam, penalty.factor = rep(1, length(gam)), precomp)

Arguments

x

Centered predictor matrix (n x p)

y

Centered response vector (n x 1)

gam

Ridge penalty parameters vector (p x 1) where gam_j = 1/nu_j

penalty.factor

Adaptive penalty factors (p x 1), default = 1 for RSO

precomp

List containing precomputed values:

  • xtx: X'X matrix (p x p)

  • xty: X'y vector (p x 1)

Value

Sum of squared residuals (SSR)

Examples

n <- 100; p <- 10
x <- matrix(rnorm(n*p), n, p)
x <- scale(x, scale = FALSE)
y <- rnorm(n)
y <- y - mean(y)
precomp <- list(xtx = crossprod(x), xty = crossprod(x,y))
gam <- runif(p)
result <- ridgeRegPrecomp(x, y, gam, rep(1, p), precomp)


Individually Penalized Ridge Regression

Description

Computes the sum of squared residuals (SSR) for individually penalized ridge regression without explicitly forming the hat matrix. Uses Cholesky decomposition for speed and numerical stability.

Usage

ridgereg(x, y, gam, penalty.factor = rep(1, length(gam)))

Arguments

x

Centered predictor matrix (n x p)

y

Centered response vector (n x 1)

gam

Ridge penalty parameters vector (p x 1) where gam_j = 1/nu_j

penalty.factor

Adaptive penalty factors (p x 1), default = 1 for RSO

Value

Sum of squared residuals (SSR)

Examples

n <- 100; p <- 10
x <- matrix(rnorm(n*p), n, p)
x <- scale(x, scale = FALSE)
y <- rnorm(n)
y <- y - mean(y)
gam <- runif(p)
result <- ridgereg(x, y, gam, rep(1, p))


Ridge Regression with Degrees of Freedom

Description

Computes the sum of squared residuals (SSR), degrees of freedom (trace of hat matrix), and coefficient estimates for ridge regression. Uses Cholesky decomposition for speed and numerical stability.

Usage

ridgereg_df(x, y, gam, penalty.factor = rep(1, length(gam)))

Arguments

x

Centered predictor matrix (n x p)

y

Centered response vector (n x 1)

gam

Ridge penalty parameters vector (p x 1) where gam_j = 1/nu_j

penalty.factor

Adaptive penalty factors (p x 1), default = 1 for RSO

Value

A list containing:

ssr

Sum of squared residuals

df

Degrees of freedom (trace of hat matrix)

coef

Coefficient estimates (p x 1)

Examples

n <- 100; p <- 10
x <- matrix(rnorm(n*p), n, p)
x <- scale(x, scale = FALSE)
y <- rnorm(n)
y <- y - mean(y)
gam <- runif(p)
result <- ridgereg_df(x, y, gam, rep(1, p))