View source: R/print.savvySh.R
| print.savvySh_model | R Documentation |
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.
## S3 method for class 'savvySh_model'
print(x, digits = max(3, getOption("digits") - 3), estimator = NULL, ...)
x |
A fitted |
digits |
An integer specifying the number of significant digits to display when printing
coefficients and |
estimator |
A character vector naming one or more estimators for which coefficients should be printed.
Valid names are those present in |
... |
Additional arguments passed to |
This print method provides a quick diagnostic of the fitted model by showing:
A table that includes, for each estimator, the number of non-zero coefficients
and the optimal lambda (if applicable).
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.
Invisibly returns a data.frame summarizing each selected estimator's name, number of non-zero
coefficients, and the final optimal_lambda (if any).
Ziwei Chen, Vali Asimit, Marina Anca Cidota, Jennifer Asimit
Maintainer: Ziwei Chen <ziwei.chen.3@citystgeorges.ac.uk>
savvySh for fitting slab and shrinkage linear models,
coef.savvySh_model and predict.savvySh_model for extracting coefficients
and generating predictions.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.