Data precisions :
- quotation is a dummy variable
- minute count all the minutes within a day
- temp is the temperature
Here is my code :
ctree <- ctree(quotation ~ minute + temp, data = visitquot)
print(ctree)
Fitted party:
[1] root
| [2] minute <= 600
| | [3] minute <= 227
| | | [4] temp <= -0.4259
| | | | [5] temp <= -2.3174: 0.015 (n = 6254, err = 89.7)
| | | | [6] temp > -2.3174
| | | | | [7] minute <= 68: 0.028 (n = 4562, err = 126.3)
| | | | | [8] minute > 68: 0.046 (n = 7100, err = 312.8)
| | | [9] temp > -0.4259
| | | | [10] temp <= 6.0726: 0.015 (n = 56413, err = 860.5)
| | | | [11] temp > 6.0726: 0.019 (n = 39779, err = 758.9)
| | [12] minute > 227
| | | [13] minute <= 501
| | | | [14] minute <= 291: 0.013 (n = 30671, err = 388.0)
| | | | [15] minute > 291: 0.009 (n = 559646, err = 5009.3)
| | | [16] minute > 501
| | | | [17] temp <= 5.2105
| | | | | [18] temp <= -1.8393: 0.009 (n = 66326, err = 617.1)
| | | | | [19] temp > -1.8393: 0.012 (n = 355986, err = 4289.0)
| | | | [20] temp > 5.2105
| | | | | [21] temp <= 13.6927: 0.014 (n = 287909, err = 3900.7)
| | | | | [22] temp > 13.6927
| | | | | | [23] temp <= 14: 0.035 (n = 2769, err = 92.7)
| | | | | | [24] temp > 14: 0.007 (n = 2161, err = 15.9)
| [25] minute > 600
| | [26] temp <= 1.6418
| | | [27] temp <= -2.3366: 0.012 (n = 110810, err = 1268.1)
| | | [28] temp > -2.3366: 0.014 (n = 584457, err = 7973.2)
| | [29] temp > 1.6418: 0.016 (n = 3753208, err = 57864.3)
Then I ploted the tree :
plot(ctree, type = "simple")
And here is a part of the output :
My questions are :
- In the first output from
print(ctree)
, lets take the last line[29] temp > 1.6418: 0.016 (n = 3753208, err = 57864.3)
. What does the value0.016
means ? is that a p-value ? And what doeserr = 57864.3
means ? It can't be a count of attribution error because it is a float number. - I could not find anywhere a similar output that I have in the grey square. If someone knows how to interpret it. And how can a p-value be negative ?
party
package instead ofpartykit
. I think thetype='simple'
plot works better that way. What is your dummy variables' values? Is it binary, categorical? Is this a classification tree or regression tree? Would be good to see a summary of your 3 variables. I have a feeling that your dummy (output) variable is numeric but the model treats it as scale variable and not categorical. $\endgroup$as.character
instead of using factors. You have to let the model know that those 0s and 1s are labels and not real numbers. $\endgroup$numeric
andquotation
is composed of0
and1
. How can I know if it is a regression or categorical tree ? I will test right away withquotation
as a factor and then with theparty
package. However, what I understand from your answer is that the current output isn't normal right ? $\endgroup$err
values. If it's a classification tree those will be a missclasification %. $\endgroup$plot(..., type = "simple")
problem. I still need to check why this currently does not work as desired inpartykit
but will try to fix this soon. In the meantime, just doplot(as.simpleparty(ctree))
which generates the desired plot. (This is better than going back to the oldparty
implementation...) $\endgroup$