Prediction from HAL fits

# S3 method for hal9001
predict(object, offset = NULL, ..., new_data, new_X_unpenalized = NULL)

Arguments

object

An object of class hal9001, containing the results of fitting the Highly Adaptive Lasso, as produced by fit_hal.

offset

A vector of offsets. Must be provided if provided at training

...

Additional arguments passed to predict as necessary.

new_data

A matrix or data.frame containing new data (observations NOT used in fitting the hal9001 object passed in via the object argument above) for which the hal9001 object will compute predicted values.

new_X_unpenalized

If the user supplied X_unpenalized during training, the user should also supply this matrix with the same number of observations as new_data. Optional.

Value

A numeric vector of predictions from a hal9001 object.

Details

Method for computing and extracting predictions from fits of the Highly Adaptive Lasso estimator, returned as a single S3 objects of class hal9001.

Note

This prediction method does not function similarly to the equivalent method from glmnet. In particular, this procedure will NOT return a subset of lambdas originally specified in calling fit_hal nor result in re-fitting. Instead, it will return predictions for all of the lambdas specified in the call to fit_hal that constructs object, when cv_select = FALSE. When cv_select = TRUE, predictions will only be returned for the value of lambda selected by cross-validation.