Re: [S] weighting trees

Prof Brian D Ripley (
Fri, 7 Aug 1998 20:03:16 +0100 (BST)

On Fri, 7 Aug 1998, Jeffrey Stanis wrote: [after wrapping
execsssively long lines]

> I recently constructed a regression tree whereby I included the argument:
weights = a weighted variable. However, when I later checked the yprobs
of th tree it was obvious that the weighted variable wasn't applied.
> I'm wondering now whether or not a data set can be weighted when
creating a tree. Any answers and or guidance would be greatly appreciated.

You haven't got a _regression_ tree if you have yprobs: you have a
classification tree. help(tree) claims:

If the response variable is a factor, the tree is called a
classification tree. The model used for classification
assumes that the response variable follows a multinomial
distribution. weights are not used in the computation of
the deviance in classification trees.

If the response variable is numeric, the tree is called a
regression tree. The model used for regression assumes
that the numeric response variable has a normal (Gaussian)
distribution. weights are used if they are specified.

The first is true: I have never actually checked the second.

It often helps to read the help page :)

If you need weights with classification trees, you can't use rpart
either. The only package I know of that does use weights is my
function Tree that I have never released: if you really need this
write to me directly with details of your system (version of S-PLUS,
platform). (I was abused by a very ungrateful user of this, so
never finished documented what it does.)

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

----------------------------------------------------------------------- This message was distributed by To unsubscribe send e-mail to with the BODY of the message: unsubscribe s-news