[R] tree() - Tree is too big

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sat Jun 9 10:13:03 CEST 2001

On Sat, 9 Jun 2001, Henrik Bengtsson wrote:

> I am using tree() in the library tree to learn regression trees. Once in a
> while I am getting the error "Tree is too big". From the same data set, but
> with randomized subsets I am learning several tree model and in the end of
> the day I would like to look at some of the properties across trees.
> My problem: I have for loop containing a call to tree(). However, since
> tree() returns an error about every 30-50 time due to "Tree is too big" the
> execution is stopped. Since each call to tree() takes a long time I would
> like to run the  for loop over night. I have tried
>   options(error = expression(NULL))
> to make [R] ignore the errors, but it seems that tree() doesn't respond to
> this. Is this correct? Any other suggestions?

Nothing to do with tree.  Probably you should be using try(). An error
exits the for loop, and then you asked the session to continue.  You got
what you asked for, but not what you wanted?

However, I suggest that you should be trying to solve the problem, which is
probably that you really are trying to grow too big trees.  I guess you
have a large dataset, and need to adjust the control parameters.
See ?tree.control, especially minsize and mindev.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list