Return predictions from models fit by SLOPE()
.
Usage
# S3 method for class 'SLOPE'
predict(object, x, alpha = NULL, type = "link", simplify = TRUE, sigma, ...)
# S3 method for class 'GaussianSLOPE'
predict(
object,
x,
sigma = NULL,
type = c("link", "response"),
simplify = TRUE,
...
)
# S3 method for class 'BinomialSLOPE'
predict(
object,
x,
sigma = NULL,
type = c("link", "response", "class"),
simplify = TRUE,
...
)
# S3 method for class 'PoissonSLOPE'
predict(
object,
x,
sigma = NULL,
type = c("link", "response"),
exact = FALSE,
simplify = TRUE,
...
)
# S3 method for class 'MultinomialSLOPE'
predict(
object,
x,
sigma = NULL,
type = c("link", "response", "class"),
exact = FALSE,
simplify = TRUE,
...
)
Arguments
- object
an object of class
"SLOPE"
, typically the result of a call toSLOPE()
- x
new data
- alpha
penalty parameter for SLOPE models; if
NULL
, the values used in the original fit will be used- type
type of prediction;
"link"
returns the linear predictors,"response"
returns the result of applying the link function, and"class"
returns class predictions.- simplify
if
TRUE
,base::drop()
will be called before returning the coefficients to drop extraneous dimensions- sigma
deprecated. Please use
alpha
instead.- ...
ignored and only here for method consistency
- exact
if
TRUE
and 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.
See also
stats::predict()
, stats::predict.glm()
, coef.SLOPE()
Other SLOPE-methods:
coef.SLOPE()
,
deviance.SLOPE()
,
plot.SLOPE()
,
print.SLOPE()
,
score()
Examples
fit <- with(mtcars, SLOPE(cbind(mpg, hp), vs, family = "binomial"))
predict(fit, with(mtcars, cbind(mpg, hp)), type = "class")
#> [1] "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"
#> [19] "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "1" "0"
#> [37] "0" "0" "0" "1" "1" "0" "0" "0" "0" "0" "0" "0" "0" "1" "1" "1" "1" "0"
#> [55] "0" "0" "0" "1" "1" "1" "0" "0" "0" "0" "1" "1" "1" "1" "0" "1" "0" "1"
#> [73] "1" "0" "0" "0" "0" "0" "0" "0" "0" "1" "1" "1" "1" "0" "0" "0" "0" "1"
#> [91] "1" "1" "0" "0" "0" "1" "1" "1" "1" "1" "0" "1" "0" "1" "1" "0" "0" "0"
#> [109] "0" "0" "0" "0" "0" "1" "1" "1" "1" "0" "0" "0" "0" "1" "1" "1" "0" "0"
#> [127] "0" "1" "1" "1" "1" "1" "0" "1" "0" "1" "1" "1" "0" "0" "0" "0" "0" "0"
#> [145] "0" "1" "1" "1" "1" "0" "0" "0" "0" "1" "1" "1" "0" "0" "0" "1" "1" "1"
#> [163] "1" "1" "0" "1" "0" "1" "1" "1" "1" "0" "0" "0" "0" "0" "0" "1" "1" "1"
#> [181] "1" "0" "0" "0" "0" "1" "1" "1" "0" "0" "0" "1" "1" "1" "1" "1" "0" "1"
#> [199] "0" "1" "1" "1" "1" "0" "0" "0" "0" "0" "0" "1" "1" "1" "1" "0" "0" "0"
#> [217] "0" "1" "1" "1" "0" "0" "0" "1" "1" "1" "1" "1" "0" "1" "0" "1" "1" "1"
#> [235] "1" "0" "0" "0" "0" "0" "0" "1" "1" "1" "1" "0" "0" "0" "0" "1" "1" "1"
#> [253] "0" "0" "0" "1" "1" "1" "1" "1" "0" "1" "0" "1" "1" "1" "1" "0" "0" "0"
#> [271] "0" "0" "0" "1" "1" "1" "1" "0" "0" "0" "0" "1" "1" "1" "0" "0" "0" "1"
#> [289] "1" "1" "1" "1" "0" "1" "0" "1" "1" "0" "0" "0" "0" "0" "0" "0" "0" "1"
#> [307] "1" "1" "1" "0" "0" "0" "0" "1" "1" "1" "0" "0" "0" "1" "1" "1" "1" "1"
#> [325] "0" "1" "0" "1" "1" "0" "0" "0" "0" "0" "0" "0" "0" "1" "1" "1" "1" "0"
#> [343] "0" "0" "0" "1" "1" "1" "0" "0" "0" "1" "1" "1" "1" "1" "0" "1" "0" "1"
#> [361] "1" "0" "0" "0" "0" "0" "0" "0" "0" "1" "1" "1" "1" "0" "0" "0" "0" "1"
#> [379] "1" "1" "0" "0" "0" "1" "1" "1" "1" "1" "0" "1" "0" "1" "1" "0" "1" "0"
#> [397] "0" "0" "0" "0" "0" "1" "1" "1" "1" "0" "0" "0" "0" "1" "1" "1" "0" "0"
#> [415] "0" "1" "1" "1" "1" "1" "0" "1" "0" "1" "1" "0" "1" "0" "0" "0" "0" "0"
#> [433] "0" "1" "1" "1" "1" "0" "0" "0" "0" "1" "1" "1" "0" "0" "0" "1" "1" "1"
#> [451] "1" "1" "0" "1" "0" "1" "1" "0" "1" "0" "0" "0" "0" "0" "0" "1" "1" "1"
#> [469] "1" "0" "0" "0" "0" "1" "1" "1" "0" "0" "0" "1" "1" "1" "1" "1" "0" "1"
#> [487] "0" "1" "1" "0" "1" "0" "0" "0" "0" "0" "0" "1" "1" "1" "1" "0" "0" "0"
#> [505] "0" "1" "1" "1" "0" "0" "0" "1" "1" "1" "1" "1" "0" "1" "0" "1" "1" "0"
#> [523] "1" "0" "0" "0" "0" "0" "0" "1" "1" "1" "1" "0" "0" "0" "0" "1" "1" "1"
#> [541] "0" "0" "0" "1" "1" "1" "1" "1" "0" "1" "0" "1" "1" "0" "1" "0" "0" "0"
#> [559] "0" "0" "0" "1" "1" "1" "1" "0" "0" "0" "0" "1" "1" "1" "0" "0" "0" "1"