This funtion finds the optimal cutpoints for the time-varying regression effects and grows the 'full tree' using the score statistic.
coxph.tree(survtime, survstatus, x, D = 3, method = "breslow", minfail = 10,
iter.max = 20, eps = 1e-06, type = 'mod')survival time/ follow up time of subjects
survival status of subjects. 0 for censored and 1 for event
a data frame of covariates. In case of single covariate, use [,,drop =F] to keep the data frame structure
maximum depth the tree will grow. Default depth is 3.
argument for coxph function. Default is 'breslow'. See coxph for more details.
minimum number of unique events required in each block. Default is 10
the maximum number of iteration in coxph; default is 20. See coxph for more details.
argument for coxph function; default is 0.000001. See coxph for more details.
method to calculate the score statistic. Two options are available: 'mod' for the modified score statistic and 'ori' for the original score statistic. Default value is 'mod.' Modified score statistic is used in the bootstrap part
coxph.tree returns an object of class 'coxphtree.'
The function output.coxphout is used to obtain and print a summary of the result.
An object of class 'coxphtree' is a list containing the following components:
Depth value specified in the argument
coefficient values of predictors. First number represents depth and second number represents block number
Likelihood ratio value of each node
Starting point of each node. Starting point of node at Depth= 0 to maximum Depth = D+1 is shown.
Number of cases in each node
Number of events in each node
Number of blocks in each depth
Indicator that indicates whether the block was eligible for further split
A table with depth, block, node, left right, maximum score, start time, end time, # of cases, and # of events
Maximum score at each block
Name of predictors
The time when events occurred without duplicates
coxph output of each block
p-value to test validity of a change point against none
coxph.tree takes in survival time, survival status, and covariates to grow the full tree.
It follows one of the stopping rules: 1) when the pre-specified depth is reached, or 2) the number of events in a node is less than a prespecified number, or 3) the maximized score statistic is less than a default value (0.0001).
Currently, data need to be arranged in descending order of time and with no missing.
Xu, R. and Adak, S. (2002), Survival Analysis with Time-Varying Regression Effects Using a Tree-Based Approach. Biometrics, 58: 305-315.
# NOT RUN {
##Call in alcohol data set
data('alcohol')
require(survival)
coxtree <- coxph.tree(alcohol[,'time'], alcohol[,'event'],
x = alcohol[,'alc', drop = FALSE], D = 4)
nodetree <- output.coxphout(coxtree)
subtrees <- prune(nodetree)
# }
Run the code above in your browser using DataLab