coef.savvySh_model: Extract Coefficients for a Slab and Shrinkage Linear...

View source: R/coef.savvySh.R

coef.savvySh_modelR Documentation

Extract Coefficients for a Slab and Shrinkage Linear Regression Model

Description

Extracts the regression coefficients from a savvySh_model object. You may specify one or more shrinkage estimators through the estimator parameter. If no estimator is specified, the function returns coefficients for all available estimators as a named list.

Usage

## S3 method for class 'savvySh_model'
coef(object, estimator = NULL, ...)

Arguments

object

A fitted savvySh_model object produced by savvySh.

estimator

A character vector naming one or more estimators from which to extract coefficients. Valid names are those stored in object$coefficients (e.g., "St", "DSh", "Sh", "SR", "GSR", etc.). If NULL, coefficients for all available estimators are returned.

...

Additional arguments passed to predict.savvySh_model.

Details

This function internally calls predict.savvySh_model with type = "coefficients" to retrieve the desired coefficient estimates. If multiple estimators are requested (or if none is specified, in which case all are returned), the output is a named list in which each element is a numeric vector of coefficients. The coefficient vectors are named according to whether an intercept is present (for Linear shrinkage, no intercept). If a single estimator is specified, a single named numeric vector is returned.

Value

A named numeric vector of regression coefficients if a single estimator is specified, or a named list of such vectors if multiple estimators are requested.

Author(s)

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

See Also

predict.savvySh_model for generating predictions, savvySh for fitting slab and shrinkage linear models.

Examples

# Generate simulated data for example
set.seed(123)
x <- matrix(rnorm(100 * 5), 100, 5)
y <- rnorm(100)

# Fit a Multiplicative shrinkage model
fit <- savvySh(x, y, model_class = "Multiplicative", include_Sh = TRUE)

# Extract coefficients for all available estimators (St and DSh by default)
all_coefs <- coef(fit)

# Extract coefficients for a specific estimator
st_coefs <- coef(fit, estimator = "St")
print(st_coefs)


savvySh documentation built on March 3, 2026, 5:08 p.m.