View source: R/predict.cv.cpernet.R
predict.cv.cpernet | R Documentation |
This function makes predictions from a cross-validated cpernet model, using
the fitted cv.cpernet
object, and the optimal value chosen for
lambda
.
## S3 method for class 'cv.cpernet' predict(object, newx, s = c("lambda.1se", "lambda.min"), ...)
object |
fitted |
newx |
matrix of new values for |
s |
value(s) of the penalty parameter |
... |
not used. Other arguments to predict. |
This function makes it easier to use the results of cross-validation to make a prediction.
The object returned depends the ... argument which is passed on
to the predict
method for cpernet
objects.
Yuwen Gu and Hui Zou
Maintainer: Yuwen Gu <yuwen.gu@uconn.edu>
cv.cpernet
, coef.cv.cpernet
,
plot.cv.cpernet
set.seed(1) n <- 100 p <- 400 x <- matrix(rnorm(n * p), n, p) y <- rnorm(n) tau <- 0.30 pf <- abs(rnorm(p)) pf2 <- abs(rnorm(p)) w <- 2.0 lambda2 <- 1 m2.cv <- cv.cpernet(y = y, x = x, w = w, tau = tau, eps = 1e-8, pf.mean = pf, pf.scale = pf2, standardize = FALSE, lambda2 = lambda2) as.vector(predict(m2.cv, newx = x, s = "lambda.min"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.