Description Usage Arguments Value See Also Examples
Make predictions from a cv.SplitReg object, similar to other predict methods.
1 2 3 4 5 6 7 8 |
object |
Fitted cv.SplitReg object. |
newx |
Matrix of new values of x at which prediction are to be made. Ignored if type is "coefficients". |
index |
Indices indicating values of lambda_S at which to predict. Defaults to the optimal value. |
type |
Either "response" for predicted values or "coefficients" for the estimated coefficients. |
... |
Additional arguments for compatibility. |
Either a matrix with predictions or a vector of coefficients
1 2 3 4 5 6 7 8 9 10 | library(MASS)
set.seed(1)
beta <- c(rep(5, 5), rep(0, 45))
Sigma <- matrix(0.5, 50, 50)
diag(Sigma) <- 1
x <- mvrnorm(50, mu = rep(0, 50), Sigma = Sigma)
y <- x %*% beta + rnorm(50)
fit <- cv.SplitReg(x, y, num_models=2)
x.new <- mvrnorm(50, mu = rep(0, 50), Sigma = Sigma)
split.predictions <- predict(fit, newx = x.new, type="response")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.