3

I want to use the package 'partykit' for building classification trees and forests with ctree() and cforest(). As my data set contains 50000 rows and 30 columns, I'd like to set minsplit to 150 and minbucket to 50. Unfortunately when I enter my code

xplr=ctree_control(mincriterion = 0.999, minsplit=150, minbucket=50)
set.seed(123)
cit999=ctree(as.factor(order) ~ startHour, data=transact_train, controls=xplr)

I get the following error message:

Error in ctree_control(...) : 
unused argument (controls = list(teststat = "quad", testtype = "Bonferroni", mincriterion = -0.00100050033358353, minsplit = 150, minbucket = 50, minprob = 0.01, stump = FALSE, mtry = Inf, maxdepth = Inf, multiway = FALSE, splittry = 2, maxsurrogate = 0, majority = FALSE, applyfun = function (X, FUN, ...) 
{
FUN <- match.fun(FUN)
if (!is.vector(X) || is.object(X)) X <- as.list(X)
.Internal(lapply(X, FUN))
}))

Can anyone tell me why this happens?

prznrl
  • 73
  • 1
  • 5
  • 2
    It would be helpful if you made this reproducible http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Hack-R Jun 08 '16 at 13:03

1 Answers1

5

It's because you specified controls instead of control.

require(partykit)
data(HuntingSpiders) # example data from partykit
xplr=ctree_control(mincriterion = 0.999, minsplit=150, minbucket=50)
set.seed(123)

arct.lute <- as.factor(HuntingSpiders$arct.lute)
cit999=ctree(formula=arct.lute ~ ., data=HuntingSpiders, control=xplr)
cit999
Model formula:
arct.lute ~ pard.lugu + zora.spin + pard.nigr + pard.pull + aulo.albi + 
    troc.terr + alop.cune + pard.mont + alop.acce + alop.fabr + 
    arct.peri + water + sand + moss + reft + twigs + herbs

Fitted party:
[1] root: 0.35714285714 (n = 28, err = 14.428571429) 

Number of inner nodes:    0
Number of terminal nodes: 1
> 
Hack-R
  • 22,422
  • 14
  • 75
  • 131
  • 1
    Wow! I thought about that 2 days, checked the code several times and didn't find that!!! Many many thanks! – prznrl Jun 08 '16 at 13:34
  • @prznrl Sure, happy to help. Feel free to mark this answer as the solution if it was helpful. :) – Hack-R Jun 08 '16 at 14:48