Prediction function for fitted cross validation hd2part objects

# S3 method for cv.hd2part
predict(
  object,
  newx,
  model = c("zero", "positive"),
  s = c("lambda.min", "lambda.1se"),
  type = c("link", "model_response", "response", "coefficients", "nonzero"),
  ...
)

Arguments

object

fitted "cv.hd2part" model object

newx

Matrix of new values for x at which predictions are to be made. Must be a matrix; can be sparse as in the CsparseMatrix objects of the Matrix package This argument is not used for type = c("coefficients","nonzero")

model

either "zero" for the zero part model or "positive" for the positive part model

s

Value(s) of the penalty parameter lambda at which predictions are required. Default is the entire sequence used to create the model. For predict.cv.hd2part(), can also specify "lambda.1se" or "lambda.min" for best lambdas estimated by cross validation.

type

Type of prediction required. type = "link" gives the linear predictors; type = "model_response" gives the fitted probabilities for the zero part and fitted expected values for the positive part. type = "response" gives the combined response prediction across the two models using the full unconditional expected value of the response. When type = "response", argument "model" is unused. type = "coefficients" computes the coefficients at the requested values for s.

...

arguments to be passed to predict.hd2part

Examples

set.seed(123)