predict.prioritylasso: Predictions from prioritylasso

View source: R/predict.prioritylasso.R

predict.prioritylassoR Documentation

Predictions from prioritylasso

Description

Makes predictions for a prioritylasso object. It can be chosen between linear predictors or fitted values.

Usage

## S3 method for class 'prioritylasso'
predict(
  object,
  newdata = NULL,
  type = c("link", "response"),
  handle.missingtestdata = c("none", "omit.prediction", "set.zero", "impute.block"),
  include.allintercepts = FALSE,
  use.blocks = "all",
  ...
)

Arguments

object

An object of class prioritylasso.

newdata

(nnew x p) matrix or data frame with new values.

type

Specifies the type of predictions. link gives the linear predictors for all types of response and response gives the fitted values.

handle.missingtestdata

Specifies how to deal with missing data in the test data; possibilities are none, omit.prediction, set.zero and impute.block

include.allintercepts

should the intercepts from all blocks included in the prediction? If FALSE, only the intercept from the first block is included (default in the past).

use.blocks

determines which blocks are used for the prediction, the default is all. Otherwise one can specify the number of blocks which are used in a vector

...

Further arguments passed to or from other methods.

Details

handle.missingtestdata specifies how to deal with missing data. The default none cannot handle missing data, omit.prediction does not make a prediction for observations with missing values and return NA. set.zero ignores the missing data for the calculation of the prediction (the missing value is set to zero). impute.block uses an imputation model to impute the offset of a missing block. This only works if the prioritylasso object was fitted with handle.missingdata = "impute.offset". If impute.offset.cases = "complete.cases" was used, then every observation can have only one missing block. For observations with more than one missing block, NA is returned. If impute.offset.cases = "available.cases" was used, the missingness pattern in the test data has to be the same as in the train data. For observations with an unknown missingness pattern, NA is returned.

Value

Predictions that depend on type.

Author(s)

Simon Klau

See Also

pl_data, prioritylasso

Examples

pl_bin <- prioritylasso(X = matrix(rnorm(50*190),50,190), Y = rbinom(50,1,0.5),
                       family = "binomial", type.measure = "auc",
                       blocks = list(block1=1:13,block2=14:80, block3=81:190),
                       block1.penalization = TRUE, lambda.type = "lambda.min",
                       standardize = FALSE, nfolds = 3)

newdata_bin <- matrix(rnorm(10*190),10,190)

predict(object = pl_bin, newdata = newdata_bin, type = "response")

prioritylasso documentation built on April 11, 2023, 6:02 p.m.