Hi
I am trying to use tree() to classify movements in a futures contract. My
data is like this:
diff dip dim adx
1 0 100.00000 8650.0000 100.00000
2 0 93.18540 2044.5455 93.18540
3 0 90.30995 1549.1169 90.30995
4 1 85.22030 927.0419 85.22030
5 1 85.36084 785.6480 85.36084
6 0 85.72627 663.3814 85.72627
7 0 78.06721 500.1113 78.06721
8 1 69.59398 376.7558 69.59398
9 1 71.15429 307.4533 71.15429
10 1 71.81023 280.6238 71.81023
plus another 6000 lines
The cpus example works fine and I am trying this:
tree.model <- tree(as.factor(indi$diff) ~ indi$dim + indi$dip + indi$adx,
indi[1:4000,])
tree.model
summary(tree.model)
plot(tree.model); text(tree.model)
but I get this:> tree.model <- tree(as.factor(indi$diff) ~ indi$dim + indi$dip +
indi$adx,
indi[1:4000,])> tree.model
node), split, n, deviance, yval, (yprob)
* denotes terminal node
1) root 6023 8346 0 ( 0.513 0.487 ) *> summary(tree.model)
Classification tree:
tree(formula = as.factor(indi$diff) ~ indi$dim + indi$dip + indi$adx,
data = indi[1:4000, ])
Variables actually used in tree construction:
character(0)
Number of terminal nodes: 1
Residual mean deviance: 1.386 = 8346 / 6022
Misclassification error rate: 0.487 = 2933 / 6023 > plot(tree.model); text(tree.model)
Error in plot.tree(tree.model) : cannot plot singlenode
tree>
I'm not getting any sort of tree formed.
I wondered if anyone could point me in the right direction.
Thanks.
Stephen Choularton
[[alternative HTML version deleted]]