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= "factor"), Age = c(65L, 70L, 64L, 59L, 76L, 59L, 72L,
40L, 52L, 47L, 57L, 47L, 70L, 49L, 59L, 64L, 45L, 66L, 49L, 54L,
47L, 31L, 53L, 61L, 40L, 67L, 54L, 41L, 66L, 68L, 41L, 77L, 41L,
56L, 46L, 46L, 47L, 35L, 58L, 62L, 73L, 52L, 53L, 69L, 55L, 52L,
51L, 56L, 65L, 35L, 43L, 61L, 43L, 64L, 57L, 60L, 44L, 41L, 51L,
57L, 42L, 48L, 57L, 39L, 67L, 39L, 69L, 54L, 67L, 58L, 72L, 65L,
68L, 75L, 26L, 36L, 72L, 54L, 64L, 39L, 54L, 48L, 83L, 74L, 41L,
65L, 79L, 63L, 63L, 34L, 42L, 57L, 68L, 51L, 51L, 61L, 42L, 73L,
57L, 59L, 57L, 68L, 55L, 46L, 79L, 43L, 50L, 39L, 57L, 65L, 70L,
64L, 59L, 76L, 59L, 72L, 40L, 52L, 47L, 57L, 47L, 70L, 49L, 59L,
64L, 45L, 66L, 49L, 54L, 47L, 31L, 53L, 61L, 40L, 67L, 54L, 41L,
66L, 68L, 41L, 77L, 41L, 56L, 46L, 46L, 47L, 35L, 58L, 62L, 73L,
52L, 53L, 69L, 55L, 52L, 51L, 56L, 65L, 35L, 43L, 61L, 43L, 64L,
57L, 60L, 44L, 41L, 51L, 57L, 42L, 48L, 57L, 39L, 67L, 39L, 69L,
54L, 67L, 58L, 72L, 65L, 68L, 75L, 26L, 36L, 72L, 54L, 64L, 39L,
54L, 48L, 83L, 74L, 41L, 65L, 79L, 63L, 63L, 34L, 42L, 57L, 68L,
51L, 51L, 61L, 42L, 73L, 57L, 59L, 57L, 68L, 55L, 46L, 79L, 43L,
50L, 39L, 57L, 65L, 70L, 64L, 59L, 76L, 59L, 72L, 40L, 52L, 47L,
57L, 47L, 70L, 49L, 59L, 64L, 45L, 66L, 49L, 54L, 47L, 31L, 53L,
61L, 40L, 67L, 54L, 41L, 66L, 68L, 41L, 77L, 41L, 56L, 46L, 46L,
47L, 35L, 58L, 62L, 73L, 52L, 53L, 69L, 55L, 52L, 51L, 56L, 65L,
35L, 43L, 61L, 43L, 64L, 57L, 60L, 44L, 41L, 51L, 57L, 42L, 48L,
57L, 39L, 67L, 39L, 69L, 54L, 67L, 58L, 72L, 65L, 68L, 75L, 26L,
36L, 72L, 54L, 64L, 39L, 54L, 48L, 83L, 74L, 41L, 65L, 79L, 63L,
63L, 34L, 42L, 57L, 68L, 51L, 51L, 61L, 42L, 73L, 57L, 59L, 57L,
68L, 55L, 46L, 79L, 43L, 50L, 39L, 57L, 65L, 70L, 64L, 59L, 76L,
59L, 72L, 40L, 52L, 47L, 57L, 47L, 70L, 49L, 59L, 64L, 45L, 66L,
49L, 54L, 47L, 31L, 53L, 61L, 40L, 67L, 54L, 41L, 66L, 68L, 41L,
77L, 41L, 56L, 46L, 46L, 47L, 35L, 58L, 62L, 73L, 52L, 53L, 69L,
55L, 52L, 51L, 56L, 65L, 35L, 43L, 61L, 43L, 64L, 57L, 60L, 44L,
41L, 51L, 57L, 42L, 48L, 57L, 39L, 67L, 39L, 69L, 54L, 67L, 58L,
72L, 65L, 68L, 75L, 26L, 36L, 72L, 54L, 64L, 39L, 54L, 48L, 83L,
74L, 41L, 65L, 79L, 63L, 63L, 34L, 42L, 57L, 68L, 51L, 51L, 61L,
42L, 73L, 57L, 59L, 57L, 68L, 55L, 46L, 79L, 43L, 50L, 39L, 57L,
65L, 70L, 64L, 59L, 76L, 59L, 72L, 40L, 52L, 47L, 57L, 47L, 70L,
49L, 59L, 64L, 45L, 66L, 49L, 54L, 47L, 31L, 53L, 61L, 40L, 67L,
54L, 41L, 66L, 68L, 41L, 77L, 41L, 56L, 46L, 46L, 47L, 35L, 58L,
62L, 73L, 52L, 53L, 69L, 55L, 52L, 51L, 56L, 65L, 35L, 43L, 61L,
43L, 64L, 57L, 60L, 44L, 41L, 51L, 57L, 42L, 48L, 57L, 39L, 67L,
39L, 69L, 54L, 67L, 58L, 72L, 65L, 68L, 75L, 26L, 36L, 72L, 54L,
64L, 39L, 54L, 48L, 83L, 74L, 41L, 65L, 79L, 63L, 63L, 34L, 42L,
57L, 68L, 51L, 51L, 61L, 42L, 73L, 57L, 59L, 57L, 68L, 55L, 46L,
79L, 43L, 50L, 39L, 57L), W0 = c(32L, 60L, 44L, 53L, 53L, 49L,
42L, 34L, 41L, 27L, 48L, 34L, 49L, 46L, 56L, 59L, 62L, 50L, 42L,
53L, 67L, 44L, 65L, 56L, 30L, 47L, 50L, 34L, 39L, 43L, 46L, 52L,
38L, 33L, 28L, 34L, 39L, 29L, 52L, 52L, 54L, 52L, 47L, 44L, 42L,
42L, 44L, 60L, 60L, 50L, 38L, 44L, 54L, 54L, 56L, 51L, 53L, 36L,
59L, 49L, 50L, 46L, 55L, 46L, 34L, 57L, 41L, 49L, 42L, 31L, 50L,
35L, 38L, 53L, 42L, 53L, 46L, 50L, 43L, 46L, 41L, 33L, 36L, 33L,
37L, 24L, 42L, 30L, 42L, 49L, 58L, 26L, 37L, 40L, 33L, 41L, 46L,
40L, 40L, 61L, 35L, 58L, 49L, 52L, 45L, 67L, 57L, 63L, 53L, 32L,
60L, 44L, 53L, 53L, 49L, 42L, 34L, 41L, 27L, 48L, 34L, 49L, 46L,
56L, 59L, 62L, 50L, 42L, 53L, 67L, 44L, 65L, 56L, 30L, 47L, 50L,
34L, 39L, 43L, 46L, 52L, 38L, 33L, 28L, 34L, 39L, 29L, 52L, 52L,
54L, 52L, 47L, 44L, 42L, 42L, 44L, 60L, 60L, 50L, 38L, 44L, 54L,
54L, 56L, 51L, 53L, 36L, 59L, 49L, 50L, 46L, 55L, 46L, 34L, 57L,
41L, 49L, 42L, 31L, 50L, 35L, 38L, 53L, 42L, 53L, 46L, 50L, 43L,
46L, 41L, 33L, 36L, 33L, 37L, 24L, 42L, 30L, 42L, 49L, 58L, 26L,
37L, 40L, 33L, 41L, 46L, 40L, 40L, 61L, 35L, 58L, 49L, 52L, 45L,
67L, 57L, 63L, 53L, 32L, 60L, 44L, 53L, 53L, 49L, 42L, 34L, 41L,
27L, 48L, 34L, 49L, 46L, 56L, 59L, 62L, 50L, 42L, 53L, 67L, 44L,
65L, 56L, 30L, 47L, 50L, 34L, 39L, 43L, 46L, 52L, 38L, 33L, 28L,
34L, 39L, 29L, 52L, 52L, 54L, 52L, 47L, 44L, 42L, 42L, 44L, 60L,
60L, 50L, 38L, 44L, 54L, 54L, 56L, 51L, 53L, 36L, 59L, 49L, 50L,
46L, 55L, 46L, 34L, 57L, 41L, 49L, 42L, 31L, 50L, 35L, 38L, 53L,
42L, 53L, 46L, 50L, 43L, 46L, 41L, 33L, 36L, 33L, 37L, 24L, 42L,
30L, 42L, 49L, 58L, 26L, 37L, 40L, 33L, 41L, 46L, 40L, 40L, 61L,
35L, 58L, 49L, 52L, 45L, 67L, 57L, 63L, 53L, 32L, 60L, 44L, 53L,
53L, 49L, 42L, 34L, 41L, 27L, 48L, 34L, 49L, 46L, 56L, 59L, 62L,
50L, 42L, 53L, 67L, 44L, 65L, 56L, 30L, 47L, 50L, 34L, 39L, 43L,
46L, 52L, 38L, 33L, 28L, 34L, 39L, 29L, 52L, 52L, 54L, 52L, 47L,
44L, 42L, 42L, 44L, 60L, 60L, 50L, 38L, 44L, 54L, 54L, 56L, 51L,
53L, 36L, 59L, 49L, 50L, 46L, 55L, 46L, 34L, 57L, 41L, 49L, 42L,
31L, 50L, 35L, 38L, 53L, 42L, 53L, 46L, 50L, 43L, 46L, 41L, 33L,
36L, 33L, 37L, 24L, 42L, 30L, 42L, 49L, 58L, 26L, 37L, 40L, 33L,
41L, 46L, 40L, 40L, 61L, 35L, 58L, 49L, 52L, 45L, 67L, 57L, 63L,
53L, 32L, 60L, 44L, 53L, 53L, 49L, 42L, 34L, 41L, 27L, 48L, 34L,
49L, 46L, 56L, 59L, 62L, 50L, 42L, 53L, 67L, 44L, 65L, 56L, 30L,
47L, 50L, 34L, 39L, 43L, 46L, 52L, 38L, 33L, 28L, 34L, 39L, 29L,
52L, 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 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L), Total = c(30L, 26L, 20L, 61L, 35L, 34L, 32L, 33L, 32L,
10L, 41L, 19L, 47L, 35L, 44L, 48L, 60L, 53L, 42L, 56L, 64L, 40L,
58L, 54L, 33L, NA, 43L, 29L, 41L, 31L, 26L, 44L, 19L, 38L, 16L,
23L, 37L, 42L, 55L, 30L, 52L, 44L, 45L, 34L, 39L, 14L, 34L, 57L,
53L, 50L, 27L, NA, 53L, 32L, 55L, 50L, 56L, 29L, 53L, 50L, 38L,
48L, 34L, 44L, 31L, 48L, 40L, 25L, 30L, 18L, 27L, 24L, 25L, 40L,
48L, 45L, 47L, 42L, 24L, 39L, 30L, 27L, 15L, 32L, NA, 29L, 23L,
22L, 46L, 25L, 46L, 26L, NA, 24L, 10L, 50L, NA, 28L, 16L, 52L,
21L, 38L, 45L, 46L, 46L, 63L, NA, 51L, 38L, 24L, 27L, 23L, 64L,
48L, 43L, 32L, 21L, 34L, 31L, 32L, 21L, 44L, 45L, 48L, 56L, 60L,
52L, 43L, 52L, 65L, 32L, 55L, 52L, 25L, 54L, 51L, 27L, 33L, 29L,
29L, 47L, 20L, 40L, 11L, 16L, 39L, 35L, 51L, 43L, 52L, 33L, 41L,
29L, 38L, 9L, 32L, 53L, 55L, NA, 16L, 46L, 51L, 40L, 44L, 50L,
47L, 24L, 45L, 48L, 42L, 46L, 26L, 47L, 25L, 50L, 42L, 30L, 40L,
23L, 43L, 34L, 21L, 38L, 26L, 52L, 45L, 52L, 17L, 25L, 44L, 25L,
16L, 31L, NA, 18L, 30L, 21L, 41L, 30L, 46L, 27L, 23L, 25L, 13L,
22L, 41L, 29L, 18L, 61L, 29L, 50L, 36L, 36L, 33L, 71L, 36L, 46L,
NA, 37L, 41L, 26L, 62L, 49L, 48L, 43L, 27L, 35L, 32L, 35L, 24L,
48L, 49L, 54L, 55L, 64L, 57L, 33L, 54L, 64L, 36L, NA, 48L, 29L,
43L, 46L, 21L, 39L, 28L, 33L, 50L, 27L, 48L, 7L, 15L, 39L, 24L,
52L, 45L, 54L, 54L, 45L, 28L, 47L, 9L, 35L, 52L, 62L, 46L, 19L,
26L, 56L, 52L, 50L, 56L, 53L, 32L, 44L, 56L, 43L, 57L, 40L, 50L,
NA, 50L, 38L, 41L, 43L, 26L, 32L, 28L, 33L, 44L, 37L, 51L, 45L,
60L, 37L, 15L, 46L, 30L, 17L, 27L, NA, 20L, 36L, 25L, 43L, 49L,
50L, 22L, 18L, 37L, 16L, 28L, 41L, 30L, 25L, 68L, 30L, 53L, NA,
NA, 44L, 66L, 23L, 50L, 33L, 39L, 65L, 35L, NA, 41L, 48L, 42L,
32L, 37L, 6L, 57L, 28L, 44L, 53L, 49L, 57L, 67L, 61L, 37L, 55L,
62L, 42L, 56L, 52L, 32L, 46L, 49L, 22L, 37L, 33L, 45L, 50L, 29L,
49L, 13L, 17L, 45L, 29L, 54L, 47L, 51L, 46L, 43L, 35L, 39L, 16L,
54L, 53L, 67L, 50L, 23L, 30L, 39L, 42L, 53L, 59L, 51L, 45L, 50L,
49L, 42L, 57L, 49L, 46L, NA, 50L, 50L, 41L, 36L, 33L, 40L, 34L,
42L, 47L, 37L, 52L, 50L, 54L, 36L, 21L, 46L, 28L, 22L, 49L, NA,
25L, 41L, 26L, 49L, 55L, 56L, 38L, 34L, NA, 32L, 34L, 58L, 37L,
33L, 59L, 35L, 47L, 40L, 45L, 46L, 68L, NA, 50L, 36L, 36L, 67L,
35L, NA, 51L, 51L, 46L, 38L, 36L, 14L, 51L, 28L, 44L, 56L, 60L,
58L, 66L, 54L, 43L, 51L, 64L, 43L, 60L, 53L, 32L, 50L, 53L, 22L,
37L, 38L, 56L, 49L, 32L, 44L, 21L, 29L, 43L, 42L, 57L, 46L, 57L,
47L, 41L, 41L, 39L, 33L, 53L, 58L, NA, 57L, 26L, 34L, 9L, 47L,
52L, 53L, 51L, 36L, 48L, 57L, 46L, 49L, 47L, 51L, NA, 49L, 56L,
31L, 45L, 41L, 47L, 28L, 53L, 53L, 43L, 53L, 52L, 59L, 38L, 25L,
44L, 30L, 41L, 60L, NA, 41L, 43L, 33L, 54L, 58L, 60L, 35L, 36L,
38L, 16L, 36L, 53L, 44L, 48L, 71L, 48L, 59L, 52L, 54L, 48L, 71L,
52L, 54L, 51L)), .Names = c("Site", "ID", "Treat", "Age", "W0",
"Fem", "Week", "Total"), class = "data.frame", row.names = c(NA,
-545L))
library("partykit")
library("rpart")
fac <- c(1,3,6)
for(j in 1:length(fac)) datLB[,fac[j]] <- as.factor(datLB[,fac[j]])
dat <- subset(datLB,Week==16)
dat <- na.omit(dat)
fit <- rpart(Total ~ Site + Treat + Age + W0,
method = "anova", data = dat)
f <- as.party(fit)
plot(f,tp_args = list(id = FALSE))
f[10]$node$split
### factors with empty levels in learning sample
library("mlbench")
data("Vowel")
ct <- ctree(V2 ~ V1, data = Vowel[1:200,]) ### only levels 1:4 in V1
try(p1 <- predict(ct, newdata = Vowel)) ### 14 levels in V1
### deal with empty levels for teststat = "quad" by
### removing elements of the teststatistic with zero variance
### reported by Wei-Yin Loh <loh@stat.wisc.edu>
tdata <-
structure(list(ytrain = structure(c(3L, 7L, 3L, 2L, 1L, 6L, 2L,
1L, 1L, 2L, 1L, 2L, 3L, 3L, 2L, 1L, 2L, 6L, 2L, 4L, 6L, 1L, 2L,
3L, 7L, 6L, 4L, 6L, 2L, 2L, 1L, 2L, 6L, 1L, 7L, 1L, 3L, 6L, 2L,
1L, 7L, 2L, 7L, 2L, 3L, 2L, 1L, 1L, 3L, 1L, 6L, 2L, 2L, 2L, 2L,
2L, 1L, 1L, 6L, 6L, 7L, 2L, 2L, 2L, 2L, 2L, 1L, 3L, 6L, 5L, 1L,
1L, 4L, 7L, 2L, 3L, 3L, 3L, 1L, 8L, 1L, 6L, 2L, 8L, 3L, 4L, 6L,
2L, 7L, 3L, 6L, 6L, 1L, 1L, 2L, 6L, 3L, 3L, 1L, 2L, 3L, 1L, 2L,
7L, 2L, 3L, 6L, 2L, 5L, 2L, 2L, 2L, 1L, 3L, 3L, 7L, 3L, 2L, 3L,
3L, 1L, 6L, 1L, 1L, 1L, 7L, 1L, 3L, 7L, 6L, 1L, 3L, 3L, 6L, 4L,
2L, 3L, 2L, 8L, 3L, 4L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 3L, 4L, 6L,
4L, 8L, 2L, 2L, 3L, 3L, 2L, 3L, 6L, 2L, 1L, 2L, 2L, 7L, 2L, 1L,
1L, 7L, 2L, 7L, 6L, 6L, 6L), .Label = c("0", "1", "2", "3", "4",
"5", "6", "7"), class = "factor"), landmass = c(5L, 3L, 4L, 6L,
3L, 4L, 1L, 2L, 2L, 6L, 3L, 1L, 5L, 5L, 1L, 3L, 1L, 4L, 1L, 5L,
4L, 2L, 1L, 5L, 3L, 4L, 5L, 4L, 4L, 1L, 4L, 1L, 4L, 2L, 5L, 2L,
4L, 4L, 6L, 1L, 1L, 3L, 3L, 3L, 4L, 1L, 1L, 2L, 4L, 1L, 4L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, 4L, 4L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 4L, 4L, 4L, 1L, 4L, 1L,
1L, 1L, 1L, 2L, 1L, 1L, 2L, 4L, 1L, 1L, 4L, 1L, 1L, 4L, 3L, 4L,
4L, 1L, 2L, 1L, 4L, 1L, 3L, 1L, 2L, 2L, 2L), area = c(648L, 29L,
2388L, 0L, 0L, 1247L, 0L, 2777L, 2777L, 7690L, 84L, 19L, 1L,
143L, 0L, 31L, 23L, 113L, 0L, 47L, 600L, 8512L, 0L, 6L, 111L,
274L, 678L, 28L, 474L, 9976L, 4L, 0L, 623L, 757L, 9561L, 1139L,
2L, 342L, 0L, 51L, 115L, 9L, 128L, 43L, 22L, 0L, 49L, 284L, 1001L,
21L, 28L, 1222L, 1L, 12L, 18L, 337L, 547L, 91L, 268L, 10L, 108L,
249L, 0L, 132L, 0L, 0L, 109L, 246L, 36L, 215L, 28L, 112L, 1L,
93L, 103L, 1904L, 1648L, 435L, 70L, 21L, 301L, 323L, 11L, 372L,
98L, 181L, 583L, 0L, 236L, 10L, 30L, 111L, 0L, 3L, 587L, 118L,
333L, 0L, 0L, 0L, 1031L, 1973L, 1L, 1566L, 0L, 447L, 783L, 0L,
140L, 41L, 0L, 268L, 128L, 1267L, 925L, 121L, 195L, 324L, 212L,
804L, 76L, 463L, 407L, 1285L, 300L, 313L, 9L, 11L, 237L, 26L,
0L, 2150L, 196L, 72L, 1L, 30L, 637L, 1221L, 99L, 288L, 66L, 0L,
0L, 0L, 2506L, 63L, 450L, 41L, 185L, 36L, 945L, 514L, 57L, 1L,
5L, 164L, 781L, 0L, 84L, 236L, 245L, 178L, 0L, 9363L, 22402L,
15L, 0L, 912L, 333L, 3L, 256L, 905L, 753L, 391L), population = c(16L,
3L, 20L, 0L, 0L, 7L, 0L, 28L, 28L, 15L, 8L, 0L, 0L, 90L, 0L,
10L, 0L, 3L, 0L, 1L, 1L, 119L, 0L, 0L, 9L, 7L, 35L, 4L, 8L, 24L,
0L, 0L, 2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, 7L, 2L,
7L, 5L, 7L, 8L, 7L, 7L, 2L, 1L, 7L, 7L, 8L, 8L, 7L, 7L, 5L,
8L, 7L, 7L, 7L, 7L, 5L, 3L, 5L), .Label = c("black", "blue",
"brown", "gold", "green", "orange", "red", "white"), class = "factor")), .Names = c("ytrain",
"landmass", "zone", "area", "population", "language", "bars",
"stripes", "colours", "red", "green", "blue", "gold", "white",
"black", "orange", "mainhue", "circles", "crosses", "saltires",
"quarters", "sunstars", "crescent", "triangle", "icon", "animate",
"text", "topleft", "botright"), row.names = c(NA, -174L), class = "data.frame")
tdata$language <- factor(tdata$language)
tdata$ytrain <- factor(tdata$ytrain)
### was: error
model <- ctree(ytrain ~ ., data = tdata,
control = ctree_control(testtype = "Univariate", splitstat = "maximum"))
library("coin")
### check against coin (independence_test automatically
### removes empty levels)
p <- info_node(node_party(model))$criterion["p.value",]
p[is.na(p)] <- 0
p2 <- sapply(names(p), function(n)
pvalue(independence_test(ytrain ~ .,
data = tdata[, c("ytrain", n)], teststat = "quad")))
stopifnot(max(abs(p - p2)) < sqrt(.Machine$double.eps))
p <- info_node(node_party(model[2]))$criterion["p.value",]
p[is.na(p)] <- 0
p2 <- sapply(names(p), function(n)
pvalue(independence_test(ytrain ~ .,
data = tdata[tdata$language != "8", c("ytrain", n)],
teststat = "quad")))
stopifnot(max(abs(p - p2)) < sqrt(.Machine$double.eps))
p <- info_node(node_party(model[3]))$criterion["p.value",]
p[is.na(p)] <- 0
p2 <- sapply(names(p), function(n)
pvalue(independence_test(ytrain ~ .,
data = tdata[!(tdata$language %in% c("2", "4", "8")),
c("ytrain", n)],
teststat = "quad")))
stopifnot(max(abs(p - p2)) < sqrt(.Machine$double.eps))
### check coersion of constparties to simpleparties
### containing terminal nodes without corresponding observations
## create party
data("WeatherPlay", package = "partykit")
py <- party(
partynode(1L,
split = partysplit(1L, index = 1:3),
kids = list(
partynode(2L,
split = partysplit(3L, breaks = 75),
kids = list(
partynode(3L, info = "yes"),
partynode(4L, info = "no"))),
partynode(5L,
split = partysplit(3L, breaks = 20),
kids = list(
partynode(6L, info = "no"),
partynode(7L, info = "yes"))),
partynode(8L,
split = partysplit(4L, index = 1:2),
kids = list(
partynode(9L, info = "yes"),
partynode(10L, info = "no"))))),
WeatherPlay)
names(py) <- LETTERS[nodeids(py)]
pn <- node_party(py)
cp <- party(pn,
data = WeatherPlay,
fitted = data.frame(
"(fitted)" = fitted_node(pn, data = WeatherPlay),
"(response)" = WeatherPlay$play,
check.names = FALSE),
terms = terms(play ~ ., data = WeatherPlay),
)
print(cp)
cp <- as.constparty(cp)
nd <- data.frame(outlook = factor("overcast", levels = levels(WeatherPlay$outlook)),
humidity = 10, temperature = 10, windy = "yes")
try(predict(cp, type = "node", newdata = nd))
try(predict(cp, type = "response", newdata = nd))
as.simpleparty(cp)
print(cp)
### scores
y <- gl(3, 10, ordered = TRUE)
x <- rnorm(length(y))
x <- ordered(cut(x, 3))
d <- data.frame(y = y, x = x)
### partykit with scores
ct11 <- partykit::ctree(y ~ x, data = d)
ct12 <- partykit::ctree(y ~ x, data = d,
scores = list(y = c(1, 4, 5)))
ct13 <- partykit::ctree(y ~ x, data = d,
scores = list(y = c(1, 4, 5), x = c(1, 5, 6)))
### party with scores
ct21 <- party::ctree(y ~ x, data = d)
ct22 <- party::ctree(y ~ x, data = d,
scores = list(y = c(1, 4, 5)))
ct23 <- party::ctree(y ~ x, data = d,
scores = list(y = c(1, 4, 5), x = c(1, 5, 6)))
stopifnot(all.equal(ct11$node$info$p.value,
1 - ct21@tree$criterion$criterion, check.attr = FALSE))
stopifnot(all.equal(ct12$node$info$p.value,
1 - ct22@tree$criterion$criterion, check.attr = FALSE))
stopifnot(all.equal(ct13$node$info$p.value,
1 - ct23@tree$criterion$criterion, check.attr = FALSE))
### ytrafo
y <- runif(100, max = 3)
x <- rnorm(length(y))
d <- data.frame(y = y, x = x)
### partykit with scores
ct11 <- partykit::ctree(y ~ x, data = d)
ct12 <- partykit::ctree(y ~ x, data = d,
ytrafo = list(y = sqrt))
### party with scores
ct21 <- party::ctree(y ~ x, data = d)
f <- function(data) coin::trafo(data, numeric_trafo = sqrt)
ct22 <- party::ctree(y ~ x, data = d,
ytrafo = f)
stopifnot(all.equal(ct11$node$info$p.value,
1 - ct21@tree$criterion$criterion, check.attr = FALSE))
stopifnot(all.equal(ct12$node$info$p.value,
1 - ct22@tree$criterion$criterion, check.attr = FALSE))
### spotted by Peter Philip Stephensen (DREAM) <PSP@dreammodel.dk>
### splits x >= max(x) where possible in partykit::ctree
library("partykit")
nAge <- 30
d <- data.frame(Age=rep(1:nAge,2),y=c(rep(1,nAge),rep(0,nAge)),
n = rep(0,2*nAge))
ntot <- 100
alpha <- .5
d[d$y==1,]$n = floor(ntot * alpha * d[d$y==1,]$Age / nAge)
d[d$y==0,]$n = ntot - d[d$y==1,]$n
d$n <- as.integer(d$n)
ctrl <- partykit::ctree_control(maxdepth=3, minbucket = min(d$n) + 1)
tree <- partykit::ctree(y ~ Age, weights=n, data=d, control=ctrl)
tree
(w1 <- predict(tree, type = "node"))
(ct <- ctree(dist + I(dist^2) ~ speed, data = cars))
predict(ct)
### nodeapply was not the same for permutations of ids
### spotted by Heidi Seibold
airq <- subset(airquality, !is.na(Ozone))
airct <- ctree(Ozone ~ ., data = airq)
n1 <- nodeapply(airct, ids = c(3, 5, 6), function(x) x$info$nobs)
n2 <- nodeapply(airct, ids = c(6, 3, 5), function(x) x$info$nobs)
stopifnot(all.equal(n1[names(n2)], n2))
### pruning got "fitted" wrong, spotted by Jason Parker
data("Titanic")
titan <- as.data.frame(Titanic)
(tree <- ctree(Survived ~ Class + Sex + Age, data = titan, weights = Freq))
### prune off nodes 5-12 and check if the other nodes are not affected
nodeprune(tree, 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.