Switch to unified view

a b/partyMod/tests/bugfixes.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
> library("survival")
35
Loading required package: splines
36
> 
37
> ### get rid of the NAMESPACE
38
> attach(asNamespace("party"))
39
The following objects are masked from package:party:
40
41
    cforest, cforest_classical, cforest_control, cforest_unbiased,
42
    conditionalTree, ctree, ctree_control, ctree_memory, edge_simple,
43
    mob, mob_control, node_barplot, node_bivplot, node_boxplot,
44
    node_density, node_hist, node_inner, node_scatterplot, node_surv,
45
    node_terminal, proximity, ptrafo, reweight, sctest.mob, varimp,
46
    varimpAUC
47
48
> 
49
> ### check nominal level printing
50
> set.seed(290875)
51
> x <- gl(5, 50)
52
> df <- data.frame(y = c(rnorm(50, 0), rnorm(50, 1), rnorm(50, 2), rnorm(50, 3), rnorm(50, 4)), 
53
+                  x = x, z = rnorm(250))
54
> ctree(y ~ x, data = df)
55
56
     Conditional inference tree with 5 terminal nodes
57
58
Response:  y 
59
Input:  x 
60
Number of observations:  250 
61
62
1) x == {3, 4, 5}; criterion = 1, statistic = 159.215
63
  2) x == {4, 5}; criterion = 1, statistic = 54.696
64
    3) x == {5}; criterion = 1, statistic = 16.711
65
      4)*  weights = 50 
66
    3) x == {4}
67
      5)*  weights = 50 
68
  2) x == {3}
69
    6)*  weights = 50 
70
1) x == {1, 2}
71
  7) x == {2}; criterion = 1, statistic = 21.738
72
    8)*  weights = 50 
73
  7) x == {1}
74
    9)*  weights = 50 
75
> 
76
> ### check asymptotic vs. MonteCarlo, especially categorical splits after
77
> ### MonteCarlo resampling
78
> a <- ctree(y ~ x + z, data = df, control = ctree_control(stump = TRUE))
79
> b <- ctree(y ~ x + z, data = df,
80
+            control =  ctree_control(testtype = "Monte", stump = TRUE))
81
> stopifnot(isequal(a@tree$psplit, b@tree$psplit))  
82
> stopifnot(isequal(a@tree$criterion$statistic, b@tree$criterion$statistic))
83
> 
84
> ### we did not check the hyper parameters
85
> try(cforest_control(minsplit = -1))
86
Error in validObject(object@splitctrl) : 
87
  invalid class "SplitControl" object: FALSE
88
In addition: Warning message:
89
In validityMethod(object) :
90
  no negative values allowed in objects of class 'SplitControl'
91
> try(cforest_control(ntree = -1))
92
Error in validObject(RET) : invalid class "ForestControl" object: FALSE
93
In addition: Warning message:
94
In validityMethod(object) : 'ntree' must be equal or greater 1
95
> try(cforest_control(maxdepth = -1))
96
Error in validObject(object@tgctrl) : 
97
  invalid class "TreeGrowControl" object: FALSE
98
In addition: Warning message:
99
In validityMethod(object) : 'maxdepth' must be positive
100
> try(cforest_control(nresample = 10))
101
Error in validObject(object@gtctrl) : 
102
  invalid class "GlobalTestControl" object: FALSE
103
In addition: Warning message:
104
In validityMethod(object) : 'nresample' must be larger than 100
105
> 
106
> ### NA handling for factors and in random forest
107
> ### more than one (ordinal) response variable
108
> xo <- ordered(x)
109
> x[sample(1:length(x), 10)] <- NA
110
> cforest(y + xo ~ x + z, data = df, 
111
+         control = cforest_unbiased(ntree = 50))
112
113
     Random Forest using Conditional Inference Trees
114
115
Number of trees:  50 
116
117
Responses: y, xo 
118
Inputs:  x, z 
119
Number of observations:  250 
120
121
There were 50 or more warnings (use warnings() to see the first 50)
122
> 
123
> ### make sure minsplit is OK in the presence of missing values
124
> ### spotted by Han Lee <Han.Lee@GeodeCapital.com>
125
> load("t1.RData")
126
> tr <- try(ctree(p ~., data = t1))
127
> stopifnot(!inherits(tr, "try-error"))
128
> 
129
> ### make sure number of surrogate splits exceeds number of inputs by 1
130
> ### spotted by Henric Nilsson <henric.nilsson@phadia.com>
131
> airq <- subset(airquality, !is.na(Ozone))
132
> tr <- try(ctree(Ozone ~ Wind, data = airq,
133
+           controls = ctree_control(maxsurrogate = 3)))
134
Error in model@fit(data, ...) : 
135
  cannot set up 3 surrogate splits with only 0 ordered input variable(s)
