Switch to unified view

a b/partyMod/tests/TestStatistic-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
> 
35
> ### get rid of the NAMESPACE
36
> attach(asNamespace("party"))
37
The following objects are masked from package:party:
38
39
    cforest, cforest_classical, cforest_control, cforest_unbiased,
40
    conditionalTree, ctree, ctree_control, ctree_memory, edge_simple,
41
    mob, mob_control, node_barplot, node_bivplot, node_boxplot,
42
    node_density, node_hist, node_inner, node_scatterplot, node_surv,
43
    node_terminal, proximity, ptrafo, reweight, sctest.mob, varimp,
44
    varimpAUC
45
46
> 
47
> ### 
48
> ###
49
> ###    Regression tests for test statistics
50
> ###    
51
> ###    functions defined in file `./src/TestStatistic.c'    
52
> 
53
> ### tests for function C_maxabsTeststatistic
54
> xf <- gl(3, 10)
55
> yf <- gl(3, 10)[sample(1:30)]
56
> x <- sapply(levels(xf), function(l) as.numeric(xf == l))
57
> colnames(x) <- NULL
58
> y <- sapply(levels(yf), function(l) as.numeric(yf == l))
59
> colnames(y) <- NULL
60
> weights <- sample(1:30)
61
> linstat <- LinearStatistic(x, y, weights) 
62
> expcov <- ExpectCovarLinearStatistic(x, y, weights)
63
> maxabs <- max(abs(linstat - expcov@expectation) / sqrt(diag(expcov@covariance)))
64
> stopifnot(isequal(maxabs, 
65
+     maxabsTestStatistic(linstat, expcov@expectation, expcov@covariance, 1e-10)))
66
> expcov@covariance[1,1] <- 1e-12
67
> stopifnot(isequal(maxabs,
68
+     maxabsTestStatistic(linstat, expcov@expectation, expcov@covariance, 1e-10)))
69
> 
70
> ### tests for function C_quadformTeststatistic
71
> ### -> see LinearStatistic-regtest.R
72
> 
73
> 
74
> proc.time()
75
   user  system elapsed 
76
  0.660   0.012   0.668