This function returns coefficients from a model fit by SLOPE().
Arguments
- object
an object of class
'SLOPE'.- alpha
penalty parameter for SLOPE models; if
NULL, the values used in the original fit will be used- exact
if
TRUEand the given parameter values differ from those in the original fit, the model will be refit by callingstats::update()on the object with the new parameters. IfFALSE, the predicted values will be based on interpolated coefficients from the original penalty path.- simplify
if
TRUE,base::drop()will be called before returning the coefficients to drop extraneous dimensions- intercept
whether to include the intercept in the output; only applicable when
simplify = TRUEand an intercept has been fit.- scale
whether to return the coefficients in the original scale or in the normalized scale.
- sigma
deprecated. Please use
alphainstead.- ...
arguments that are passed on to
stats::update()(and therefore also toSLOPE()) ifexact = TRUEand the given penalty is not inobject
Details
If exact = FALSE and alpha is not in object,
then the returned coefficients will be approximated by linear interpolation.
If coefficients from another type of penalty sequence
(with a different lambda) are required, however,
please use SLOPE() to refit the model.
See also
Other SLOPE-methods:
deviance.SLOPE(),
plot.SLOPE(),
predict.SLOPE(),
print.SLOPE(),
score()
Examples
fit <- SLOPE(mtcars$mpg, mtcars$vs, path_length = 10)
coef(fit)
#> 2 x 8 sparse Matrix of class "dgCMatrix"
#>
#> [1,] 0.4375 -0.27721605 -0.53407168 -0.62638081 -0.65955499 -0.67147717
#> [2,] . 0.03557461 0.04835946 0.05295409 0.05460532 0.05519874
#>
#> [1,] -0.6757618 -0.67730159
#> [2,] 0.0554120 0.05548865
coef(fit, scale = "normalized")
#> 2 x 8 sparse Matrix of class "dgCMatrix"
#>
#> [1,] 0.4375 0.4375000 0.4375000 0.4375000 0.4375000 0.4375000 0.4375000
#> [2,] . 0.2110296 0.2868697 0.3141252 0.3239204 0.3274406 0.3287056
#>
#> [1,] 0.4375000
#> [2,] 0.3291603
