Return the model predictions of a ppDiscSurv
object
Arguments
- fit
a
ppDiscSurv
object.- data
an
dataframe
orlist
object that contains the variables for prediction.- Event.char
name of the event indicator in
data
as a character string.- prov.char
name of provider IDs variable in
data
as a character string.- Z.char
names of covariates in
data
as vector of character strings.- Time.char
name of the observation time in
data
as a character string.- lambda
values of the regularization parameter lambda at which predictions are requested. For values of lambda not in the sequence of fitted models, linear interpolation is used.
- which
indices of the penalty parameter lambda at which predictions are required. By default, all indices are returned. If lambda is specified, this will override which.
- type
type of prediction:
response
: fitted values (i.e.,exp(eta)/(1 + exp(eta))
)vars
: the indices for the non-zero coefficientsnvars
: the number of non-zero coefficients
- which.lambda
determine which lambda values are included in the output of the prediction. By default, its value is set to "all," resulting in a matrix of predicted values for each lambda presented as a list. However, if specific numeric values are provided, only the predicted matrix corresponding to those specified values will be included in the output.
- ...
Examples
data(DiscTime)
data <- DiscTime$data
Event.char <- DiscTime$Event.char
prov.char <- DiscTime$prov.char
Z.char <- DiscTime$Z.char
Time.char <- DiscTime$Time.char
fit <- pp.DiscSurv(data, Event.char, prov.char, Z.char, Time.char)
predict(fit, data, Event.char, prov.char, Z.char, Time.char, lambda = fit$lambda, type = "response", which.lambda = fit$lambda[1])[1:5,]
#> Individual [Time: 0.53] [Time: 1.03] [Time: 3.92] [Time: 6.74] [Time: 12.5]
#> 1 1 0.1586823 0.1852773 NA NA NA
#> 2 2 0.1586823 0.1852773 0.1649092 0.2224258 0.1441013
#> 3 3 0.1586823 NA NA NA NA
#> 4 4 0.1586823 0.1852773 0.1649092 0.2224258 NA
#> 5 5 0.1586823 0.1852773 0.1649092 0.2224258 0.1441013
predict(fit, data, Event.char, prov.char, Z.char, Time.char, lambda = 0.04, type = "vars")
#> Z1 Z3 Z5
#> 1 3 5