136
> stopifnot(inherits(tr, "try-error"))
137
> 
138
> ### ctree() used only the first of a multivariate response
139
> ### spotted by Henric Nilsson <henric.nilsson@phadia.com>
140
> airq <- subset(airquality, complete.cases(Ozone, Solar.R))
141
> airOzoSol1 <- ctree(Ozone + Solar.R ~ Wind + Temp + Month + Day,
142
+                     data = airq)
143
> airOzoSol2 <- ctree(Solar.R + Ozone ~ Wind + Temp + Month + Day,
144
+                     data = airq)
145
> stopifnot(isequal(airOzoSol1@where, airOzoSol2@where))
146
> 
147
> ### one variable with all values missing
148
> dat <- data.frame(y = rnorm(100), x1 = runif(100), x2 = rep(NA, 100))
149
> ctree(y ~ x1 + x2, data = dat)
150
151
     Conditional inference tree with 1 terminal nodes
152
153
Response:  y 
154
Inputs:  x1, x2 
155
Number of observations:  100 
156
157
1)*  weights = 100 
158
> 
159
> ### one factor with only one level
160
> dat$x2 <- factor(rep(0, 100))
161
> try(ctree(y ~ x1 + x2, data = dat))
162
163
     Conditional inference tree with 1 terminal nodes
164
165
Response:  y 
166
Inputs:  x1, x2 
167
Number of observations:  100 
168
169
1)*  weights = 100 
170
> 
171
> ### weights for sampling without replacement for cforest
172
> ### spotted by Carolin Strobl <carolin.strol@stat.uni-muenchen.de>
173
> airq <- subset(airquality, !is.na(Ozone))
174
> cctrl <- cforest_control(replace = FALSE, fraction = 0.5)
175
> n <- nrow(airq)
176
> w <- double(n)
177
> 
178
> 
179
> if (FALSE) {
180
+ ### forest objects have weights remove in 0.9-13
181
+ 
182
+ ### case weights
183
+ x <- runif(w)
184
+ w[x > 0.5] <- 1
185
+ w[x > 0.9] <- 2
186
+ 
187
+ rf <- cforest(Ozone ~ .,data = airq, weights = w, control = cctrl)
188
+ rfw <- sapply(rf@ensemble, function(x) x[[2]])
189
+ stopifnot(all(colSums(rfw) == ceiling(sum(w) / 2)))
190
+ stopifnot(max(abs(rfw[w == 0,])) == 0)
191
+ 
192
+ ### real weights
193
+ w <- runif(n)
194
+ w[1:10] <- 0
195
+ rf <- cforest(Ozone ~ .,data = airq, weights = w, control = cctrl)
196
+ rfw <- sapply(rf@ensemble, function(x) x[[2]])
197
+ stopifnot(all(colSums(rfw) == ceiling(sum(w > 0) / 2)))
198
+ stopifnot(max(abs(rfw[w == 0,])) == 0)
199
+ }
200
> 
201
> ### cforest with multivariate response
202
> df <- data.frame(y1 = rnorm(100), y2 = rnorm(100), x1 = runif(100), x2 = runif(100))
203
> df$y1[df$x1 < 0.5] <- df$y1[df$x1 < 0.5] + 1
204
> cf <- cforest(y1 + y2 ~ x1 + x2, data = df)
205
There were 50 or more warnings (use warnings() to see the first 50)
206
> pr <- predict(cf)
207
> stopifnot(length(pr) == nrow(df) || lengthl(pr[[1]]) != 2)
208
> 
209
> ### varimp with ordered response
210
> ### spotted by Max Kuhn <Max.Kuhn@pfizer.com>
211
> data("mammoexp", package = "TH.data")
212
> test <- cforest(ME ~ ., data = mammoexp, control = cforest_unbiased(ntree = 50))
213
> stopifnot(sum(abs(varimp(test))) > 0)
214
> 
215
> ### missing values in factors lead to segfaults on 64 bit systems
216
> ### spotted by Carolin Strobl <carolin.strobl@lme.de>
217
> y <- rnorm(100)
218
> x <- gl(2, 50)
219
> z <- gl(2, 50)[sample(1:100)]
220
> y <- y + (x == "1") * 3
221
> xNA <- x
222
> xNA[1:2] <- NA
223
> ctree(y ~ xNA )
224
225
     Conditional inference tree with 2 terminal nodes
