risk.classification {uni.survival.tree} | R Documentation |
The function returns the ranks (1=the lowest risk, 2=the 2nd lowest risk, ..., k=the highest risk) predicted for the samples.
risk.classification(tree, X.mat)
tree |
:an object made from the "uni.tree" function |
X.mat |
:n by p matrix of covariates from the samples, where n is the sample size and p is the number of covariates |
If the tree has k terminal nodes, then the response 1 respresents the lowest risk and k represents the highest risk.
A vector of integers, 1, 2, ..., k, that represent the ranks predicted for the samples.
data(Lung,package="compound.Cox")
train_Lung=Lung[which(Lung[,"train"]==TRUE),] #select training data
t.vec=train_Lung[,1]
d.vec=train_Lung[,2]
x.mat=train_Lung[,-c(1,2,3)]
res=uni.tree(t.vec,d.vec,x.mat,P.value=0.01,d0=0.01,S.plot=FALSE,score=TRUE)
risk.classification(res,x.mat)