Learn R Programming

SLOPE (version 2.0.0)

refit: Refit SLOPE Model with Optimal Parameters

Description

Refits a SLOPE model using the optimal parameters found through cross-validation. This is a convenience function to avoid having to manually extract optimal parameters and refit.

Usage

refit(object, x, y, measure = NULL, ...)

Value

An object of class 'SLOPE' fit with the optimal parameters

Arguments

object

an object of class 'TrainedSLOPE', typically from a call to cvSLOPE() or trainSLOPE()

x

the design matrix

y

the response vector

measure

which performance measure to use for selecting optimal parameters. If NULL (default), uses the first measure in the TrainedSLOPE object.

...

additional arguments passed to SLOPE()

See Also

SLOPE()

Other model-tuning: cvSLOPE(), plot.TrainedSLOPE(), summary.TrainedSLOPE(), trainSLOPE()

Examples

Run this code
# Cross-validation
tune <- trainSLOPE(
  bodyfat$x,
  bodyfat$y,
  q = c(0.1, 0.2),
  measure = "mse"
)

# Refit with optimal parameters
fit <- refit(tune, bodyfat$x, bodyfat$y)

# Use the fitted model
coef(fit)
predict(fit, bodyfat$x)

Run the code above in your browser using DataLab