Skip to contents

This function estimates coefficients in a linear regression model using several shrinkage methods, including Multiplicative Shrinkage, Slab Regression, Linear shrinkage, and Shrinkage Ridge Regression. Each method gives estimators that balance bias and variance by applying shrinkage to the ordinary least squares (OLS) solution. The shrinkage estimators are computed based on different assumptions about the data.

Usage

savvySh(x, y, model_class = c("Multiplicative", "Slab", "Linear", "ShrinkageRR"),
               v = 1, lambda_vals = NULL, nlambda = 100, folds = 10,
               foldid = FALSE, include_Sh = TRUE, exclude = NULL)

Arguments

x

A matrix of predictor variables.

y

A vector of response variable.

model_class

A character string specifying the shrinkage model to use. Options can choose from "Multiplicative", "Slab", "Linear", and "ShrinkageRR". The default is "Multiplicative". If the user supplies more than one model, a warning is issued and only the first option is used.

v

A positive number that sets the slab direction \(u = v\mathbf{1}\) of the SR estimator in the "Slab" model. The SR estimate is the same for every v > 0, so the default of 1 is enough.

lambda_vals

A vector of lambda values for RR. This is used only when multicollinearity (rank deficiency) is detected and "ShrinkageRR" is not selected. If NULL, a default sequence is used.

nlambda

The number of lambda values to use for cross-validation if lambda_vals is NULL. Only used when multicollinearity is present and "ShrinkageRR" is not called. The default is 100.

folds

Number of folds for cross-validation in RR. This is applicable only if multicollinearity occurs and "ShrinkageRR" is not chosen. The default is 10 and must be an integer >= 3.

foldid

Logical. If TRUE, saves the fold assignments in the output when multicollinearity is detected and "ShrinkageRR" is not used. The default is FALSE.

include_Sh

Logical. If FALSE, leaves the Sh estimator out of the "Multiplicative" model. The default is TRUE.

exclude

A vector specifying columns to exclude from the predictors. The default is NULL.

Value

A list containing the following elements:

call

The matched function call.

model

The data frame of y and x used in the analysis.

optimal_lambda

If x is full rank, this value is 0. If x is rank-deficient, it is the chosen RR lambda from cross-validation.

model_class

The selected model class.

coefficients

A list of estimated coefficients for each applicable estimator in the model_class.

fitted_values

A list of fitted values for each estimator.

pred_MSE

A list of prediction MSEs for each estimator.

ridge_results (optional)

A list containing detailed results from RR, used when multicollinearity (rank deficiency) is detected in x and the "ShrinkageRR" is not called. This element is included only when RR is applied instead of OLS due to the rank deficiency of x. It contains:

lambda_range

The range of lambda values used in the RR cross-validation.

cvm

A vector of cross-validated MSEs for each lambda in lambda_range.

cvsd

The standard deviation of the cross-validated MSEs for each lambda.

ridge_coefficients

A matrix of coefficients from RR at each lambda value, with each column representing the coefficients corresponding to a specific lambda.

Details

The Slab and Shrinkage Linear Regression Estimation methodology provides four classes of shrinkage estimators that reduce variance in the OLS solution by introducing a small, structured bias. These methods handle overfitting, collinearity, and high-dimensional scenarios by controlling how and where the coefficients are shrunk. Each class offers a distinct strategy for controlling instability and improving mean squared error (MSE) in linear models, tailored for different modeling contexts specified in the model_class argument. Note that if the user provides more than one option in model_class, only the first option is used, and a warning is issued.

Model Classes:

Multiplicative Shrinkage:

This class includes three estimators that use the OLS coefficients as a starting point and apply multiplicative adjustments:

St -

Stein estimator, which shrinks all coefficients toward zero by a single global factor. This aims to reduce MSE while keeping the overall bias fairly uniform across coefficients.

DSh -

Diagonal Shrinkage, assigning an individual factor to each coefficient based on its variance. This yields more targeted shrinkage than the global approach and often achieves a lower MSE.

Sh -

Shrinkage estimator with a full (non-diagonal) shrinkage matrix \(C^* = \beta\beta^\top\Sigma / (\sigma^2 + \beta^\top\Sigma\beta)\), which has a closed form. Left out if include_Sh = FALSE.

