Switch to unified view

a b/partyMod/tests/Node-regtest.Rout.save
1
2
R Under development (unstable) (2014-06-29 r66051) -- "Unsuffered Consequences"
3
Copyright (C) 2014 The R Foundation for Statistical Computing
4
Platform: x86_64-unknown-linux-gnu (64-bit)
5
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
7
You are welcome to redistribute it under certain conditions.
8
Type 'license()' or 'licence()' for distribution details.
9
10
R is a collaborative project with many contributors.
11
Type 'contributors()' for more information and
12
'citation()' on how to cite R or R packages in publications.
13
14
Type 'demo()' for some demos, 'help()' for on-line help, or
15
'help.start()' for an HTML browser interface to help.
16
Type 'q()' to quit R.
17
18
> 
19
> set.seed(290875)
20
> library("party")
21
Loading required package: grid
22
Loading required package: zoo
23
24
Attaching package: 'zoo'
25
26
The following objects are masked from 'package:base':
27
28
    as.Date, as.Date.numeric
29
30
Loading required package: sandwich
31
Loading required package: strucchange
32
Loading required package: modeltools
33
Loading required package: stats4
34
> if (!require("TH.data"))
35
+     stop("cannot load package TH.data")
36
Loading required package: TH.data
37
> 
38
> ### get rid of the NAMESPACE
39
> attach(asNamespace("party"))
40
The following objects are masked from package:party:
41
42
    cforest, cforest_classical, cforest_control, cforest_unbiased,
43
    conditionalTree, ctree, ctree_control, ctree_memory, edge_simple,
44
    mob, mob_control, node_barplot, node_bivplot, node_boxplot,
45
    node_density, node_hist, node_inner, node_scatterplot, node_surv,
46
    node_terminal, proximity, ptrafo, reweight, sctest.mob, varimp,
47
    varimpAUC
48
49
> 
50
> gtctrl <- new("GlobalTestControl")
51
> tlev <- levels(gtctrl@testtype)
52
> 
53
> data(GlaucomaM, package = "TH.data")
54
> inp <- initVariableFrame(GlaucomaM[,-63,drop = FALSE], trafo = NULL) #, fun = rank)
55
> resp <- initVariableFrame(GlaucomaM[,"Class",drop = FALSE], trafo = NULL, response = TRUE)
56
> ls <- new("LearningSample", inputs = inp, responses = resp,
57
+           weights = rep(1, inp@nobs), nobs = nrow(GlaucomaM), 
58
+           ninputs = inp@ninputs)
59
> tm <- ctree_memory(ls, TRUE)
60
> ctrl <- ctree_control()
61
> node <- .Call("R_Node", ls, ls@weights, tm, ctrl, PACKAGE = "party")
62
> stopifnot(isequal(node[[5]][[3]], 0.059))
63
> 
64
> ### and now with ranked inputs -> Wilcoxon-Mann-Whitney tests
65
> inp <- initVariableFrame(GlaucomaM[,-63,drop = FALSE], trafo = function(data)
66
+ ptrafo(data, numeric_trafo = rank))
67
> resp <- initVariableFrame(GlaucomaM[,"Class",drop = FALSE], trafo = NULL, response = TRUE)
68
> ls <- new("LearningSample", inputs = inp, responses = resp,
69
+           weights = rep(1, inp@nobs), nobs = nrow(GlaucomaM), 
70
+           ninputs = inp@ninputs)
71
> tm <- ctree_memory(ls, TRUE)
72
> ctrl <- ctree_control()
73
> node <- .Call("R_Node", ls, ls@weights, tm, ctrl, PACKAGE = "party")
74
> stopifnot(isequal(node[[5]][[3]], 0.059))
75
> 
76
> proc.time()
77
   user  system elapsed 
78
  0.804   0.028   0.828