
R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> set.seed(290875)
> library("party")
Loading required package: grid
Loading required package: mvtnorm
Loading required package: modeltools
Loading required package: stats4
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
> if (!require("TH.data"))
+     stop("cannot load package TH.data")
Loading required package: TH.data
Loading required package: survival
Loading required package: MASS

Attaching package: 'TH.data'

The following object is masked from 'package:MASS':

    geyser

> if (!require("coin"))
+     stop("cannot load package coin")
Loading required package: coin
> 
> ### get rid of the NAMESPACE
> attach(list2env(as.list(asNamespace("party"))))
The following objects are masked from package:party:

    cforest, cforest_classical, cforest_control, cforest_unbiased,
    conditionalTree, ctree, ctree_control, edge_simple,
    initVariableFrame, mob, mob_control, node_barplot, node_bivplot,
    node_boxplot, node_density, node_hist, node_inner,
    node_scatterplot, node_surv, node_terminal, nodes, party_intern,
    prettytree, proximity, ptrafo, response, reweight, sctest.mob,
    treeresponse, varimp, varimpAUC, where

> 
> data(treepipit, package = "coin")
> ct <- ctree(counts ~ ., data = treepipit)
> stopifnot(isequal(predict(ct), predict(ct, newdata = treepipit)))
> 
> 
> data(GlaucomaM, package = "TH.data")
> ct <- ctree(Class ~ ., data = GlaucomaM)
> stopifnot(isequal(predict(ct), predict(ct, newdata = GlaucomaM)))
> stopifnot(isequal(predict(ct, type = "prob"), predict(ct, type = "prob", 
+                   newdata = GlaucomaM)))
> stopifnot(isequal(predict(ct, type = "node"), predict(ct, type = "node", 
+                   newdata = GlaucomaM)))
> stopifnot(isequal(predict(ct, type = "prob"), treeresponse(ct)))
> 
> data("GBSG2", package = "TH.data")  
> 
> GBSG2tree <- ctree(Surv(time, cens) ~ ., data = GBSG2)
> stopifnot(isequal(GBSG2tree@predict_response(), 
+           GBSG2tree@predict_response(newdata = GBSG2)))
> stopifnot(isequal(GBSG2tree@cond_distr_response(), 
+           GBSG2tree@cond_distr_response(newdata = GBSG2)))
> 
> data("mammoexp", package = "TH.data")
> attr(mammoexp$ME, "scores") <- 1:3   
> attr(mammoexp$SYMPT, "scores") <- 1:4
> attr(mammoexp$DECT, "scores") <- 1:3 
> names(mammoexp)[names(mammoexp) == "SYMPT"] <- "symptoms"
> names(mammoexp)[names(mammoexp) == "PB"] <- "benefit"
> 
> names(mammoexp)
[1] "ME"       "symptoms" "benefit"  "HIST"     "BSE"      "DECT"    
> mtree <- ctree(ME ~ ., data = mammoexp)
> stopifnot(isequal(predict(mtree), predict(mtree, newdata = mammoexp)))
> stopifnot(isequal(predict(mtree), predict(mtree, newdata = mammoexp)))
> 
> proc.time()
   user  system elapsed 
  1.536   0.036   1.567 