226
227
Response:  y 
228
Input:  xNA 
229
Number of observations:  100 
230
231
1) xNA == {1}; criterion = 1, statistic = 72.566
232
  2)*  weights = 48 
233
1) xNA == {2}
234
  3)*  weights = 52 
235
> 
236
> 
237
> y <- rnorm(100)
238
> x <- y + rnorm(100, sd = 0.1)
239
> 
240
> tmp <- data.frame(x, y)
241
> 
242
> x[sample(1:100)[1:10]] <- NA
243
> 
244
> ct1 <- ctree(y ~ x, data = tmp)
245
> ct2 <- ctree(y ~ x, data = tmp[complete.cases(tmp),])
246
> w <- as.double(complete.cases(tmp))
247
> ct3 <- ctree(y ~ x, data = tmp, weights = w)
248
> 
249
> xx <- data.frame(x = rnorm(100))
250
> t1 <- max(abs(predict(ct2, newdata = xx) - predict(ct3, newdata = xx))) == 0
251
> t2 <- nterminal(ct1@tree) == nterminal(ct2@tree)
252
> t3 <- nterminal(ct3@tree) == nterminal(ct1@tree)
253
> t4 <- all.equal(ct2@tree$psplit, ct1@tree$psplit)
254
> stopifnot(t1 && t2 && t3 && t4)
255
> 
256
> y <- rnorm(100)
257
> x <- cut(y, c(-Inf, -1, 0, 1, Inf))
258
> 
259
> tmp <- data.frame(x, y)
260
> 
261
> x[sample(1:100)[1:10]] <- NA
262
> 
263
> ct1 <- ctree(y ~ x, data = tmp)
264
> ct2 <- ctree(y ~ x, data = tmp[complete.cases(tmp),])
265
> w <- as.double(complete.cases(tmp))
266
> ct3 <- ctree(y ~ x, data = tmp, weights = w)
267
> 
268
> stopifnot(all.equal(ct2@tree$psplit, ct1@tree$psplit))
269
> stopifnot(all.equal(ct2@tree$psplit, ct3@tree$psplit))
270
> 
271
> ### predictions for obs with zero weights
272
> ### spotted by Mark Difford <mark_difford@yahoo.co.uk>
273
> airq <- subset(airquality, !is.na(Ozone))
274
> w <- rep(1, nrow(airq))
275
> w[1:5] <- 0
276
> 
277
> ctw <- ctree(Ozone ~ ., data = airq, weights = w)
278
> stopifnot(all.equal(predict(ctw)[1:5], predict(ctw, newdata = airq)[1:5]))
279
> rfw <- cforest(Ozone ~ ., data = airq, weights = w)
280
> stopifnot(all.equal(predict(rfw)[1:5], predict(rfw, newdata = airq)[1:5]))
281
> 
282
> ### more surrogate splits than available requested
283
> ### spotted by Henric Nilsson <henric.nilsson@sorch.se>
284
> airq <- data.frame(airq,
285
+                     x1 = factor(ifelse(runif(nrow(airq)) < 0.5, 0, 1)),
286
+                     x2 = factor(ifelse(runif(nrow(airq)) < 0.5, 0, 1)),
287
+                     x3 = factor(ifelse(runif(nrow(airq)) < 0.5, 0, 1)))
288
> 
289
> foo <- function(nm) 
290
+     ctree(Ozone ~ ., data = airq,
291
+           controls = ctree_control(maxsurrogate = nm))
292
> foo(4)
293
294
     Conditional inference tree with 6 terminal nodes
295
296
Response:  Ozone 
297
Inputs:  Solar.R, Wind, Temp, Month, Day, x1, x2, x3 
298
Number of observations:  116 
299
300
1) Temp <= 82; criterion = 1, statistic = 56.086
301
  2) Wind <= 6.9; criterion = 0.997, statistic = 12.969
302
    3)*  weights = 10 
303
  2) Wind > 6.9
304
    4) Temp <= 77; criterion = 0.995, statistic = 11.599
305
      5)*  weights = 48 
306
    4) Temp > 77
307
      6)*  weights = 21 
308
1) Temp > 82
309
  7) Wind <= 10.3; criterion = 0.995, statistic = 11.712
310
    8) x1 == {1}; criterion = 0.961, statistic = 7.877
311
      9)*  weights = 15 
312
    8) x1 == {0}
313
      10)*  weights = 15 
314
  7) Wind > 10.3
315
    11)*  weights = 7 
316
> try(foo(5))
317
Error in model@fit(data, ...) : 
318
  cannot set up 5 surrogate splits with only 4 ordered input variable(s)
