|
a |
|
b/partyMod/tests/Utils-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("MASS", quietly = TRUE)) |
|
|
35 |
+ stop("cannot load package MASS") |
|
|
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 |
> ### |
|
|
50 |
> ### |
|
|
51 |
> ### Regression tests for utility functions |
|
|
52 |
> ### |
|
|
53 |
> ### functions defined in file ./src/Utils.c' |
|
|
54 |
> ### |
|
|
55 |
> ### |
|
|
56 |
> |
|
|
57 |
> ### tests for function C_kronecker |
|
|
58 |
> for (i in 1:10) { |
|
|
59 |
+ A = matrix(rnorm(i*5), ncol = i, nrow = 5) |
|
|
60 |
+ B = matrix(rnorm(i*10), ncol = 10, nrow = i) |
|
|
61 |
+ Rkr = kronecker(A, B) |
|
|
62 |
+ mykr = .Call("R_kronecker", A, B, PACKAGE = "party") |
|
|
63 |
+ stopifnot(isequal(Rkr, mykr)) |
|
|
64 |
+ } |
|
|
65 |
> |
|
|
66 |
> ### test for function CR_svd (singular value decomposition) |
|
|
67 |
> x <- matrix(rnorm(100), ncol = 10) |
|
|
68 |
> x <- t(x) %*% x |
|
|
69 |
> svdx <- qsvd(x) |
|
|
70 |
> stopifnot(isequal(svd(x)$d, svdx$d)) |
|
|
71 |
> stopifnot(isequal(svd(x)$u, svdx$u)) |
|
|
72 |
> stopifnot(isequal(svd(x)$v, t(svdx$vt))) |
|
|
73 |
> |
|
|
74 |
> ### test for function R_MPinv (Moore-Penrose inverse) |
|
|
75 |
> mpinvx <- MPinv(x) |
|
|
76 |
> stopifnot(isequal(mpinvx, ginv(x))) |
|
|
77 |
> |
|
|
78 |
> ### test for function C_max |
|
|
79 |
> y <- rnorm(1000) |
|
|
80 |
> stopifnot(isequal(max(y), .Call("R_max", y, PACKAGE = "party"))) |
|
|
81 |
> |
|
|
82 |
> ### test for function C_abs |
|
|
83 |
> y <- rnorm(1000) |
|
|
84 |
> stopifnot(isequal(abs(y), .Call("R_abs", y, PACKAGE = "party"))) |
|
|
85 |
> |
|
|
86 |
> ### tests for function C_matprod{T} |
|
|
87 |
> x <- matrix(rnorm(100), ncol = 4) |
|
|
88 |
> y <- matrix(rnorm(40), nrow = 4) |
|
|
89 |
> stopifnot(isequal(x %*% y, |
|
|
90 |
+ .Call("R_matprod", x, y, PACKAGE = "party"))) |
|
|
91 |
> x <- matrix(rnorm(100), ncol = 20) |
|
|
92 |
> y <- matrix(rnorm(200), ncol = 20) |
|
|
93 |
> stopifnot(isequal(x %*% t(y), |
|
|
94 |
+ .Call("R_matprodT", x, y, PACKAGE = "party"))) |
|
|
95 |
> |
|
|
96 |
> ### test for function C_SampleNoReplace |
|
|
97 |
> ### permutation case |
|
|
98 |
> m <- 10000 |
|
|
99 |
> storage.mode(m) <- "integer" |
|
|
100 |
> perm <- .Call("R_permute", m, PACKAGE = "party") + 1 |
|
|
101 |
> stopifnot(all(sort(perm) == (1:m))) |
|
|
102 |
> |
|
|
103 |
> ### the random subset case |
|
|
104 |
> k <- 100 |
|
|
105 |
> storage.mode(k) <- "integer" |
|
|
106 |
> perm <- .Call("R_rsubset", m, k, PACKAGE = "party") + 1 |
|
|
107 |
> stopifnot(all(perm %in% (1:m))) |
|
|
108 |
> |
|
|
109 |
> proc.time() |
|
|
110 |
user system elapsed |
|
|
111 |
0.760 0.028 0.782 |