| coef.savvySh_model | R Documentation |
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.
## S3 method for class 'savvySh_model'
coef(object, estimator = NULL, ...)
object |
A fitted |
estimator |
A character vector naming one or more estimators from which to extract coefficients.
Valid names are those stored in |
... |
Additional arguments passed to |
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.
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.
Ziwei Chen, Vali Asimit, Marina Anca Cidota, Jennifer Asimit
Maintainer: Ziwei Chen <ziwei.chen.3@citystgeorges.ac.uk>
predict.savvySh_model for generating predictions,
savvySh for fitting slab and shrinkage linear models.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.