predict.penPHcure: Predict method for penPHcure.object

Description Usage Arguments Details Value Examples

View source: R/predict.penPHcure.R

Description

Compute probabilities to be susceptible and survival probabilities (conditional on being susceptible) for a model fitted by penPHcure with the argument pen.type = "SCAD" | "LASSO".

Usage

1
2
## S3 method for class 'penPHcure'
predict(object, newdata, crit.type=c("BIC","AIC"), X = NULL,...)

Arguments

object

an object of class PHcure.object.

newdata

a data.frame in counting process format.

crit.type

a character string indicating the criterion used to select the tuning parameters, either "AIC" or "BIC". By default crit.type = "BIC".

X

[optional] a matrix of time-invariant covariates.

...

ellipsis to pass extra arguments.

Details

If the model selected by means of the BIC criterion differs from the one selected by the AIC criterion, with the argument crit.type it is possible to specify which model to use for the calculation of the probabilities.

If argument X was not supplied in the call to the penPHcure function, the probabilities to be susceptible are computed using the covariates retrieved using the same which.X method as in the penPHcure function call.

Value

An object of class predict.penPHcure, a list including the following elements:

CURE

a numeric vector containing the probabilities to be susceptible to the event of interest:

P(Y_i=1|x_i) = \frac{ e^{\mathbf{x}_i'\hat{\mathbf{b}}} }{1+e^{\mathbf{x}_i'\hat{\mathbf{b}}}},

where \mathbf{x}_i is a vector of time-invariant covariates and \hat{\mathbf{b}} is a vector of estimated coefficients.

SURV

a numeric vector containing the survival probabilities (conditional on being susceptible to the event of interest):

S(t_i|Y_i=1,\bar{\mathbf{z}}_i(t))=\exp≤ft(-∑_{j=1}^K (t_{(j-1)}-t_{(j)}) \hat{λ}_{0j} I(t_{(j)}≤q t_i) e^{\mathbf{z}_i(t_{(j)})\hat{\boldsymbol{β}}}\right),

where t_{(1)}<t_{(2)}<...<t_{(K)} denotes the K ordered event-times, \mathbf{z}_i(t) is a vector of time-varying covariates, \hat{\boldsymbol{β}} is a vector of estimated coefficients and \hat{λ}_{0j} is the estimated baseline hazard function (constant in the interval (t_{(j-1)},t_{(j)}]).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Generate some data (for more details type ?penPHcure.simulate in your console)
set.seed(12) # For reproducibility
data <- penPHcure.simulate(N=250)

### Tune penalized cure model with SCAD penalties
# First define the grid of possible values for the tuning parameters.
pen.tuneGrid <- list(CURE = list(lambda = c(0.01,0.03,0.05,0.07,0.09),
                                 a = 3.7),
                     SURV = list(lambda = c(0.01,0.03,0.05,0.07,0.09),
                                 a = 3.7))
# Tune the penalty parameters.
tuneSCAD <- penPHcure(Surv(time = tstart,time2 = tstop,
                           event = status) ~ z.1 + z.2 + z.3 + z.4,
                      cureform = ~ x.1 + x.2 + x.3 + x.4,
                      data = data,pen.type = "SCAD",
                      pen.tuneGrid = pen.tuneGrid,
                      print.details = FALSE)
                      
# Use the predict method to obtain the probabilities for the selected model.
#  By default, the model is the one selected on the basis of the BIC criterion.
pred.tuneSCAD.BIC <- predict(tuneSCAD,data)
# Otherwise, to return the probabilities for the model selected on the basis 
#  of the AIC criterion, the user can set argument crit.type = "AIC": 
pred.tuneSCAD.AIC <- predict(tuneSCAD,data,crit.type="AIC")

# Use the predict method to make prediction for new observations.
#  For example, two individuals censored at time 0.5 and 1.2, respectively,
#  and all cavariates equal to 1.
newdata <- data.frame(tstart=c(0,0),tstop=c(0.5,1.2),status=c(0,0),
                      z.1=c(1,1),z.2=c(1,1),z.3=c(1,1),z.4=c(1,1),
                      x.1=c(1,1),x.2=c(1,1),x.3=c(1,1),x.4=c(1,1))
pred.tuneSCAD.newdata.BIC <- predict(tuneSCAD,newdata)
pred.tuneSCAD.newdata.AIC <- predict(tuneSCAD,newdata,crit.type="AIC")
# The probabilities to be susceptible for the BIC selected model are:
pred.tuneSCAD.newdata.BIC$CURE
# [1] 0.6456631 0.6456631
# The probabilities to be susceptible for the AIC selected model are:
pred.tuneSCAD.newdata.BIC$CURE
# [1] 0.6456631 0.6456631
# The survival probabilities (conditional on being susceptible) for the BIC 
#  selected model are:
pred.tuneSCAD.newdata.BIC$SURV
# [1] 0.5624514 0.1335912
# The survival probabilities (conditional on being susceptible) for the AIC 
#  selected model are:
pred.tuneSCAD.newdata.AIC$SURV
# [1] 0.5624514 0.1335912

a-beretta/penPHcure documentation built on Dec. 3, 2019, 5:41 p.m.