est.CIF: Cumulative incidence function.

Description Usage Arguments Details Value References Examples

View source: R/est.CIF.R

Description

This is the main function to obtain the point estimator and pointwise confidence interval for the cumulative incidence function.

Usage

1
2
est.CIF(formulas, data, group, group.in.train, newdata,
        compute.CI, alpha = 0.05, transform = "log-log", save)

Arguments

formulas

A list of length K contains formula objects, where K is the number of failures. Each element is a formula object, with the response on the left of a ~ operator, and the predictors on the right. The response must be a survival object as returned by the Surv function.

data

A data frame with n observations and p number of covariates.

group

The name of the group covariates (if any). If specified, the cumulative incidence function will be estimated for each group separately. Default is group=NULL.

group.in.train

This argument is valid only when the group argument is specified. If group is presented in both data and newdata, use group.in.train=T; If group is presented in only newdata but not data, use group.in.train=F.

newdata

A data frame or a matrix used for prediction. If not specified, the original data will be used instead.

compute.CI

A logic operator for whether to compute the pointwise confidence interval. The default is compute.CI=FALSE.

alpha

The significance level. The default is 0.05, which computes the 95% pointwise confidence interval.

transform

An indicator if transformation is used for the confidence interval. Only log-log transformation is implemented currently.

save

An option to save the computed S0 and S1. It is highly recommended for large-scale dataset to improve the computational efficiency. Default is save=FALSE.

Details

This is the main function to compute the point estimator and pointwise confidence interval for the cumulative incidence function. We implemented a flexible function to allow prediction of cumulative incidence function under the cause-specific proportion hazards model in scenarios: 1) when group segmentation is not specified in training and test data; 2) when group segmentation is specified in both training and test data; 3) group segmentation is presented in the test data only; 4) the type of failure is associated with a different setts of covariates. To predict, user can input the new values of all covariates as a vector. If the newdata is specified, the mean of all observations with corresponding covariates will be used in the prediction. In addition, the generic functions such as plot(), summary() are available for the newly defined CIF class.

Value

When group=NULL, est.CIF returns a list of length K. For each sublist, it contains:

model.fit

Details of model fit, such as parameter estimates, standard error, etc.

call

The survival object used for a the k^th type of failure.

Estimate

A data frame contains events.time, overall survival, cumulative incidence, upper and lower bounds (if compute.CI = TRUE).

When group is specified, est.CIF returns a list of length that equals to the number of levels in group . For each sublist, it contains a list of length K.

References

Cheng, S. C., Jason P. Fine, and L. J. Wei. "Prediction of cumulative incidence function under the proportional hazards model." Biometrics (1998): 219-228.

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
## Not run: 
data("train.data")
data("test.data2")

#1.Example: no group in training and test #
formulas <- list(as.formula("Surv(dtime, prostate) ~ AG + WT + PF + HX +HG + SZ + SG + RX"),
                 as.formula("Surv(dtime, cardio) ~ AG + WT + PF + HX +HG + SZ + SG + RX"),
                 as.formula("Surv(dtime, Other_causes) ~ AG + WT + PF + HX +HG + SZ + SG + RX"))
CIF.output <- est.CIF(formulas, data = train.data, newdata = test.data2,
                  group=NULL, compute.CI=T,save=F)
plot(CIF.output)

#2. Example: group in training data and test data #
formulas <- list(as.formula("Surv(dtime, prostate) ~ AG + WT + PF + HX +HG + SZ + SG + RX"),
                 as.formula("Surv(dtime, cardio) ~ AG + WT + PF + HX +HG + SZ + SG + RX"),
                 as.formula("Surv(dtime, Other_causes) ~ AG + WT + PF + HX +HG + SZ + SG + RX"))
CIF.output <- est.CIF(formulas, data=train.data, group="RX", group.in.train=T,
                      newdata=test.data2, compute.CI=T, alpha=0.05, transform="log-log", save=F)
plot(CIF.output, group="RX")

#3. Example: group not in training data and but in test data #
formulas <- list(as.formula("Surv(dtime, prostate) ~ AG + WT + PF + HX +HG + SZ + SG"),
                 as.formula("Surv(dtime, cardio) ~ AG + WT + PF + HX +HG + SZ + SG "),
                 as.formula("Surv(dtime, Other_causes) ~ AG + WT + PF + HX +HG + SZ + SG"))
CIF.output <- est.CIF(formulas, data=train.data, group="RX", group.in.train=F, newdata=test.data2,
                      compute.CI=T, alpha=0.05, transform="log-log", save=F)
plot(CIF.output, group="RX")


#4. Example: 1)group not in training data and but in test data
#            2)different risk factors associated with cause of failure #
formulas <- list(as.formula("Surv(dtime, prostate) ~ AG + WT + PF + HX +HG"),
                 as.formula("Surv(dtime, cardio) ~  PF + HX +HG "),
                 as.formula("Surv(dtime, Other_causes) ~ AG + WT + PF + HX +HG + SZ"))
CIF.output <- est.CIF(formulas, data=train.data, group="RX", group.in.train=F,
                      newdata=test.data2,compute.CI=T, alpha=0.05, transform="log-log", save=T)
plot(CIF.output, group="RX")

#5. Example: different risk factors associated with cause of failure #
formulas <- list(as.formula("Surv(dtime, prostate) ~ AG + WT + PF + HX +HG"),
                 as.formula("Surv(dtime, cardio) ~  PF + HX +HG + SZ"),
                 as.formula("Surv(dtime, Other_causes) ~ AG + WT + PF + HX +HG + SZ + SG"))
CIF.output <- est.CIF(formulas, data=train.data, group=NULL, group.in.train=F, newdata=test.data2,
                      compute.CI=T, alpha=0.05, transform="log-log", save=F)
plot(CIF.output)

## End(Not run)

CompetingRisk documentation built on May 30, 2017, 2:54 a.m.