CRAN Package Check Results for Package partykit

Last updated on 2018-05-22 16:51:25 CEST.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.2-1 12.46 200.98 213.44 ERROR
r-devel-linux-x86_64-debian-gcc 1.2-1 10.58 154.60 165.18 ERROR
r-devel-linux-x86_64-fedora-clang 1.2-1 411.47 OK
r-devel-linux-x86_64-fedora-gcc 1.2-1 396.73 OK
r-devel-windows-ix86+x86_64 1.2-1 24.00 579.00 603.00 OK
r-patched-linux-x86_64 1.2-1 11.00 184.92 195.92 ERROR
r-patched-solaris-x86 1.2-1 516.80 NOTE
r-release-linux-x86_64 1.2-1 10.03 185.55 195.58 ERROR
r-release-windows-ix86+x86_64 1.2-1 28.00 571.00 599.00 OK
r-release-osx-x86_64 1.2-1 OK
r-oldrel-windows-ix86+x86_64 1.2-1 18.00 518.00 536.00 OK
r-oldrel-osx-x86_64 1.2-1 OK

Check Details

Version: 1.2-1
Check: tests
Result: ERROR
     Running ‘bugfixes.R’ [8s/10s]
     Comparing ‘bugfixes.Rout’ to ‘bugfixes.Rout.save’ ... OK
     Running ‘regtest-MIA.R’ [3s/3s]
     Comparing ‘regtest-MIA.Rout’ to ‘regtest-MIA.Rout.save’ ... OK
     Running ‘regtest-cforest.R’ [13s/16s]
     Comparing ‘regtest-cforest.Rout’ to ‘regtest-cforest.Rout.save’ ... OK
     Running ‘regtest-ctree.R’ [3s/3s]
     Comparing ‘regtest-ctree.Rout’ to ‘regtest-ctree.Rout.save’ ... OK
     Running ‘regtest-glmtree.R’ [12s/16s]
    Running the tests in ‘tests/regtest-glmtree.R’ failed.
    Complete output:
     >
     > library("partykit")
     Loading required package: grid
     Loading required package: libcoin
     Loading required package: mvtnorm
     Loading required package: rpart
     > library("sandwich")
     >
     > set.seed(29)
     > n <- 1000
     > x <- runif(n)
     > z <- runif(n)
     > y <- rnorm(n, mean = x * c(-1, 1)[(z > 0.7) + 1], sd = 3)
     > z_noise <- factor(sample(1:3, size = n, replace = TRUE))
     > d <- data.frame(y = y, x = x, z = z, z_noise = z_noise)
     >
     >
     > fmla <- as.formula("y ~ x | z + z_noise")
     > fmly <- gaussian()
     > fit <- partykit:::glmfit
     >
     > # versions of the data
     > d1 <- d
     > d1$z <- signif(d1$z, digits = 1)
     >
     > k <- 20
     > zs_noise <- matrix(rnorm(n*k), nrow = n)
     > colnames(zs_noise) <- paste0("z_noise_", 1:k)
     > d2 <- cbind(d, zs_noise)
     > fmla2 <- as.formula(paste("y ~ x | z + z_noise +",
     + paste0("z_noise_", 1:k, collapse = " + ")))
     >
     >
     > d3 <- d2
     > d3$z <- factor(sample(1:3, size = n, replace = TRUE, prob = c(0.1, 0.5, 0.4)))
     > d3$y <- rnorm(n, mean = x * c(-1, 1)[(d3$z == 2) + 1], sd = 3)
     >
     > ## check weights
     > w <- rep(1, n)
     > w[1:10] <- 2
     > (mw1 <- glmtree(formula = fmla, data = d, weights = w))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 706
     | (Intercept) x
     | -0.1447422 -0.8138701
     | [3] z > 0.70311: n = 304
     | (Intercept) x
     | 0.07006626 0.73278593
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.48
     > (mw2 <- glmtree(formula = fmla, data = d, weights = w, caseweights = FALSE))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1447422 -0.8138701
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.07006626 0.73278593
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.48
     >
     >
     >
     > ## check dfsplit
     > (mmfluc2 <- mob(formula = fmla, data = d, fit = partykit:::glmfit))
     Model-based recursive partitioning (partykit:::glmfit)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function: 2551.673
     > (mmfluc3 <- glmtree(formula = fmla, data = d))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.673
     > (mmfluc3_dfsplit <- glmtree(formula = fmla, data = d, dfsplit = 10))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.673
     >
     >
     > ## check tests
     > library("strucchange")
     Loading required package: zoo
    
     Attaching package: 'zoo'
    
     The following objects are masked from 'package:base':
    
     as.Date, as.Date.numeric
    
     > sctest(mmfluc3, node = 1) # does not yet work
     Error in UseMethod("estfun") :
     no applicable method for 'estfun' applied to an object of class "c('glmtree', 'modelparty', 'party')"
     Calls: sctest -> sctest.default -> gefp -> scores
     Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 1.2-1