319
> try(foo(6))
320
Error in model@fit(data, ...) : 
321
  cannot set up 6 surrogate splits with only 4 ordered input variable(s)
322
> 
323
> ### variance = 0 due to constant variables
324
> ### spotted by Sebastian Wietzke <Sebastian.Wietzke@axa.de>
325
> v <- rep(0,20)
326
> w <- rep(0,20)
327
> x <- 1:20
328
> y <- rep(1,20)
329
> z <- c(4,5,8,2,6,1,3,6,8,2,5,8,9,3,5,8,9,4,6,8)
330
> tmp <- ctree(z ~ v+w+x+y,controls = ctree_control(mincriterion = 0.80,
331
+              minsplit = 2, minbucket = 1, testtype = "Univariate", teststat = "quad"))
332
> stopifnot(all(tmp@tree$criterion$criterion[c(1,2,4)] == 0))
333
> 
334
> ### optimal split in last observation lead to selection of suboptimal split
335
> data("GlaucomaM", package = "TH.data")
336
> tmp <- subset(GlaucomaM, vari <= 0.059)
337
> weights <- rep(1.0, nrow(tmp))
338
> stopifnot(all.equal(Split(tmp$vasg, tmp$Class, weights, 
339
+                     ctree_control()@splitctrl)[[1]], 0.066))
340
> 
341
> ### model.matrix.survReg was missing from modeltools
342
> data("GBSG2", package = "TH.data")
343
> nloglik <- function(x) -logLik(x)
344
> GBSG2$time <- GBSG2$time/365
345
> mobGBSG2 <- mob(Surv(time, cens) ~ horTh + pnodes | progrec + menostat +
346
+   estrec + menostat + age + tsize + tgrade, data = GBSG2, model = survReg,
347
+   control = mob_control(objfun = nloglik, minsplit = 40))
348
> plot(mobGBSG2, terminal = node_scatterplot, tp_args = list(yscale = c(-0.1, 11)))
349
> 
350
> ### factors were evaluated for surrogate splits
351
> data("Ozone", package = "mlbench")
352
> Ozone$V2 <- ordered(Ozone$V2)
353
> Ozone <- subset(Ozone, !is.na(V4))
354
> rf <- cforest(V4 ~ ., data = Ozone, control = cforest_unbiased(maxsurrogate = 7))
355
> 
356
> ### scores for response
357
> ### spotted and fixed by Silke Janitza <janitza@ibe.med.uni-muenchen.de>
358
> tmp <- data.frame(y = gl(3, 10, ordered = TRUE), x = gl(3, 10, ordered = TRUE))
359
> ct <- ctree(y ~ x, data = tmp, scores = list(y = c(0, 10, 11), x = c(1, 2, 5)))
360
> stopifnot(isTRUE(all.equal(ct@responses@scores, list(y = c(0, 10, 11)))))
361
> 
362
> ### deal with empty levels for teststat = "quad" by
363
> ### removing elements of the teststatistic with zero variance  
364
> ### reported by Wei-Yin Loh <loh@stat.wisc.edu>
365
> tdata <-
366
+ structure(list(ytrain = structure(c(3L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1L, 1L, 4L, 2L, 4L, 1L, 1L, 
397
+ 1L, 1L, 1L, 1L, 1L, 4L, 2L, 3L, 3L, 1L, 1L, 4L, 1L, 1L, 2L, 1L, 
398
+ 1L, 4L, 4L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 4L, 4L, 4L, 1L, 4L, 1L, 
399
+ 1L, 1L, 1L, 2L, 1L, 1L, 2L, 4L, 1L, 1L, 4L, 1L, 1L, 4L, 3L, 4L, 
400
+ 4L, 1L, 2L, 1L, 4L, 1L, 3L, 1L, 2L, 2L, 2L), area = c(648L, 29L, 
401
+ 2388L, 0L, 0L, 1247L, 0L, 2777L, 2777L, 7690L, 84L, 19L, 1L, 
402
+ 143L, 0L, 31L, 23L, 113L, 0L, 47L, 600L, 8512L, 0L, 6L, 111L, 
403
+ 274L, 678L, 28L, 474L, 9976L, 4L, 0L, 623L, 757L, 9561L, 1139L, 
404
+ 2L, 342L, 0L, 51L, 115L, 9L, 128L, 43L, 22L, 0L, 49L, 284L, 1001L, 
405
+ 21L, 28L, 1222L, 1L, 12L, 18L, 337L, 547L, 91L, 268L, 10L, 108L, 
406
+ 249L, 0L, 132L, 0L, 0L, 109L, 246L, 36L, 215L, 28L, 112L, 1L, 
407
+ 93L, 103L, 1904L, 1648L, 435L, 70L, 21L, 301L, 323L, 11L, 372L, 
408
+ 98L, 181L, 583L, 0L, 236L, 10L, 30L, 111L, 0L, 3L, 587L, 118L, 
409
+ 333L, 0L, 0L, 0L, 1031L, 1973L, 1L, 1566L, 0L, 447L, 783L, 0L, 
410
+ 140L, 41L, 0L, 268L, 128L, 1267L, 925L, 121L, 195L, 324L, 212L, 
411
+ 804L, 76L, 463L, 407L, 1285L, 300L, 313L, 9L, 11L, 237L, 26L, 
412
+ 0L, 2150L, 196L, 72L, 1L, 30L, 637L, 1221L, 99L, 288L, 66L, 0L, 
413
+ 0L, 0L, 2506L, 63L, 450L, 41L, 185L, 36L, 945L, 514L, 57L, 1L, 
414
+ 5L, 164L, 781L, 0L, 84L, 236L, 245L, 178L, 0L, 9363L, 22402L, 
415
+ 15L, 0L, 912L, 333L, 3L, 256L, 905L, 753L, 391L), population = c(16L, 
416
+ 3L, 20L, 0L, 0L, 7L, 0L, 28L, 28L, 15L, 8L, 0L, 0L, 90L, 0L, 
417
+ 10L, 0L, 3L, 0L, 1L, 1L, 119L, 0L, 0L, 9L, 7L, 35L, 4L, 8L, 24L, 
418
+ 0L, 0L, 2L, 11L, 1008L, 28L, 0L, 2L, 0L, 2L, 10L, 1L, 15L, 5L, 
419
+ 0L, 0L, 6L, 8L, 47L, 5L, 0L, 31L, 0L, 0L, 1L, 5L, 54L, 0L, 1L, 
420
+ 1L, 17L, 61L, 0L, 10L, 0L, 0L, 8L, 6L, 1L, 1L, 6L, 4L, 5L, 11L, 
421
+ 0L, 157L, 39L, 14L, 3L, 4L, 57L, 7L, 2L, 118L, 2L, 6L, 17L, 0L, 
422
+ 3L, 3L, 1L, 1L, 0L, 0L, 9L, 6L, 13L, 0L, 0L, 0L, 2L, 77L, 0L, 
423
+ 2L, 0L, 20L, 12L, 0L, 16L, 14L, 0L, 2L, 3L, 5L, 56L, 18L, 9L, 
424
+ 4L, 1L, 84L, 2L, 3L, 3L, 14L, 48L, 36L, 3L, 0L, 22L, 5L, 0L, 
425
+ 9L, 6L, 3L, 3L, 0L, 5L, 29L, 39L, 2L, 15L, 0L, 0L, 0L, 20L, 0L, 
426
+ 8L, 6L, 10L, 18L, 18L, 49L, 2L, 0L, 1L, 7L, 45L, 0L, 1L, 13L, 
427
+ 56L, 3L, 0L, 231L, 274L, 0L, 0L, 15L, 60L, 0L, 22L, 28L, 6L, 
428
+ 8L), language = structure(c(10L, 6L, 8L, 1L, 6L, 10L, 1L, 2L, 
429
+ 2L, 1L, 4L, 1L, 8L, 6L, 1L, 6L, 1L, 3L, 1L, 10L, 10L, 6L, 1L, 
430
+ 10L, 5L, 3L, 10L, 10L, 3L, 1L, 6L, 1L, 10L, 2L, 7L, 2L, 3L, 10L, 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0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
551
+ 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 0L), mainhue = structure(c(5L, 
552
+ 7L, 5L, 2L, 4L, 7L, 8L, 2L, 2L, 2L, 7L, 2L, 7L, 5L, 2L, 4L, 2L, 
553
+ 5L, 7L, 6L, 2L, 5L, 2L, 4L, 7L, 7L, 7L, 7L, 4L, 7L, 4L, 2L, 4L, 
554
+ 7L, 7L, 4L, 5L, 7L, 2L, 2L, 2L, 8L, 8L, 7L, 2L, 5L, 2L, 4L, 1L, 
555
+ 2L, 5L, 5L, 8L, 2L, 2L, 8L, 8L, 8L, 5L, 7L, 4L, 1L, 8L, 2L, 4L, 
556
+ 2L, 2L, 4L, 4L, 5L, 1L, 2L, 2L, 7L, 2L, 7L, 7L, 7L, 8L, 8L, 8L, 
557
+ 8L, 5L, 8L, 1L, 7L, 7L, 7L, 7L, 7L, 2L, 7L, 7L, 7L, 7L, 7L, 7L, 
558
+ 7L, 7L, 2L, 5L, 5L, 2L, 7L, 2L, 7L, 4L, 2L, 3L, 7L, 8L, 2L, 2L, 
559
+ 6L, 5L, 2L, 7L, 7L, 7L, 5L, 7L, 1L, 7L, 7L, 2L, 8L, 7L, 3L, 7L, 
560
+ 7L, 5L, 5L, 5L, 5L, 8L, 5L, 2L, 6L, 8L, 7L, 4L, 5L, 2L, 5L, 7L, 
561
+ 7L, 2L, 7L, 7L, 7L, 5L, 7L, 5L, 7L, 7L, 7L, 7L, 2L, 5L, 4L, 7L, 
562
+ 8L, 8L, 8L, 7L, 7L, 4L, 7L, 7L, 7L, 7L, 5L, 5L, 5L), .Label = c("black", 
563
+ "blue", "brown", "gold", "green", "orange", "red", "white"), class = "factor"), 
564
+     circles = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
565
+     0L, 1L, 0L, 0L, 1L, 0L, 1L, 4L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 
566
+     1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
567
+     0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
568
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
569
+     1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 
570
+     0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
571
+     0L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 
572
+     0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
573
+     0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
574
+     0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 
575
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L), crosses = c(0L, 
576
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
577
+     0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
578
+     1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 
579
+     1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 2L, 1L, 0L, 0L, 0L, 0L, 0L, 
580
+     0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 
581
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
582
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 2L, 0L, 
583
+     0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
584
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
585
+     0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 
586
+     0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 
587
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), saltires = c(0L, 0L, 0L, 
588
+     0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
589
+     1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 
590
+     0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
591
+     0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
592
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 
593
+     0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
594
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
595
+     0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
596
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 
597
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
598
+     0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
599
+     0L, 0L, 0L, 0L, 0L, 0L), quarters = c(0L, 0L, 0L, 0L, 0L, 
600
+     0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 
601
+     0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 
602
+     0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
603
+     0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 
604
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
605
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
606
+     0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 
607
+     0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 4L, 0L, 0L, 0L, 0L, 
608
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
609
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 
610
+     0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 
611
+     0L, 0L, 0L, 0L), sunstars = c(1L, 1L, 1L, 0L, 0L, 1L, 0L, 
612
+     0L, 1L, 6L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 22L, 
613
+     0L, 0L, 1L, 1L, 14L, 3L, 1L, 0L, 1L, 4L, 1L, 1L, 5L, 0L, 
614
+     4L, 1L, 15L, 0L, 1L, 0L, 0L, 0L, 1L, 10L, 0L, 0L, 0L, 0L, 
615
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 7L, 
616
+     0L, 0L, 0L, 1L, 0L, 0L, 5L, 0L, 0L, 0L, 0L, 0L, 3L, 0L, 1L, 
617
+     0L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
618
+     1L, 1L, 0L, 0L, 1L, 1L, 0L, 4L, 1L, 0L, 1L, 1L, 1L, 2L, 0L, 
619
+     6L, 4L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 2L, 5L, 1L, 0L, 4L, 
620
+     0L, 1L, 0L, 2L, 0L, 2L, 0L, 1L, 0L, 5L, 5L, 1L, 0L, 0L, 1L, 
621
+     0L, 2L, 0L, 0L, 0L, 1L, 0L, 0L, 2L, 1L, 0L, 0L, 1L, 0L, 0L, 
622
+     1L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 50L, 1L, 0L, 0L, 7L, 1L, 
623
+     5L, 1L, 0L, 0L, 1L), crescent = c(0L, 0L, 1L, 0L, 0L, 0L, 
624
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
625
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
626
+     1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
627
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
628
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
629
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
630
+     1L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 
631
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
632
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
633
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 
634
+     1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
635
+     0L, 0L, 0L), triangle = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 
636
+     0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
637
+     1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
638
+     0L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 
639
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
640
+     0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 
641
+     0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
642
+     0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
643
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 
644
+     0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 
645
+     0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
646
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
647
+     1L), icon = c(1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 
648
+     0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 
649
+     1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
650
+     1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 
651
+     0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 
652
+     0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 
653
+     1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 
654
+     0L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
655
+     0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 
656
+     1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 
657
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
658
+     0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, 1L), animate = c(0L, 
659
+     1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
660
+     1L, 0L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 1L, 1L, 
661
+     1L, 0L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     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
678
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 
679
+     0L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
680
+     0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
681
+     0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
682
+     0L, 0L, 0L, 0L, 0L), topleft = structure(c(1L, 6L, 4L, 2L, 
683
+     2L, 6L, 7L, 2L, 2L, 7L, 6L, 2L, 7L, 4L, 2L, 1L, 6L, 4L, 7L, 
684
+     5L, 2L, 4L, 7L, 7L, 7L, 6L, 2L, 7L, 4L, 6L, 6L, 7L, 2L, 2L, 
685
+     6L, 3L, 4L, 6L, 7L, 2L, 2L, 7L, 7L, 6L, 7L, 4L, 2L, 3L, 6L, 
686
+     2L, 4L, 4L, 7L, 7L, 7L, 7L, 2L, 2L, 4L, 6L, 1L, 1L, 7L, 2L, 
687
+     6L, 6L, 2L, 6L, 6L, 1L, 1L, 2L, 7L, 6L, 2L, 6L, 4L, 6L, 4L, 
688
+     2L, 4L, 6L, 3L, 7L, 1L, 6L, 1L, 6L, 6L, 6L, 4L, 2L, 2L, 6L, 
689
+     7L, 1L, 2L, 6L, 7L, 2L, 4L, 4L, 2L, 6L, 7L, 6L, 4L, 2L, 2L, 
690
+     6L, 7L, 7L, 2L, 5L, 4L, 2L, 6L, 6L, 6L, 7L, 7L, 6L, 6L, 6L, 
691
+     2L, 7L, 6L, 7L, 2L, 6L, 4L, 4L, 4L, 4L, 6L, 2L, 2L, 5L, 7L, 
692
+     6L, 3L, 4L, 2L, 2L, 6L, 4L, 2L, 6L, 6L, 2L, 4L, 6L, 6L, 7L, 
693
+     7L, 6L, 6L, 7L, 6L, 1L, 7L, 7L, 7L, 2L, 6L, 1L, 3L, 3L, 6L, 
694
+     2L, 2L, 4L, 4L, 4L), .Label = c("black", "blue", "gold", 
695
+     "green", "orange", "red", "white"), class = "factor"), botright = structure(c(5L, 
696
+     7L, 8L, 7L, 7L, 1L, 2L, 2L, 2L, 2L, 7L, 2L, 7L, 5L, 2L, 7L, 
697
+     7L, 5L, 7L, 7L, 2L, 5L, 2L, 4L, 7L, 5L, 7L, 8L, 4L, 7L, 5L, 
698
+     2L, 4L, 7L, 7L, 7L, 5L, 7L, 2L, 2L, 2L, 8L, 7L, 7L, 5L, 5L, 
699
+     2L, 7L, 1L, 2L, 7L, 7L, 8L, 2L, 2L, 8L, 7L, 7L, 2L, 5L, 4L, 
700
+     4L, 7L, 2L, 7L, 7L, 2L, 5L, 5L, 5L, 7L, 2L, 2L, 5L, 2L, 8L, 
701
+     7L, 1L, 6L, 2L, 7L, 5L, 4L, 8L, 5L, 7L, 5L, 2L, 7L, 7L, 2L, 
702
+     7L, 7L, 2L, 5L, 5L, 8L, 7L, 7L, 2L, 5L, 7L, 2L, 7L, 2L, 7L, 
703
+     4L, 2L, 2L, 2L, 8L, 2L, 2L, 5L, 5L, 2L, 1L, 7L, 5L, 5L, 8L, 
704
+     1L, 2L, 7L, 7L, 7L, 7L, 3L, 7L, 5L, 5L, 5L, 7L, 2L, 8L, 5L, 
705
+     2L, 2L, 8L, 1L, 4L, 7L, 2L, 5L, 1L, 5L, 2L, 7L, 1L, 7L, 2L, 
706
+     7L, 5L, 7L, 8L, 7L, 7L, 2L, 1L, 7L, 7L, 8L, 8L, 7L, 7L, 5L, 
707
+     8L, 7L, 7L, 7L, 7L, 5L, 3L, 5L), .Label = c("black", "blue", 
708
+     "brown", "gold", "green", "orange", "red", "white"), class = "factor")), .Names = c("ytrain", 
709
+ "landmass", "zone", "area", "population", "language", "bars", 
710
+ "stripes", "colours", "red", "green", "blue", "gold", "white", 
711
+ "black", "orange", "mainhue", "circles", "crosses", "saltires", 
712
+ "quarters", "sunstars", "crescent", "triangle", "icon", "animate", 
713
+ "text", "topleft", "botright"), row.names = c(NA, -174L), class = "data.frame")
714
> tdata$language <-  factor(tdata$language)
715
> tdata$ytrain <- factor(tdata$ytrain)
716
> 
717
> library("coin")
718
> 
719
> m <- ctree(ytrain ~ language, data = subset(tdata, language != "8"), 
720
+     control = ctree_control(testtype = "Univariate", maxdepth = 1L))
721
> it <- independence_test(ytrain ~ language, data = subset(tdata, language != "8"), 
722
+                         teststat = "quad")
723
> stopifnot(isTRUE(all.equal(m@tree$criterion$statistic, 
724
+                            statistic(it), check.attributes = FALSE)))
725
> 
726
> ### easier example
727
> levels(tdata$language) <- c(1, 1, 1, 1, 1, 1, 2, 8, 1, 1)
728
> levels(tdata$ytrain) <- c(1, 1, 2, 2, 3, 3, 4, 4, 5, 6)
729
> m <- ctree(ytrain ~ language, data = subset(tdata, language != "8"),
730
+     control = ctree_control(testtype = "Univariate", maxdepth = 1L))
731
> it <- independence_test(ytrain ~ language, data = subset(tdata, language != "8"), 
732
+                         teststat = "quad")
733
> stopifnot(isTRUE(all.equal(m@tree$criterion$statistic, 
734
+                            statistic(it), check.attributes = FALSE)))
735
> 
736
> ## the whole exercise manually
737
> Y <- model.matrix(~ language - 1, data = subset(tdata, language != "8"))
738
> X <- model.matrix(~ ytrain -1, data = subset(tdata, language != "8"))
739
> w <- rep(1, nrow(X))
740
> 
741
> lin <- coin:::LinearStatistic(Y, X, weights = w)
742
> expcov <- coin:::ExpectCovarLinearStatistic(Y, X, weights = w)
743
> 
744
> tmp <- new("LinStatExpectCovar", ncol(Y), ncol(X))
745
> tmp@linearstatistic <- lin
746
> tmp@expectation <- expcov@expectation
747
> tmp@covariance <- expcov@covariance
748
> 
749
> a <- .Call("R_linexpcovReduce", tmp)
750
> 
751
> u <- matrix(tmp@linearstatistic - tmp@expectation, nc = 1)
752
> d <- tmp@dimension
753
> u <- matrix(tmp@linearstatistic - tmp@expectation, nc = 1)[1:d,,drop = FALSE]
754
> S <- coin:::MPinv(matrix(as.vector(tmp@covariance[1:d^2]), ncol = d))
755
> 
756
> stat <- t(u) %*% S$MPinv %*% u
757
> stopifnot(isTRUE(all.equal(stat[1,1], statistic(it), 
758
+                            check.attributes = FALSE)))
759
> 
760
> x <- matrix(as.vector(tmp@covariance[1:d^2]), ncol = d)
761
> s <- svd(x)
762
> 
763
> m <- new("svd_mem", 18L)
764
> m@p <- as.integer(d)
765
> 
766
> s2 <- .Call("R_svd", x, m)
767
> 
768
> stopifnot(max(abs(s$d - m@s[1:d])) < sqrt(.Machine$double.eps))
769
> stopifnot(max(abs(s$v - t(matrix(m@v[1:d^2], nrow = d)))) < sqrt(.Machine$double.eps))
770
> stopifnot(max(abs(s$u - matrix(m@u[1:d^2], nrow = d))) < sqrt(.Machine$double.eps))
771
> 
772
> s2 <- .Call("R_svd", tmp@covariance, m)
773
> 
774
> stopifnot(max(abs(s$d - m@s[1:d])) < sqrt(.Machine$double.eps))
775
> stopifnot(max(abs(s$v - t(matrix(m@v[1:d^2], nrow = d)))) < sqrt(.Machine$double.eps))
776
> stopifnot(max(abs(s$u - matrix(m@u[1:d^2], nrow = d))) < sqrt(.Machine$double.eps))
777
> 
778
> a <- .Call("R_MPinv", tmp@covariance, sqrt(.Machine$double.eps), m)
779
> 
780
> stat <- t(u) %*% matrix(a@MPinv[1:d^2], ncol = d) %*% u  
781
> stopifnot(isTRUE(all.equal(stat[1,1], statistic(it), 
782
+                            check.attributes = FALSE)))
783
> 
784
> proc.time()
785
   user  system elapsed 
786
  8.260   0.284   8.560