predict.cv.SplitReg {SplitReg}R Documentation

Make predictions from a cv.SplitReg object.

Description

Make predictions from a cv.SplitReg object, similar to other predict methods.

Usage

## S3 method for class 'cv.SplitReg'
predict(
  object,
  newx,
  index = object$index_opt,
  type = c("response", "coefficients"),
  ...
)

Arguments

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.

Value

Either a matrix with predictions or a vector of coefficients

See Also

predict.cv.SplitReg

Examples

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")


[Package SplitReg version 1.0.2 Index]