refit: Refit SLOPE Model with Optimal Parameters

View source: R/refit.R

refitR Documentation

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, ...)

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()

Value

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

See Also

SLOPE()

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

Examples

# 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)


SLOPE documentation built on Jan. 28, 2026, 9:07 a.m.