Re: [R] Problem with rpart

From: Andrew Zachary <>
Date: Tue 19 Sep 2006 - 16:23:47 GMT


Here is an example (though the data are too large to send ). The dataset is (6530 x 15). Predictors are continuous N(0,1). Trying to build a regression tree.

 fit <- rpart( y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14,, weights=wts )

And the output:

 summary( fit )
rpart(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14, data, weights = wts)   n= 6530

  CP nsplit rel error
1 NA 0 NA

Node number NA: NA observationsError in if (ff$complexity[i] < cp || is.leaf[i]) cat("\n") else cat(", complexity param=", :

        missing value where TRUE/FALSE needed

If I run this using a subset of 900 points, everything is fine. Similarly, if I run it using 1100 points, it dies. There are no missing values in the dataset. Is this simply a case where I should decrease cp?


-----Original Message-----
From: Torsten Hothorn [] Sent: Tuesday, September 19, 2006 4:45 PM To: Andrew Zachary
Subject: Re: [R] Problem with rpart

On Tue, 19 Sep 2006, Andrew Zachary wrote:

> Not sure if anyone has posted on this problem ... I want to use rpart
> to build a binary tree on a relatively large dataset with ~1400 data
> points and 15 predictors. But I've noticed that rpart fails almost
> immediately in the call to C_s_to_rp, as that code returns nonsense.
> Looking at the code itself isn't terribly helpful, and there don't
> seem to be any hard limits coded anywhere. Does anyone have a
> suggestion for what might be going on?


you need to give an _executable_ example illustrating your problem. What means `nonsense'?



> Thanks in advance for you help
> Andrew Zachary
> ----
> Wetherby Partners LLC believes the information provided herein is
reliable. While every care has been taken to ensure accuracy, the information is furnished to the recipients with no warranty as to the completeness and accuracy of its contents and on condition that any errors or omissions shall not be made the basis for any claim, demand or cause for action.
> The information in this email is intended only for the\ > ...{{dropped}} mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed Sep 20 02:26:28 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 19 Sep 2006 - 23:30:06 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.