[S] "-" doesn't work in "tree" formula

Samuel E. Buttrey (buttrey@sun10or.or.nps.navy.mil)
Thu, 12 Nov 1998 09:41:30 -0800


Hi. Here's a fascinating fact that bit me. In a formula for a
"tree" model, using a "-" to exclude a column in the data frame
doesn't work. Try, for example, creating this dataset, in which
"y1" is identical to the response "y".

tt <- data.frame (y = 1:10, x1 = rnorm (10), y1 = 1:10)
summary (tree (y ~ ., data = tt))
(result includes:)
Variables actually used in tree construction:
[1] "y1"

Fine. In real life you'd like to exclude that "y1" column. Let's try:
summary (tree (y ~ . - y1, data = tt))
....
Variables actually used in tree construction:
[1] "y1"

The problem seems to be in the undocumented tree.matrix function.
I just thought the world should know....

Have fun,
Sam Buttrey
buttrey@nps.navy.mil
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news