Check: running R code from vignettes
Result: ERROR
    Errors in running code in vignettes:
    when running code in ‘ctree.Rnw’
     ...
    
    > options(width = 70, SweaveHooks = list(leftpar = function() par(mai = par("mai") *
    + c(1, 1.1, 1, 1))))
    
    > require("partykit")
    Loading required package: partykit
    Loading required package: grid
    Loading required package: libcoin
    Loading required package: mvtnorm
    Loading required package: rpart
    
    > require("coin")
    Loading required package: coin
    Loading required package: survival
    
    Attaching package: ‘survival’
    
    The following object is masked from ‘package:rpart’:
    
     solder
    
    
    > require("strucchange")
    Loading required package: strucchange
    Loading required package: zoo
    
    Attaching package: ‘zoo’
    
    The following objects are masked from ‘package:base’:
    
     as.Date, as.Date.numeric
    
    Loading required package: sandwich
    
    > require("coin")
    
    > require("Formula")
    Loading required package: Formula
    
    > require("survival")
    
    > require("sandwich")
    
    > set.seed(290875)
    
    > ctree_control(teststat = "max")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x997bb8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8bfebc0>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8bfd0d8>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8bfcff8>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8bfcea8>
    
    $teststat
    [1] "maximum"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(teststat = "quad")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x997bb8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8cf5a40>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8cf5960>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8cf5880>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8cf5730>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(testtype = "Bonferroni")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x997bb8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8d029a0>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8d028c0>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8d027e0>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8d02690>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(minsplit = 20)
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x997bb8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8d11660>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8d11580>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8d114a0>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8d11350>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(maxsurrogate = 3)
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 3
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x997bb8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8d240a8>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8d23fc8>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfb960>
    <environment: 0x8d23ee8>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x8bfdca8>
    <environment: 0x8d23d98>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ls <- data.frame(y = gl(3, 50, labels = c("A", "B",
    + "C")), x1 = rnorm(150) + rep(c(1, 0, 0), c(50, 50, 50)),
    + x2 = runif(150))
    
    > library("partykit")
    
    > ctree(y ~ x1 + x2, data = ls)
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > ct <- ctree(y ~ x1 + x2, data = ls)
    
    > ct
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > plot(ct)
    
    > ct[1]
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > class(ct[1])
    [1] "constparty" "party"
    
    > predict(ct, newdata = ls)
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
     A A A A C A C A C C A A C A A A A
     18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
     C A C A A A C A A A C C A A C A A
     35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
     C A A C C C A A C C C C A A A A A
     52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
     A C C C C A C C A C C C C C C A A
     69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
     A A A C C A C A C C C C C C C C C
     86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
     C C C A C A C A C C C C C C C C A
    103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
     C C C A C C A C C C C C C C A C C
    120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
     C C C C C C C C C C C C C C C C C
    137 138 139 140 141 142 143 144 145 146 147 148 149 150
     C A C C C C A C C A C A C A
    Levels: A B C
    
    > predict(ct, newdata = ls[c(1, 51, 101), ], type = "prob")
     A B C
    1 0.5740741 0.2592593 0.1666667
    51 0.5740741 0.2592593 0.1666667
    101 0.1979167 0.3750000 0.4270833
    
    > predict(ct, newdata = ls[c(1, 51, 101), ], type = "node")
     1 51 101
     3 3 2
    
    > library("strucchange")
    
    > sctest(ct)
    
     When sourcing ‘ctree.R’:
    Error: no applicable method for ‘estfun’ applied to an object of class "c('constparty', 'party')"
    Execution halted
    when running code in ‘mob.Rnw’
     ...
    
    > library("partykit")
    Loading required package: grid
    Loading required package: libcoin
    Loading required package: mvtnorm
    Loading required package: rpart
    
    > options(prompt = "R> ", continue = "+ ", digits = 4,
    + useFancyQuotes = FALSE)
    
    > data("PimaIndiansDiabetes", package = "mlbench")
    
    > pid_formula <- diabetes ~ glucose | pregnant + pressure +
    + triceps + insulin + mass + pedigree + age
    
    > logit <- function(y, x, start = NULL, weights = NULL,
    + offset = NULL, ...) {
    + glm(y ~ 0 + x, family = binomial, start = start, ...)
    + }
    
    > pid_tree <- mob(pid_formula, data = PimaIndiansDiabetes,
    + fit = logit)
    
    > pid_tree
    Model-based recursive partitioning (logit)
    
    Model formula:
    diabetes ~ glucose | pregnant + pressure + triceps + insulin +
     mass + pedigree + age
    
    Fitted party:
    [1] root
    | [2] mass <= 26.3: n = 167
    | x(Intercept) xglucose
    | -9.95151 0.05871
    | [3] mass > 26.3
    | | [4] age <= 30: n = 304
    | | x(Intercept) xglucose
    | | -6.70559 0.04684
    | | [5] age > 30: n = 297
    | | x(Intercept) xglucose
    | | -2.77095 0.02354
    
    Number of inner nodes: 2
    Number of terminal nodes: 3
    Number of parameters per node: 2
    Objective function: 355.5
    
    > pid_tree2 <- glmtree(diabetes ~ glucose | pregnant +
    + pressure + triceps + insulin + mass + pedigree + age, data = PimaIndiansDiabetes,
    + .... [TRUNCATED]
    
    > plot(pid_tree)
    
    > plot(pid_tree2, tp_args = list(ylines = 1, margins = c(1.5,
    + 1.5, 1.5, 2.5)))
    Loading required namespace: vcd
    
    > library("strucchange")
    Loading required package: zoo
    
    Attaching package: 'zoo'
    
    The following objects are masked from 'package:base':
    
     as.Date, as.Date.numeric
    
    Loading required package: sandwich
    
    > sctest(pid_tree, node = 1)
    
     When sourcing 'mob.R':
    Error: no applicable method for ‘estfun’ applied to an object of class "c('modelparty', 'party')"
    Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 1.2-1
Check: re-building of vignette outputs
Result: WARN
    Error in re-building vignettes:
     ...
    Loading required package: grid
    Loading required package: libcoin
    Loading required package: mvtnorm
    Loading required package: rpart
    Loading required package: RWeka
    Loading required namespace: XML
    Loading required package: XML
    
    Attaching package: ‘XML’
    
    The following object is masked from ‘package:tools’:
    
     toHTML
    
    Loading required package: coin
    Loading required package: survival
    
    Attaching package: ‘survival’
    
    The following object is masked from ‘package:rpart’:
    
     solder
    
    Loading required package: strucchange
    Loading required package: zoo
    
    Attaching package: ‘zoo’
    
    The following objects are masked from ‘package:base’:
    
     as.Date, as.Date.numeric
    
    Loading required package: sandwich
    Loading required package: Formula
    
    Error: processing vignette ‘ctree.Rnw’ failed with diagnostics:
     chunk 17 (label = party-sctest)
    Error in UseMethod("estfun") :
     no applicable method for ‘estfun’ applied to an object of class "c('constparty', 'party')"
    Execution halted
Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-patched-linux-x86_64, r-release-linux-x86_64

Version: 1.2-1
Check: tests
Result: ERROR
     Running ‘bugfixes.R’ [6s/7s]
     Comparing ‘bugfixes.Rout’ to ‘bugfixes.Rout.save’ ... OK
     Running ‘regtest-MIA.R’ [2s/3s]
     Comparing ‘regtest-MIA.Rout’ to ‘regtest-MIA.Rout.save’ ... OK
     Running ‘regtest-cforest.R’ [9s/13s]
     Comparing ‘regtest-cforest.Rout’ to ‘regtest-cforest.Rout.save’ ... OK
     Running ‘regtest-ctree.R’ [2s/4s]
     Comparing ‘regtest-ctree.Rout’ to ‘regtest-ctree.Rout.save’ ... OK
     Running ‘regtest-glmtree.R’ [9s/14s]
    Running the tests in ‘tests/regtest-glmtree.R’ failed.
    Complete output:
     >
     > library("partykit")
     Loading required package: grid
     Loading required package: libcoin
     Loading required package: mvtnorm
     Loading required package: rpart
     > library("sandwich")
     >
     > set.seed(29)
     > n <- 1000
     > x <- runif(n)
     > z <- runif(n)
     > y <- rnorm(n, mean = x * c(-1, 1)[(z > 0.7) + 1], sd = 3)
     > z_noise <- factor(sample(1:3, size = n, replace = TRUE))
     > d <- data.frame(y = y, x = x, z = z, z_noise = z_noise)
     >
     >
     > fmla <- as.formula("y ~ x | z + z_noise")
     > fmly <- gaussian()
     > fit <- partykit:::glmfit
     >
     > # versions of the data
     > d1 <- d
     > d1$z <- signif(d1$z, digits = 1)
     >
     > k <- 20
     > zs_noise <- matrix(rnorm(n*k), nrow = n)
     > colnames(zs_noise) <- paste0("z_noise_", 1:k)
     > d2 <- cbind(d, zs_noise)
     > fmla2 <- as.formula(paste("y ~ x | z + z_noise +",
     + paste0("z_noise_", 1:k, collapse = " + ")))
     >
     >
     > d3 <- d2
     > d3$z <- factor(sample(1:3, size = n, replace = TRUE, prob = c(0.1, 0.5, 0.4)))
     > d3$y <- rnorm(n, mean = x * c(-1, 1)[(d3$z == 2) + 1], sd = 3)
     >
     > ## check weights
     > w <- rep(1, n)
     > w[1:10] <- 2
     > (mw1 <- glmtree(formula = fmla, data = d, weights = w))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 706
     | (Intercept) x
     | -0.1447422 -0.8138701
     | [3] z > 0.70311: n = 304
     | (Intercept) x
     | 0.07006626 0.73278593
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.48
     > (mw2 <- glmtree(formula = fmla, data = d, weights = w, caseweights = FALSE))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1447422 -0.8138701
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.07006626 0.73278593
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.48
     >
     >
     >
     > ## check dfsplit
     > (mmfluc2 <- mob(formula = fmla, data = d, fit = partykit:::glmfit))
     Model-based recursive partitioning (partykit:::glmfit)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function: 2551.673
     > (mmfluc3 <- glmtree(formula = fmla, data = d))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.673
     > (mmfluc3_dfsplit <- glmtree(formula = fmla, data = d, dfsplit = 10))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.673
     >
     >
     > ## check tests
     > library("strucchange")
     Loading required package: zoo
    
     Attaching package: 'zoo'
    
     The following objects are masked from 'package:base':
    
     as.Date, as.Date.numeric
    
     > sctest(mmfluc3, node = 1) # does not yet work
     Error in UseMethod("estfun") :
     no applicable method for 'estfun' applied to an object of class "c('glmtree', 'modelparty', 'party')"
     Calls: sctest -> sctest.default -> gefp -> scores
     Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc

Version: 1.2-1
Check: running R code from vignettes
Result: ERROR
    Errors in running code in vignettes:
    when running code in ‘ctree.Rnw’
     ...
    
    > options(width = 70, SweaveHooks = list(leftpar = function() par(mai = par("mai") *
    + c(1, 1.1, 1, 1))))
    
    > require("partykit")
    Loading required package: partykit
    Loading required package: grid
    Loading required package: libcoin
    Loading required package: mvtnorm
    Loading required package: rpart
    
    > require("coin")
    Loading required package: coin
    Loading required package: survival
    
    Attaching package: ‘survival’
    
    The following object is masked from ‘package:rpart’:
    
     solder
    
    
    > require("strucchange")
    Loading required package: strucchange
    Loading required package: zoo
    
    Attaching package: ‘zoo’
    
    The following objects are masked from ‘package:base’:
    
     as.Date, as.Date.numeric
    
    Loading required package: sandwich
    
    > require("coin")
    
    > require("Formula")
    Loading required package: Formula
    
    > require("survival")
    
    > require("sandwich")
    
    > set.seed(290875)
    
    > ctree_control(teststat = "max")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x556c9d52dbe8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca5795dd8>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca57942f0>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca5794210>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca57940c0>
    
    $teststat
    [1] "maximum"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(teststat = "quad")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x556c9d52dbe8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca588ad38>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca588ac58>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca588ab78>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca588aa28>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(testtype = "Bonferroni")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x556c9d52dbe8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca5897c98>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca5897bb8>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca5897ad8>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca5897988>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(minsplit = 20)
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x556c9d52dbe8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca58a6958>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca58a6878>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca58a6798>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca58a6648>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(maxsurrogate = 3)
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 3
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x556c9d52dbe8>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca58b93a0>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca58b92c0>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5792b78>
    <environment: 0x556ca58b91e0>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x556ca5794ec0>
    <environment: 0x556ca58b9090>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ls <- data.frame(y = gl(3, 50, labels = c("A", "B",
    + "C")), x1 = rnorm(150) + rep(c(1, 0, 0), c(50, 50, 50)),
    + x2 = runif(150))
    
    > library("partykit")
    
    > ctree(y ~ x1 + x2, data = ls)
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > ct <- ctree(y ~ x1 + x2, data = ls)
    
    > ct
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > plot(ct)
    
    > ct[1]
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > class(ct[1])
    [1] "constparty" "party"
    
    > predict(ct, newdata = ls)
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
     A A A A C A C A C C A A C A A A A
     18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
     C A C A A A C A A A C C A A C A A
     35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
     C A A C C C A A C C C C A A A A A
     52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
     A C C C C A C C A C C C C C C A A
     69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
     A A A C C A C A C C C C C C C C C
     86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
     C C C A C A C A C C C C C C C C A
    103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
     C C C A C C A C C C C C C C A C C
    120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
     C C C C C C C C C C C C C C C C C
    137 138 139 140 141 142 143 144 145 146 147 148 149 150
     C A C C C C A C C A C A C A
    Levels: A B C
    
    > predict(ct, newdata = ls[c(1, 51, 101), ], type = "prob")
     A B C
    1 0.5740741 0.2592593 0.1666667
    51 0.5740741 0.2592593 0.1666667
    101 0.1979167 0.3750000 0.4270833
    
    > predict(ct, newdata = ls[c(1, 51, 101), ], type = "node")
     1 51 101
     3 3 2
    
    > library("strucchange")
    
    > sctest(ct)
    
     When sourcing ‘ctree.R’:
    Error: no applicable method for ‘estfun’ applied to an object of class "c('constparty', 'party')"
    Execution halted
    when running code in ‘mob.Rnw’
     ...
    
    > library("partykit")
    Loading required package: grid
    Loading required package: libcoin
    Loading required package: mvtnorm
    Loading required package: rpart
    
    > options(prompt = "R> ", continue = "+ ", digits = 4,
    + useFancyQuotes = FALSE)
    
    > data("PimaIndiansDiabetes", package = "mlbench")
    
    > pid_formula <- diabetes ~ glucose | pregnant + pressure +
    + triceps + insulin + mass + pedigree + age
    
    > logit <- function(y, x, start = NULL, weights = NULL,
    + offset = NULL, ...) {
    + glm(y ~ 0 + x, family = binomial, start = start, ...)
    + }
    
    > pid_tree <- mob(pid_formula, data = PimaIndiansDiabetes,
    + fit = logit)
    
    > pid_tree
    Model-based recursive partitioning (logit)
    
    Model formula:
    diabetes ~ glucose | pregnant + pressure + triceps + insulin +
     mass + pedigree + age
    
    Fitted party:
    [1] root
    | [2] mass <= 26.3: n = 167
    | x(Intercept) xglucose
    | -9.95151 0.05871
    | [3] mass > 26.3
    | | [4] age <= 30: n = 304
    | | x(Intercept) xglucose
    | | -6.70559 0.04684
    | | [5] age > 30: n = 297
    | | x(Intercept) xglucose
    | | -2.77095 0.02354
    
    Number of inner nodes: 2
    Number of terminal nodes: 3
    Number of parameters per node: 2
    Objective function: 355.5
    
    > pid_tree2 <- glmtree(diabetes ~ glucose | pregnant +
    + pressure + triceps + insulin + mass + pedigree + age, data = PimaIndiansDiabetes,
    + .... [TRUNCATED]
    
    > plot(pid_tree)
    
    > plot(pid_tree2, tp_args = list(ylines = 1, margins = c(1.5,
    + 1.5, 1.5, 2.5)))
    Loading required namespace: vcd
    
    > library("strucchange")
    Loading required package: zoo
    
    Attaching package: 'zoo'
    
    The following objects are masked from 'package:base':
    
     as.Date, as.Date.numeric
    
    Loading required package: sandwich
    
    > sctest(pid_tree, node = 1)
    
     When sourcing 'mob.R':
    Error: no applicable method for ‘estfun’ applied to an object of class "c('modelparty', 'party')"
    Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc

Version: 1.2-1
Check: tests
Result: ERROR
     Running ‘bugfixes.R’ [7s/9s]
     Comparing ‘bugfixes.Rout’ to ‘bugfixes.Rout.save’ ... OK
     Running ‘regtest-MIA.R’ [2s/3s]
     Comparing ‘regtest-MIA.Rout’ to ‘regtest-MIA.Rout.save’ ... OK
     Running ‘regtest-cforest.R’ [11s/13s]
     Comparing ‘regtest-cforest.Rout’ to ‘regtest-cforest.Rout.save’ ... OK
     Running ‘regtest-ctree.R’ [2s/3s]
     Comparing ‘regtest-ctree.Rout’ to ‘regtest-ctree.Rout.save’ ... OK
     Running ‘regtest-glmtree.R’ [11s/14s]
    Running the tests in ‘tests/regtest-glmtree.R’ failed.
    Complete output:
     >
     > library("partykit")
     Loading required package: grid
     Loading required package: libcoin
     Loading required package: mvtnorm
     Loading required package: rpart
     > library("sandwich")
     >
     > set.seed(29)
     > n <- 1000
     > x <- runif(n)
     > z <- runif(n)
     > y <- rnorm(n, mean = x * c(-1, 1)[(z > 0.7) + 1], sd = 3)
     > z_noise <- factor(sample(1:3, size = n, replace = TRUE))
     > d <- data.frame(y = y, x = x, z = z, z_noise = z_noise)
     >
     >
     > fmla <- as.formula("y ~ x | z + z_noise")
     > fmly <- gaussian()
     > fit <- partykit:::glmfit
     >
     > # versions of the data
     > d1 <- d
     > d1$z <- signif(d1$z, digits = 1)
     >
     > k <- 20
     > zs_noise <- matrix(rnorm(n*k), nrow = n)
     > colnames(zs_noise) <- paste0("z_noise_", 1:k)
     > d2 <- cbind(d, zs_noise)
     > fmla2 <- as.formula(paste("y ~ x | z + z_noise +",
     + paste0("z_noise_", 1:k, collapse = " + ")))
     >
     >
     > d3 <- d2
     > d3$z <- factor(sample(1:3, size = n, replace = TRUE, prob = c(0.1, 0.5, 0.4)))
     > d3$y <- rnorm(n, mean = x * c(-1, 1)[(d3$z == 2) + 1], sd = 3)
     >
     > ## check weights
     > w <- rep(1, n)
     > w[1:10] <- 2
     > (mw1 <- glmtree(formula = fmla, data = d, weights = w))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 706
     | (Intercept) x
     | -0.1447422 -0.8138701
     | [3] z > 0.70311: n = 304
     | (Intercept) x
     | 0.07006626 0.73278593
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.48
     > (mw2 <- glmtree(formula = fmla, data = d, weights = w, caseweights = FALSE))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1447422 -0.8138701
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.07006626 0.73278593
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.48
     >
     >
     >
     > ## check dfsplit
     > (mmfluc2 <- mob(formula = fmla, data = d, fit = partykit:::glmfit))
     Model-based recursive partitioning (partykit:::glmfit)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function: 2551.673
     > (mmfluc3 <- glmtree(formula = fmla, data = d))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.673
     > (mmfluc3_dfsplit <- glmtree(formula = fmla, data = d, dfsplit = 10))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.673
     >
     >
     > ## check tests
     > library("strucchange")
     Loading required package: zoo
    
     Attaching package: 'zoo'
    
     The following objects are masked from 'package:base':
    
     as.Date, as.Date.numeric
    
     > sctest(mmfluc3, node = 1) # does not yet work
     Error in UseMethod("estfun") :
     no applicable method for 'estfun' applied to an object of class "c('glmtree', 'modelparty', 'party')"
     Calls: sctest -> sctest.default -> gefp -> scores
     Execution halted
Flavor: r-patched-linux-x86_64

Version: 1.2-1
Check: running R code from vignettes
Result: ERROR
    Errors in running code in vignettes:
    when running code in ‘ctree.Rnw’
     ...
    
    > options(width = 70, SweaveHooks = list(leftpar = function() par(mai = par("mai") *
    + c(1, 1.1, 1, 1))))
    
    > require("partykit")
    Loading required package: partykit
    Loading required package: grid
    Loading required package: libcoin
    Loading required package: mvtnorm
    Loading required package: rpart
    
    > require("coin")
    Loading required package: coin
    Loading required package: survival
    
    Attaching package: ‘survival’
    
    The following object is masked from ‘package:rpart’:
    
     solder
    
    
    > require("strucchange")
    Loading required package: strucchange
    Loading required package: zoo
    
    Attaching package: ‘zoo’
    
    The following objects are masked from ‘package:base’:
    
     as.Date, as.Date.numeric
    
    Loading required package: sandwich
    
    > require("coin")
    
    > require("Formula")
    Loading required package: Formula
    
    > require("survival")
    
    > require("sandwich")
    
    > set.seed(290875)
    
    > ctree_control(teststat = "max")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x563404053b30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fc79190>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fc7f558>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fc7f478>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fc7f328>
    
    $teststat
    [1] "maximum"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(teststat = "quad")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x563404053b30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fcaba20>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fcab940>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fcab860>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fcab710>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(testtype = "Bonferroni")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x563404053b30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fcbc6a8>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fcbc5c8>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fcbc4e8>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fcbc398>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(minsplit = 20)
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x563404053b30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fcd0590>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fcd04b0>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fcd03d0>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fcd0280>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(maxsurrogate = 3)
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 3
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x563404053b30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fce10c8>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fce0fe8>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc79d60>
    <environment: 0x56340fce0f08>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x56340fc80128>
    <environment: 0x56340fce0db8>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ls <- data.frame(y = gl(3, 50, labels = c("A", "B",
    + "C")), x1 = rnorm(150) + rep(c(1, 0, 0), c(50, 50, 50)),
    + x2 = runif(150))
    
    > library("partykit")
    
    > ctree(y ~ x1 + x2, data = ls)
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > ct <- ctree(y ~ x1 + x2, data = ls)
    
    > ct
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > plot(ct)
    
    > ct[1]
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > class(ct[1])
    [1] "constparty" "party"
    
    > predict(ct, newdata = ls)
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
     A A A A C A C A C C A A C A A A A
     18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
     C A C A A A C A A A C C A A C A A
     35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
     C A A C C C A A C C C C A A A A A
     52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
     A C C C C A C C A C C C C C C A A
     69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
     A A A C C A C A C C C C C C C C C
     86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
     C C C A C A C A C C C C C C C C A
    103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
     C C C A C C A C C C C C C C A C C
    120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
     C C C C C C C C C C C C C C C C C
    137 138 139 140 141 142 143 144 145 146 147 148 149 150
     C A C C C C A C C A C A C A
    Levels: A B C
    
    > predict(ct, newdata = ls[c(1, 51, 101), ], type = "prob")
     A B C
    1 0.5740741 0.2592593 0.1666667
    51 0.5740741 0.2592593 0.1666667
    101 0.1979167 0.3750000 0.4270833
    
    > predict(ct, newdata = ls[c(1, 51, 101), ], type = "node")
     1 51 101
     3 3 2
    
    > library("strucchange")
    
    > sctest(ct)
    
     When sourcing ‘ctree.R’:
    Error: no applicable method for ‘estfun’ applied to an object of class "c('constparty', 'party')"
    Execution halted
    when running code in ‘mob.Rnw’
     ...
    
    > library("partykit")
    Loading required package: grid
    Loading required package: libcoin
    Loading required package: mvtnorm
    Loading required package: rpart
    
    > options(prompt = "R> ", continue = "+ ", digits = 4,
    + useFancyQuotes = FALSE)
    
    > data("PimaIndiansDiabetes", package = "mlbench")
    
    > pid_formula <- diabetes ~ glucose | pregnant + pressure +
    + triceps + insulin + mass + pedigree + age
    
    > logit <- function(y, x, start = NULL, weights = NULL,
    + offset = NULL, ...) {
    + glm(y ~ 0 + x, family = binomial, start = start, ...)
    + }
    
    > pid_tree <- mob(pid_formula, data = PimaIndiansDiabetes,
    + fit = logit)
    
    > pid_tree
    Model-based recursive partitioning (logit)
    
    Model formula:
    diabetes ~ glucose | pregnant + pressure + triceps + insulin +
     mass + pedigree + age
    
    Fitted party:
    [1] root
    | [2] mass <= 26.3: n = 167
    | x(Intercept) xglucose
    | -9.95151 0.05871
    | [3] mass > 26.3
    | | [4] age <= 30: n = 304
    | | x(Intercept) xglucose
    | | -6.70559 0.04684
    | | [5] age > 30: n = 297
    | | x(Intercept) xglucose
    | | -2.77095 0.02354
    
    Number of inner nodes: 2
    Number of terminal nodes: 3
    Number of parameters per node: 2
    Objective function: 355.5
    
    > pid_tree2 <- glmtree(diabetes ~ glucose | pregnant +
    + pressure + triceps + insulin + mass + pedigree + age, data = PimaIndiansDiabetes,
    + .... [TRUNCATED]
    
    > plot(pid_tree)
    
    > plot(pid_tree2, tp_args = list(ylines = 1, margins = c(1.5,
    + 1.5, 1.5, 2.5)))
    Loading required namespace: vcd
    
    > library("strucchange")
    Loading required package: zoo
    
    Attaching package: 'zoo'
    
    The following objects are masked from 'package:base':
    
     as.Date, as.Date.numeric
    
    Loading required package: sandwich
    
    > sctest(pid_tree, node = 1)
    
     When sourcing 'mob.R':
    Error: no applicable method for ‘estfun’ applied to an object of class "c('modelparty', 'party')"
    Execution halted
Flavor: r-patched-linux-x86_64

Version: 1.2-1
Check: package dependencies
Result: NOTE
    Package suggested but not available for checking: ‘RWeka’
Flavor: r-patched-solaris-x86

Version: 1.2-1
Check: Rd cross-references
Result: NOTE
    Package unavailable to check Rd xrefs: ‘RWeka’
Flavor: r-patched-solaris-x86

Version: 1.2-1
Check: tests
Result: ERROR
     Running ‘bugfixes.R’ [6s/7s]
     Comparing ‘bugfixes.Rout’ to ‘bugfixes.Rout.save’ ... OK
     Running ‘regtest-MIA.R’ [2s/3s]
     Comparing ‘regtest-MIA.Rout’ to ‘regtest-MIA.Rout.save’ ... OK
     Running ‘regtest-cforest.R’ [11s/14s]
     Comparing ‘regtest-cforest.Rout’ to ‘regtest-cforest.Rout.save’ ... OK
     Running ‘regtest-ctree.R’ [2s/3s]
     Comparing ‘regtest-ctree.Rout’ to ‘regtest-ctree.Rout.save’ ... OK
     Running ‘regtest-glmtree.R’ [11s/15s]
    Running the tests in ‘tests/regtest-glmtree.R’ failed.
    Complete output:
     >
     > library("partykit")
     Loading required package: grid
     Loading required package: libcoin
     Loading required package: mvtnorm
     Loading required package: rpart
     > library("sandwich")
     >
     > set.seed(29)
     > n <- 1000
     > x <- runif(n)
     > z <- runif(n)
     > y <- rnorm(n, mean = x * c(-1, 1)[(z > 0.7) + 1], sd = 3)
     > z_noise <- factor(sample(1:3, size = n, replace = TRUE))
     > d <- data.frame(y = y, x = x, z = z, z_noise = z_noise)
     >
     >
     > fmla <- as.formula("y ~ x | z + z_noise")
     > fmly <- gaussian()
     > fit <- partykit:::glmfit
     >
     > # versions of the data
     > d1 <- d
     > d1$z <- signif(d1$z, digits = 1)
     >
     > k <- 20
     > zs_noise <- matrix(rnorm(n*k), nrow = n)
     > colnames(zs_noise) <- paste0("z_noise_", 1:k)
     > d2 <- cbind(d, zs_noise)
     > fmla2 <- as.formula(paste("y ~ x | z + z_noise +",
     + paste0("z_noise_", 1:k, collapse = " + ")))
     >
     >
     > d3 <- d2
     > d3$z <- factor(sample(1:3, size = n, replace = TRUE, prob = c(0.1, 0.5, 0.4)))
     > d3$y <- rnorm(n, mean = x * c(-1, 1)[(d3$z == 2) + 1], sd = 3)
     >
     > ## check weights
     > w <- rep(1, n)
     > w[1:10] <- 2
     > (mw1 <- glmtree(formula = fmla, data = d, weights = w))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 706
     | (Intercept) x
     | -0.1447422 -0.8138701
     | [3] z > 0.70311: n = 304
     | (Intercept) x
     | 0.07006626 0.73278593
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.48
     > (mw2 <- glmtree(formula = fmla, data = d, weights = w, caseweights = FALSE))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1447422 -0.8138701
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.07006626 0.73278593
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.48
     >
     >
     >
     > ## check dfsplit
     > (mmfluc2 <- mob(formula = fmla, data = d, fit = partykit:::glmfit))
     Model-based recursive partitioning (partykit:::glmfit)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function: 2551.673
     > (mmfluc3 <- glmtree(formula = fmla, data = d))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.673
     > (mmfluc3_dfsplit <- glmtree(formula = fmla, data = d, dfsplit = 10))
     Generalized linear model tree (family: gaussian)
    
     Model formula:
     y ~ x | z + z_noise
    
     Fitted party:
     [1] root
     | [2] z <= 0.70311: n = 704
     | (Intercept) x
     | -0.1619978 -0.7896293
     | [3] z > 0.70311: n = 296
     | (Intercept) x
     | 0.08683535 0.65598287
    
     Number of inner nodes: 1
     Number of terminal nodes: 2
     Number of parameters per node: 2
     Objective function (negative log-likelihood): 2551.673
     >
     >
     > ## check tests
     > library("strucchange")
     Loading required package: zoo
    
     Attaching package: 'zoo'
    
     The following objects are masked from 'package:base':
    
     as.Date, as.Date.numeric
    
     > sctest(mmfluc3, node = 1) # does not yet work
     Error in UseMethod("estfun") :
     no applicable method for 'estfun' applied to an object of class "c('glmtree', 'modelparty', 'party')"
     Calls: sctest -> sctest.default -> gefp -> scores
     Execution halted
Flavor: r-release-linux-x86_64

Version: 1.2-1
Check: running R code from vignettes
Result: ERROR
    Errors in running code in vignettes:
    when running code in ‘ctree.Rnw’
     ...
    
    > options(width = 70, SweaveHooks = list(leftpar = function() par(mai = par("mai") *
    + c(1, 1.1, 1, 1))))
    
    > require("partykit")
    Loading required package: partykit
    Loading required package: grid
    Loading required package: libcoin
    Loading required package: mvtnorm
    Loading required package: rpart
    
    > require("coin")
    Loading required package: coin
    Loading required package: survival
    
    Attaching package: ‘survival’
    
    The following object is masked from ‘package:rpart’:
    
     solder
    
    
    > require("strucchange")
    Loading required package: strucchange
    Loading required package: zoo
    
    Attaching package: ‘zoo’
    
    The following objects are masked from ‘package:base’:
    
     as.Date, as.Date.numeric
    
    Loading required package: sandwich
    
    > require("coin")
    
    > require("Formula")
    Loading required package: Formula
    
    > require("survival")
    
    > require("sandwich")
    
    > set.seed(290875)
    
    > ctree_control(teststat = "max")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x55e281deeb30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da1dee0>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da1c3f8>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da1c318>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da1c1c8>
    
    $teststat
    [1] "maximum"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(teststat = "quad")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x55e281deeb30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da469a0>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da468c0>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da467e0>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da46690>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(testtype = "Bonferroni")
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x55e281deeb30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da57628>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da57548>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da57468>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da57318>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(minsplit = 20)
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 0
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x55e281deeb30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da6b510>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da6b430>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da6b350>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da6b200>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ctree_control(maxsurrogate = 3)
    $criterion
    [1] "p.value"
    
    $logmincriterion
    [1] -0.05129329
    
    $minsplit
    [1] 20
    
    $minbucket
    [1] 7
    
    $minprob
    [1] 0.01
    
    $stump
    [1] FALSE
    
    $nmax
     yx z
    Inf Inf
    
    $lookahead
    [1] FALSE
    
    $mtry
    [1] Inf
    
    $maxdepth
    [1] Inf
    
    $multiway
    [1] FALSE
    
    $splittry
    [1] 2
    
    $maxsurrogate
    [1] 3
    
    $numsurrogate
    [1] FALSE
    
    $majority
    [1] FALSE
    
    $caseweights
    [1] TRUE
    
    $applyfun
    function (X, FUN, ...)
    {
     FUN <- match.fun(FUN)
     if (!is.vector(X) || is.object(X))
     X <- as.list(X)
     .Internal(lapply(X, FUN))
    }
    <bytecode: 0x55e281deeb30>
    <environment: namespace:base>
    
    $saveinfo
    [1] TRUE
    
    $bonferroni
    [1] TRUE
    
    $update
    NULL
    
    $selectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da7c048>
    
    $splitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da7bf68>
    
    $svselectfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .select(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da16c00>
    <environment: 0x55e28da7be88>
    
    $svsplitfun
    function (model, trafo, data, subset, weights, whichvar, ctrl)
    {
     args <- list(...)
     ctrl[names(args)] <- args
     .split(model, trafo, data, subset, weights, whichvar, ctrl,
     FUN = .ctree_test)
    }
    <bytecode: 0x55e28da1cfc8>
    <environment: 0x55e28da7bd38>
    
    $teststat
    [1] "quadratic"
    
    $splitstat
    [1] "quadratic"
    
    $splittest
    [1] FALSE
    
    $pargs
    $maxpts
    [1] 25000
    
    $abseps
    [1] 0.001
    
    $releps
    [1] 0
    
    attr(,"class")
    [1] "GenzBretz"
    
    $testtype
    [1] "Bonferroni"
    
    $nresample
    [1] 9999
    
    $tol
    [1] 1.490116e-08
    
    $intersplit
    [1] FALSE
    
    $MIA
    [1] FALSE
    
    
    > ls <- data.frame(y = gl(3, 50, labels = c("A", "B",
    + "C")), x1 = rnorm(150) + rep(c(1, 0, 0), c(50, 50, 50)),
    + x2 = runif(150))
    
    > library("partykit")
    
    > ctree(y ~ x1 + x2, data = ls)
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > ct <- ctree(y ~ x1 + x2, data = ls)
    
    > ct
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > plot(ct)
    
    > ct[1]
    
    Model formula:
    y ~ x1 + x2
    
    Fitted party:
    [1] root
    | [2] x1 <= 0.82552: C (n = 96, err = 57.3%)
    | [3] x1 > 0.82552: A (n = 54, err = 42.6%)
    
    Number of inner nodes: 1
    Number of terminal nodes: 2
    
    > class(ct[1])
    [1] "constparty" "party"
    
    > predict(ct, newdata = ls)
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
     A A A A C A C A C C A A C A A A A
     18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
     C A C A A A C A A A C C A A C A A
     35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
     C A A C C C A A C C C C A A A A A
     52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
     A C C C C A C C A C C C C C C A A
     69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
     A A A C C A C A C C C C C C C C C
     86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
     C C C A C A C A C C C C C C C C A
    103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
     C C C A C C A C C C C C C C A C C
    120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
     C C C C C C C C C C C C C C C C C
    137 138 139 140 141 142 143 144 145 146 147 148 149 150
     C A C C C C A C C A C A C A
    Levels: A B C
    
    > predict(ct, newdata = ls[c(1, 51, 101), ], type = "prob")
     A B C
    1 0.5740741 0.2592593 0.1666667
    51 0.5740741 0.2592593 0.1666667
    101 0.1979167 0.3750000 0.4270833
    
    > predict(ct, newdata = ls[c(1, 51, 101), ], type = "node")
     1 51 101
     3 3 2
    
    > library("strucchange")
    
    > sctest(ct)
    
     When sourcing ‘ctree.R’:
    Error: no applicable method for ‘estfun’ applied to an object of class "c('constparty', 'party')"
    Execution halted
    when running code in ‘mob.Rnw’
     ...
    
    > library("partykit")
    Loading required package: grid
    Loading required package: libcoin
    Loading required package: mvtnorm
    Loading required package: rpart
    
    > options(prompt = "R> ", continue = "+ ", digits = 4,
    + useFancyQuotes = FALSE)
    
    > data("PimaIndiansDiabetes", package = "mlbench")
    
    > pid_formula <- diabetes ~ glucose | pregnant + pressure +
    + triceps + insulin + mass + pedigree + age
    
    > logit <- function(y, x, start = NULL, weights = NULL,
    + offset = NULL, ...) {
    + glm(y ~ 0 + x, family = binomial, start = start, ...)
    + }
    
    > pid_tree <- mob(pid_formula, data = PimaIndiansDiabetes,
    + fit = logit)
    
    > pid_tree
    Model-based recursive partitioning (logit)
    
    Model formula:
    diabetes ~ glucose | pregnant + pressure + triceps + insulin +
     mass + pedigree + age
    
    Fitted party:
    [1] root
    | [2] mass <= 26.3: n = 167
    | x(Intercept) xglucose
    | -9.95151 0.05871
    | [3] mass > 26.3
    | | [4] age <= 30: n = 304
    | | x(Intercept) xglucose
    | | -6.70559 0.04684
    | | [5] age > 30: n = 297
    | | x(Intercept) xglucose
    | | -2.77095 0.02354
    
    Number of inner nodes: 2
    Number of terminal nodes: 3
    Number of parameters per node: 2
    Objective function: 355.5
    
    > pid_tree2 <- glmtree(diabetes ~ glucose | pregnant +
    + pressure + triceps + insulin + mass + pedigree + age, data = PimaIndiansDiabetes,
    + .... [TRUNCATED]
    
    > plot(pid_tree)
    
    > plot(pid_tree2, tp_args = list(ylines = 1, margins = c(1.5,
    + 1.5, 1.5, 2.5)))
    Loading required namespace: vcd
    
    > library("strucchange")
    Loading required package: zoo
    
    Attaching package: 'zoo'
    
    The following objects are masked from 'package:base':
    
     as.Date, as.Date.numeric
    
    Loading required package: sandwich
    
    > sctest(pid_tree, node = 1)
    
     When sourcing 'mob.R':
    Error: no applicable method for ‘estfun’ applied to an object of class "c('modelparty', 'party')"
    Execution halted
Flavor: r-release-linux-x86_64