risk.classification: The risk ranks of the samples predicted by a tree

Description Usage Arguments Details Value Examples

View source: R/risk.classification.R

Description

The function returns the ranks (1=the lowest risk, 2=the 2nd lowest risk, ..., k=the highest risk) predicted for the samples.

Usage

1
risk.classification(tree, X.mat)

Arguments

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

Details

If the tree has k terminal nodes, then the response 1 respresents the lowest risk and k represents the highest risk.

Value

A vector of integers, 1, 2, ..., k, that represent the ranks predicted for the samples.

Examples

1
2
3
4
5
6
7
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)

uni.survival.tree documentation built on March 22, 2021, 9:05 a.m.