Makes predictions for a prioritylasso
object. It can be chosen between linear predictors or fitted values.
# S3 method for 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",
...
)
Predictions that depend on type
.
An object of class prioritylasso
.
(nnew x
p) matrix or data frame with new values.
Specifies the type of predictions. link
gives the linear predictors for all types of response and response
gives the fitted values.
Specifies how to deal with missing data in the test data; possibilities are none
, omit.prediction
, set.zero
and impute.block
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).
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.
Simon Klau
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.
pl_data
, prioritylasso
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")
Run the code above in your browser using DataLab