Slab Regression:

Slab Regression applies an adaptive quadratic penalty term to the OLS objective:

SR -

Simple Slab Regression, which modifies the OLS objective by adding a penalty in a fixed direction (the constant vector). The penalty has the closed form \(\mu^{**} = \sigma^2 / (\mathbf{1}^\top\beta)^2\) and does not require cross-validation. It can be viewed as a special case of the generalized lasso but focuses on smooth (quadratic) rather than \(\ell_1\) regularization.

GSR -

Generalized Slab Regression, extending SR by allowing shrinkage along multiple directions. Typically, these directions correspond to the eigenvectors of the design covariance matrix, effectively shrinking principal components.

Linear Shrinkage:

The Linear Shrinkage (LSh) estimator forms a convex combination of the OLS estimator (through the origin) and a target estimator that assumes uncorrelated predictors (diagonal approximation of the covariance). This approach is simpler than a full matrix method and is well-suited for standardized data where the intercept is not needed.

Shrinkage Ridge Regression:

The Shrinkage Ridge Regression (SRR) extends standard RR by shrinking the design covariance matrix toward a spherical target (i.e., a diagonal matrix with equal entries). This additional regularization stabilizes the eigenvalues and yields more robust coefficient estimates, particularly when the predictors lie close to a low-dimensional subspace.

References

Asimit, V., Cidota, M. A., Chen, Z., & Asimit, J. (2025). Slab and Shrinkage Linear Regression Estimation. Retrieved from https://openaccess.city.ac.uk/id/eprint/35005/

Author

Ziwei Chen, Vali Asimit, Marina Anca Cidota, Jennifer Asimit
Maintainer: Ziwei Chen <ziwei.chen.3@citystgeorges.ac.uk>

Examples

# 1. Simple Multiplicative Shrinkage example
set.seed(123)
x <- matrix(rnorm(100 * 5), 100, 5)
y <- rnorm(100)
fit_mult <- savvySh(x, y, model_class = "Multiplicative")
print(fit_mult)
#> 
#> Call:  savvySh(x = x, y = y, model_class = "Multiplicative") 
#> 
#> Model Class:  Multiplicative 
#> 
#>  Estimator Non.Zero.Coefficients Optimal.Lambda
#>         St                     6              0
#>        DSh                     6              0
#>         Sh                     6              0
#> 
#> Coefficients:
#> 
#> Estimator:  St 
#>  Coefficient  Estimate
#>  (Intercept) -0.030180
#>           V1 -0.004972
#>           V2  0.080780
#>           V3  0.007865
#>           V4 -0.047040
#>           V5  0.119800
#> 
#> Estimator:  DSh 
#>  Coefficient   Estimate
#>  (Intercept) -1.263e-02
#>           V1 -6.011e-05
#>           V2  9.691e-02
#>           V3  2.654e-04
#>           V4 -3.806e-02
#>           V5  1.744e-01
#> 
#> Estimator:  Sh 
#>  Coefficient  Estimate
#>  (Intercept) -0.046950
#>           V1 -0.007735
#>           V2  0.125700
#>           V3  0.012240
#>           V4 -0.073180
#>           V5  0.186400

# 2. Slab Regression example
fit_slab <- savvySh(x, y, model_class = "Slab", v = 2)
coef(fit_slab, estimator = "GSR")
#> (Intercept)          V1          V2          V3          V4          V5 
#> -0.03540364 -0.01506149  0.11620756  0.01846454 -0.06603580  0.10886905 

# 3. Linear Shrinkage (standardized data recommended)
x_centered <- scale(x, center = TRUE, scale = FALSE)
y_centered <- scale(y, center = TRUE, scale = FALSE)
fit_linear <- savvySh(x_centered, y_centered, model_class = "Linear")

# 4. Shrinkage Ridge Regression
fit_srr <- savvySh(x, y, model_class = "ShrinkageRR")
predict(fit_srr, newx = matrix(rnorm(10 * 5), 10, 5), type = "response")
#>  [1] -0.25867760  0.01738385  0.16061744  0.10445208  0.08829634 -0.01113267
#>  [7] -0.23515378 -0.25859448 -0.11367902  0.43954484