| predict.cv.pcLasso {pcLasso} | R Documentation |
Make predictions from a "cv.pcLasso" object
Description
This function returns the predictions for a new data matrix from a
cross-validated pcLasso model by using the stored "glmfit" object and
the optimal value chosen for lambda.
Usage
## S3 method for class 'cv.pcLasso'
predict(object, xnew, s = c("lambda.1se",
"lambda.min"), ...)
Arguments
object |
Fitted " |
xnew |
Matrix of new values for |
s |
Value of the penalty parameter |
... |
Potentially other arguments to be passed to and from methods; currently not in use. |
Details
This function makes it easier to use the results of cross-validation to make
a prediction. Note that xnew should have the same number of columns as
the original feature space, regardless of whether the groups are overlapping
or not.
Value
Predictions which the cross-validated model makes for xnew at
the optimal value of lambda. Note that the default is the "lambda.1se" for lambda,
to make this function consistent with cv.glmnet in the glmnet
package. The output is predictions of E(y|xnew): these are probabilities
for the binomial family.
See Also
cv.pcLasso and predict.pcLasso.
Examples
set.seed(1)
x <- matrix(rnorm(100 * 20), 100, 20)
y <- rnorm(100)
cvfit <- cv.pcLasso(x, y, ratio = 0.8)
predict(cvfit, xnew = x[1:5, ])
predict(cvfit, xnew = x[1:5, ], s = "lambda.min")