library("caret")
library("randomForest")
library("party")
library("tree")
library("rpart")
library("rpart.plot")
library("survAUC")
library("survival")
options(digits=4)
survivalTree<-ctree(Surv(survData$user_age,survData$is_user_active)~.,data=survData)
plot(survivalTree)
it has alot more rows. and a-g are some kind of indicators which are in the nodes. user age is how long is the user in the system and alive or not is, as it says, alive or not (in our system).
With the above commands i've created a survivel ctree which looks like this:
Now there are 7 leaves. I would like for each leaf, lets take the first leaf from the left for example: the variable n there is n = 17. i would like to add for (1,2,3) 17. so in that iteration 1,2,3 = 17. in the 4th iteration we are in the 4th leaf (from the left), n = 7. there i would like to add to (1,7,8,9) the value 7. so now 1 = 17+7=24. 2,3 = 17. and 7,8,9 = 7.
My problem is that i cannot reach the nodes as Ctree doesnt have a data-structure. Desired output is somthing like this:
a = 5001
b = 2232
c = 7110
d = 534
e = 223
f = 17
g = 6512
where a-g are factors in the 1st column of a data.frame and thier values are the 2nd column of that data.frame