Predict Method for Slab and Shrinkage Linear Regression Models
predict.savvySh_model.Rd
Generate predictions (fitted values) or extract regression coefficients from a
savvySh_model
object returned by savvySh
. This function allows you to
specify one or more shrinkage estimators (via the estimator
parameter) available
in the model. If no estimator is specified, all available estimators are used and their
results are returned in a named list.
Arguments
- object
A fitted
savvySh_model
object produced bysavvySh
.- newx
A numeric matrix of new predictor data for which to generate predictions. This argument is required if
type = "response"
and is ignored iftype = "coefficients"
.- type
A character string specifying the output type. Options are
"response"
to return predicted values and"coefficients"
to extract regression coefficient vectors. Defaults to"response"
.- estimator
A character vector naming one or more shrinkage estimator(s) to use. These must match names present in
object$coefficients
. IfNULL
, all available estimators are used.- ...
Additional arguments (currently unused).
Value
If type = "response"
, the function returns:
A numeric vector of predicted values if exactly one estimator is specified;
Otherwise, a named list of numeric vectors, one for each specified estimator.
If type = "coefficients"
, the function returns:
A named numeric vector of regression coefficients if exactly one estimator is specified;
Otherwise, a named list of numeric vectors corresponding to each specified estimator.
Details
The behavior depends on the value of type
:
"response"
:Generates predicted values using the coefficient estimates from the specified shrinkage estimator(s) for new data supplied via
newx
."coefficients"
:Extracts the regression coefficient vector(s) corresponding to the specified estimator(s). Coefficient names are assigned based on whether an intercept is present (for Linear shrinkage, no intercept).
If no estimator
is specified, the function returns results for all available estimators
as a named list. If a single estimator is specified (or only one is provided in the vector), the result
is returned as a numeric vector (for coefficients) or a numeric vector of predictions (for response).
See also
savvySh
for fitting slab and shrinkage linear models,
coef.savvySh_model
for direct coefficient extraction.