`rpart` is an R package that provides a number of routines related to regression trees and recursive partitioning algorithms. This package is frequently used for classification problems.

learn more… | top users | synonyms

0
votes
1answer
42 views

Loss Matrix Equivalent with Neural Networks and random Forest

I'm doing classification (0,1) on a dataset for which different types of errors should be weighted differently. IE, false positives would be weighted 10 x more than false negatives. In decision ...
0
votes
0answers
29 views

Various models not improving basic rpart result

I have a data set with 10,000 or so samples in it and 100 or so features. I've created a training set and test set and am trying to predict a numeric value. I've used rpart to determine the most ...
1
vote
0answers
50 views

how does rpart handle missing values in predictors?

From the ?rpart documentation - na.action : the default action deletes all observations for which y is missing, but keeps those in which one or more predictors ...
0
votes
1answer
69 views

Understanding factors returned by RPart classification

This is a very basic question on using R for classification. I'm trying to use rpart for classification task and would like to have a class label as a result, i.e. I use type="class" in predict method ...
5
votes
0answers
320 views

Choosing complexity parameter in CART

In the rpart() routine to create CART models, you specify the complexity parameter to which you want to prune your tree. I have seen two different recommendations for choosing the complexity ...
2
votes
0answers
101 views

Is it possible to have xerror increased in a tree using rpart?

I am new to R and rpart package. When I plot the tree using rpart: ...
0
votes
0answers
74 views

CART with rpart and a 12 level factor

I have a 12-level factor variable (month) in my dataset and I wanted to fit a CART tree with rpart(). Would you split the 12-level factor variable into 12 dummy variables? If I fit the model with one ...
1
vote
0answers
488 views

rpart and the printcp function

I don't really understand how the columns "xerror" and "rel error" are calculated. I found out that the printcp() function "gives cross-validation estimates of misclassication error (xerror), ...
6
votes
1answer
240 views

CART (rpart) balanced vs. unbalanced dataset

I am fitting a tree (CART) to the olives-dataset. The training data has 436 observations (test data: 136). I have 3 responses (the 'Region' variable) which splits the training data into 116 / 74 / 246 ...
1
vote
0answers
167 views

decision tree using user defined split function in rpart: No splits returned when tree is run

I've written a user defined splitting function to use with rpart, its returning a 'vector of goodness', but the tree that is returned never has any splits, just one node. using the anova method on ...
8
votes
2answers
867 views

party vs. rpart vs. ??? for partitioning trees in R

It's been a while since I looked at partitioning trees. Last time I did this sort of thing, I like party in R (created by Hothorn). The idea of conditional inference via sampling makes sense to me. ...
4
votes
1answer
311 views

Difference in implementation of binary splits in decision trees

I am curious about the practical implementation of a binary split in a decision tree - as it relates to levels of a categorical predictor $X{j}$. Specifically, I often will utilize some sort of ...
3
votes
1answer
402 views

Overcoming memory constraints in rpart?

I have 4.4 million observations, 160 binary features, and a binary response. Using rpart on Windows (64-bit, with the 64-bit R v2.13.0 build), I run out of memory on a machine with 64GB RAM. My memory ...
5
votes
3answers
243 views

Recursive partitioning using median (instead of mean)

As I am only familiar with the basics regarding decision trees I would like to ask, with the risk of stating silly question: Is it possible to perform recursive partitioning with the group median as ...
1
vote
1answer
412 views

How to choose the number of splits in rpart()?

I have used rpart.control for minsplit=2, and got the following results from rpart() ...
1
vote
2answers
531 views

Recursive partitioning using rpart() method in R

I am new to R and using rpart for building a regression tree for my data.I wanted to use all the input variables for building the tree, but the rpart method using ...
3
votes
1answer
433 views

Organizing a classification tree (in rpart) into a set of rules?

Is there a way that once a complex classification tree is constructed using rpart (in R), to organize the decision rules produced for each class? So instead of getting one huge tree, we get a set of ...
3
votes
1answer
124 views

How to produce a CI for a value predicted in CART?

My goal is to create CI for the CART prediction of new_x Consider the following code: ...
8
votes
3answers
5k views

What is Deviance? (specifically in CART/rpart)

What is "Deviance," how is it calculated, and what are its uses in different fields in statistics? In particular, I'm personally interested in its uses in CART (and its implementation in rpart in R). ...
6
votes
2answers
2k views

How to measure/rank “variable importance” when using CART? (specifically using {rpart} from R)

When building a CART model (specifically classification tree) using rpart (in R), it is often interesting to know what is the importance of the various variables introduced to the model. Thus, my ...
2
votes
1answer
390 views

R-square from rpart model

How can I extract the R-square from a fit rpart model? rsq.rpart(fit) plots the two graphs, but I simply want to extract the R-square value for the full tree. ...
3
votes
1answer
332 views

Estimate the “meaningful” predictors for a value in a CART model (rpart)

When building a CART model (specifically classification tree) using rpart (in R), it is sometimes obvious that there are variables (X's) that are meaningful for predicting some of the outcome (y) ...