print.savvySh_model: Print a Slab and Shrinkage Model Summary

View source: R/print.savvySh.R

print.savvySh_modelR Documentation

Print a Slab and Shrinkage Model Summary

Description

Displays a concise summary of a fitted savvySh_model object, including the original function call, the chosen model class, the number of non-zero coefficients per estimator, and the optimal lambda value (if applicable). Additionally, it prints the coefficients for the specified estimator(s) with user-specified precision.

Usage

## S3 method for class 'savvySh_model'
print(x, digits = max(3, getOption("digits") - 3), estimator = NULL, ...)

Arguments

x

A fitted savvySh_model object returned by savvySh.

digits

An integer specifying the number of significant digits to display when printing coefficients and lambda. Defaults to max(3, getOption("digits") - 3).

estimator

A character vector naming one or more estimators for which coefficients should be printed. Valid names are those present in x$coefficients (e.g., "St", "DSh", "Sh", "SR", "GSR", or "ShrinkageRR"). If NULL, coefficients for all estimators are printed.

...

Additional arguments passed to print (currently unused).

Details

This print method provides a quick diagnostic of the fitted model by showing:

Summary Metrics

A table that includes, for each estimator, the number of non-zero coefficients and the optimal lambda (if applicable).

Coefficients

For each selected estimator, the coefficients are printed with appropriate names: if an intercept is present, it is labeled (Intercept) and the remaining coefficients are labeled according to the predictor names.

If the user does not specify an estimator using the estimator argument, the function prints information for all available estimators stored in the model. If one or more estimators are specified, only those are printed, after verifying that they exist in x$coefficients.

The method invisibly returns a summary data.frame containing key metrics for each estimator.

Value

Invisibly returns a data.frame summarizing each selected estimator's name, number of non-zero coefficients, and the final optimal_lambda (if any).

Author(s)

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

See Also

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

Examples

# Generate simulated data for demonstration
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)

# Default print: shows summary metrics and coefficients for all estimators
print(fit)

# Print with specific digits and only for one estimator
print(fit, digits = 4, estimator = "St")


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