Diego Bellisai
2009-Nov-30 15:20 UTC
[R] rpart: how to assign observations to nodes in regression trees
Hi, I am building a regression tree (method=anova) by using rpart package and as a final result I get the final leaves characterized by different means and standard deviations for the dependent variable. However, differently from the classification tree for categorical variables I cannot find a way to assign each observation to a leaf, i.e. I can find no frame whcih contains the observation id coupled to the leaf id. I also cannot found where the leaves id are stored. Is there someone which can help me? Regards, Diego.
Diego Bellisai
2009-Nov-30 15:21 UTC
[R] rpart: how to assign observations to nodes in regression trees
Hi, I am building a regression tree (method=anova) by using rpart package and as a final result I get the final leaves characterized by different means and standard deviations for the dependent variable. However, differently from the classification tree for categorical variables I cannot find a way to assign each observation to a leaf, i.e. I can find no frame whcih contains the observation id coupled to the leaf id. I also cannot found where the leaves id are stored. Is there someone which can help me? Regards, Diego.
Diego Bellisai
2009-Nov-30 15:25 UTC
[R] rpart: how to assign observations to nodes in regression trees
Hi, I am building a regression tree (method=anova) by using rpart package and as a final result I get the final leaves characterized by different means and standard deviations for the dependent variable. However, differently from the classification tree for categorical variables I cannot find a way to assign each observation to a leaf, i.e. I can find no frame whcih contains the observation id coupled to the leaf id. I also cannot found where the leaves id are stored. Is there someone which can help me? Regards, Diego.
Terry Therneau
2009-Dec-01 14:10 UTC
[R] rpart: how to assign observations to nodes in regression trees
help('rpart.object') will give you information on the return value from rpart. I think you want the 'where' portion. For new data help('predict.rpart') gives the predicted results. Terry T ---------------------------------- Hi, I am building a regression tree (method=anova) by using rpart package and as a final result I get the final leaves characterized by different means and standard deviations for the dependent variable. However, differently from the classification tree for categorical variables I cannot find a way to assign each observation to a leaf, i.e. I can find no frame whcih contains the observation id coupled to the leaf id. I also cannot found where the leaves id are stored. Is there someone which can help me? Regards, Diego.
Maybe Matching Threads
- rpart - predict terminal nodes for new observations
- text.rpart: Unwanted NA labels on terminal nodes (PR#1009)
- rpart/tree issue
- Question about rpart decision trees (being used to predict customer churn)
- Adding Histograms to Leaves of Rpart Tree or other Dendrogram