The R Project SVN R

Rev

Rev 89548 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89548 Rev 90068
Line 1... Line 1...
1
 
1
 
2
R Under development (unstable) (2026-03-05 r89546) -- "Unsuffered Consequences"
2
R Under development (unstable) (2026-05-22 r90067) -- "Unsuffered Consequences"
3
Copyright (C) 2026 The R Foundation for Statistical Computing
3
Copyright (C) 2026 The R Foundation for Statistical Computing
4
Platform: x86_64-pc-linux-gnu
4
Platform: x86_64-pc-linux-gnu
5
 
5
 
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
7
You are welcome to redistribute it under certain conditions.
7
You are welcome to redistribute it under certain conditions.
Line 14... Line 14...
14
Type 'demo()' for some demos, 'help()' for on-line help, or
14
Type 'demo()' for some demos, 'help()' for on-line help, or
15
'help.start()' for an HTML browser interface to help.
15
'help.start()' for an HTML browser interface to help.
16
Type 'q()' to quit R.
16
Type 'q()' to quit R.
17
 
17
 
18
> #### Some examples of the KS and Wilcoxon tests
18
> #### Some examples of the KS and Wilcoxon tests
19
> 
19
>
20
> ### ------ Kolmogorov Smirnov (KS) --------------
20
> ### ------ Kolmogorov Smirnov (KS) --------------
21
> 
21
>
22
> ## unrealistic one of PR#14561
22
> ## unrealistic one of PR#14561
23
> ds1 <- c(1.7,2,3,3,4,4,5,5,6,6)
23
> ds1 <- c(1.7,2,3,3,4,4,5,5,6,6)
24
> ks.test(ds1, "pnorm", mean = 3.3, sd = 1.55216)
24
> ks.test(ds1, "pnorm", mean = 3.3, sd = 1.55216)
25
 
25
 
26
	Asymptotic one-sample Kolmogorov-Smirnov test
26
	Asymptotic one-sample Kolmogorov-Smirnov test
Line 31... Line 31...
31
 
31
 
32
Warning message:
32
Warning message:
33
In ks.test.default(ds1, "pnorm", mean = 3.3, sd = 1.55216) :
33
In ks.test.default(ds1, "pnorm", mean = 3.3, sd = 1.55216) :
34
  ties should not be present for the one-sample Kolmogorov-Smirnov test
34
  ties should not be present for the one-sample Kolmogorov-Smirnov test
35
> # how on earth can sigma = 1.55216 be known?
35
> # how on earth can sigma = 1.55216 be known?
36
> 
36
>
37
> # R >= 2.14.0 allows the equally invalid
37
> # R >= 2.14.0 allows the equally invalid
38
> ks.test(ds1, "pnorm", mean = 3.3, sd = 1.55216, exact = TRUE)
38
> ks.test(ds1, "pnorm", mean = 3.3, sd = 1.55216, exact = TRUE)
39
 
39
 
40
	Exact one-sample Kolmogorov-Smirnov test
40
	Exact one-sample Kolmogorov-Smirnov test
41
 
41
 
Line 44... Line 44...
44
alternative hypothesis: two-sided
44
alternative hypothesis: two-sided
45
 
45
 
46
Warning message:
46
Warning message:
47
In ks.test.default(ds1, "pnorm", mean = 3.3, sd = 1.55216, exact = TRUE) :
47
In ks.test.default(ds1, "pnorm", mean = 3.3, sd = 1.55216, exact = TRUE) :
48
  ties should not be present for the one-sample Kolmogorov-Smirnov test
48
  ties should not be present for the one-sample Kolmogorov-Smirnov test
49
> 
49
>
50
> ## Try out the effects of rounding
50
> ## Try out the effects of rounding
51
> set.seed(123)
51
> set.seed(123)
52
> ds2 <- rnorm(1000)
52
> ds2 <- rnorm(1000)
53
> ks.test(ds2, "pnorm") # exact = FALSE is default for n = 1000
53
> ks.test(ds2, "pnorm") # exact = FALSE is default for n = 1000
54
 
54
 
Line 110... Line 110...
110
alternative hypothesis: two-sided
110
alternative hypothesis: two-sided
111
 
111
 
112
Warning message:
112
Warning message:
113
In ks.test.default(round(ds2, 1), "pnorm", exact = TRUE) :
113
In ks.test.default(round(ds2, 1), "pnorm", exact = TRUE) :
114
  ties should not be present for the one-sample Kolmogorov-Smirnov test
114
  ties should not be present for the one-sample Kolmogorov-Smirnov test
-
 
115
> summary(w1 <- warnings())
-
 
116
1 identical warnings:
-
 
117
In ks.test.default(round(ds2, 1), "pnorm", exact = TRUE) :
-
 
118
  ties should not be present for the one-sample Kolmogorov-Smirnov test
115
> 
119
> 
116
> 
120
>
117
> ### ------ Wilkoxon (Mann Whitney) --------------
121
> ### ------ Wilcoxon (Mann Whitney) --------------
118
> 
122
>
119
> options(nwarnings = 1000)
123
> options(nwarnings = 1000)
120
> (alts <- setNames(, eval(formals(stats:::wilcox.test.default)$alternative)))
124
> (alts <- setNames(, eval(formals(stats:::wilcox.test.default)$alternative)))
121
  two.sided        less     greater 
125
  two.sided        less     greater
122
"two.sided"      "less"   "greater" 
126
"two.sided"      "less"   "greater"
123
> x0 <- 0:4
127
> x0 <- setNames(0:4, paste0("n_", 1L + 0:4))
124
> (x.set <- list(s0 = lapply(x0, function(m) 0:m),
128
> str(x.set <- list(s0 = lapply(x0, function(m) 0:m),
125
+                s. = lapply(x0, function(m) c(1e-9, seq_len(m)))))
129
+                   s. = lapply(x0, function(m) c(1e-9, seq_len(m)))))
126
$s0
-
 
127
$s0[[1]]
130
List of 2
128
[1] 0
-
 
129
 
-
 
130
$s0[[2]]
131
 $ s0:List of 5
131
[1] 0 1
132
  ..$ n_1: int 0
132
 
-
 
133
$s0[[3]]
133
  ..$ n_2: int [1:2] 0 1
134
[1] 0 1 2
134
  ..$ n_3: int [1:3] 0 1 2
135
 
-
 
136
$s0[[4]]
-
 
137
[1] 0 1 2 3
135
  ..$ n_4: int [1:4] 0 1 2 3
138
 
-
 
139
$s0[[5]]
-
 
140
[1] 0 1 2 3 4
136
  ..$ n_5: int [1:5] 0 1 2 3 4
141
 
-
 
142
 
-
 
143
$s.
-
 
144
$s.[[1]]
137
 $ s.:List of 5
145
[1] 1e-09
138
  ..$ n_1: num 1e-09
146
 
-
 
147
$s.[[2]]
-
 
148
[1] 1e-09 1e+00
139
  ..$ n_2: num [1:2] 1e-09 1e+00
149
 
-
 
150
$s.[[3]]
-
 
151
[1] 1e-09 1e+00 2e+00
140
  ..$ n_3: num [1:3] 1e-09 1e+00 2e+00
152
 
-
 
153
$s.[[4]]
-
 
154
[1] 1e-09 1e+00 2e+00 3e+00
141
  ..$ n_4: num [1:4] 1e-09 1e+00 2e+00 3e+00
155
 
-
 
156
$s.[[5]]
-
 
157
[1] 1e-09 1e+00 2e+00 3e+00 4e+00
142
  ..$ n_5: num [1:5] 1e-09 1e+00 2e+00 3e+00 4e+00
158
 
-
 
159
 
-
 
160
> stats <- setNames(nm = c("statistic", "p.value", "conf.int", "estimate"))
143
> stats <- setNames(nm = c("statistic", "p.value", "conf.int", "estimate"))
161
> 
-
 
162
> ## Even with  conf.int = TRUE, do not want errors :
144
> dig.r <- c(Inf, 20, 15, 10, 7, 5); names(dig.r) <- paste0("d.rank=", dig.r)
163
> RR <-
145
> RL <- lapply(dig.r, function(dig.rank)
164
+     lapply(x.set, ## for all data sets
146
+              lapply(x.set, ## for all data sets
165
+            function(xs)
147
+                     function(xs)
166
+                lapply(alts, ## for all three alternatives
148
+                         lapply(alts, ## for all three alternatives
167
+                       function(alt)
149
+                                function(alt)
168
+                           lapply(xs, function(x)
150
+                                    lapply(xs, function(x)
169
+                               ## try(
151
+                                        ## try( nolonger: Even with  conf.int = TRUE, do not want errors :
170
+                               wilcox.test(x, exact=TRUE, conf.int=TRUE, alternative = alt)
152
+                                        wilcox.test(x, exact=TRUE, conf.int=TRUE, alternative = alt,
-
 
153
+                                                    digits.rank = dig.rank)
171
+                               ## )
154
+                                        ## )
172
+                               )))
155
+                                        ))))
173
> length(ww <- warnings()) # 52 (or 43 for x0 <- 0:3)
156
> length(ww <- warnings()) # 1 ; was 52 (or 43 for x0 <- 0:3)
174
[1] 1
157
[1] 1
-
 
158
> if(!identical(w1, ww)) # typically they *are* identical ==> no new warnings
-
 
159
+     summary(ww)
175
> unique(ww) # 4 different ones
160
> ## unique(ww) # (were 4 different ones)
-
 
161
>
-
 
162
> ## RL is very nested tree of "htest" results
-
 
163
> str(RL, max.level = 2)
-
 
164
List of 6
-
 
165
 $ d.rank=Inf:List of 2
-
 
166
  ..$ s0:List of 3
-
 
167
  ..$ s.:List of 3
-
 
168
 $ d.rank=20 :List of 2
-
 
169
  ..$ s0:List of 3
-
 
170
  ..$ s.:List of 3
-
 
171
 $ d.rank=15 :List of 2
-
 
172
  ..$ s0:List of 3
-
 
173
  ..$ s.:List of 3
-
 
174
 $ d.rank=10 :List of 2
-
 
175
  ..$ s0:List of 3
-
 
176
  ..$ s.:List of 3
-
 
177
 $ d.rank=7  :List of 2
-
 
178
  ..$ s0:List of 3
-
 
179
  ..$ s.:List of 3
-
 
180
 $ d.rank=5  :List of 2
-
 
181
  ..$ s0:List of 3
-
 
182
  ..$ s.:List of 3
-
 
183
> str(RL[["d.rank=7"]]$s.$two.sided, max.level = 1) # 5 x {list of 9, class "htest"}
-
 
184
List of 5
-
 
185
 $ n_1:List of 9
-
 
186
  ..- attr(*, "class")= chr "htest"
-
 
187
 $ n_2:List of 9
-
 
188
  ..- attr(*, "class")= chr "htest"
-
 
189
 $ n_3:List of 9
-
 
190
  ..- attr(*, "class")= chr "htest"
-
 
191
 $ n_4:List of 9
-
 
192
  ..- attr(*, "class")= chr "htest"
176
Warning message:
193
 $ n_5:List of 9
-
 
194
  ..- attr(*, "class")= chr "htest"
177
In ks.test.default(round(ds2, 1), "pnorm", exact = TRUE) :
195
> str(RL[["d.rank=7"]]$s.$two.sided [1:2], give.attr = FALSE)
-
 
196
List of 2
-
 
197
 $ n_1:List of 9
-
 
198
  ..$ statistic  : Named num 1
-
 
199
  ..$ parameter  : NULL
-
 
200
  ..$ p.value    : num 1
-
 
201
  ..$ null.value : Named num 0
-
 
202
  ..$ alternative: chr "two.sided"
-
 
203
  ..$ method     : chr "Wilcoxon signed rank exact test"
-
 
204
  ..$ data.name  : chr "x"
-
 
205
  ..$ conf.int   : num [1:2] -Inf Inf
-
 
206
  ..$ estimate   : Named num 1e-09
-
 
207
 $ n_2:List of 9
-
 
208
  ..$ statistic  : Named num 2
-
 
209
  ..$ parameter  : NULL
-
 
210
  ..$ p.value    : num 1
-
 
211
  ..$ null.value : Named num 0
-
 
212
  ..$ alternative: chr "two.sided"
178
  ties should not be present for the one-sample Kolmogorov-Smirnov test
213
  ..$ method     : chr "Wilcoxon signed rank exact test"
-
 
214
  ..$ data.name  : chr "x"
-
 
215
  ..$ conf.int   : num [1:2] 1e-09 Inf
-
 
216
  ..$ estimate   : Named num 0.5
179
> 
217
>
180
> cc <- lapply(RR, function(A) lapply(A, function(bb) lapply(bb, class)))
218
> cc <- lapply(RL, function(A) lapply(A, function(B) lapply(B, function(bb) lapply(bb, class))))
181
> table(unlist(cc))
219
> ##N table(unlist(cc))
182
 
-
 
183
htest 
-
 
184
   30 
-
 
185
> ## in R <= 3.3.1,  with try( .. ) above, we got
220
> ## in R <= 3.3.1,  with try( .. ) above and only digits.rank=Inf, we got
186
> ## htest try-error
221
> ## htest try-error
187
> ##    23         7
222
> ##    23         7
-
 
223
> stopifnot(identical("htest", unique(unlist(cc))))
188
> uc <- unlist(cc[["s0"]]); noquote(names(uc)[uc != "htest"]) ## these 7 cases :
224
> ##N uc <- unlist(cc[["s0"]]); noquote(names(uc)[uc != "htest"]) ## these 7 cases :
189
character(0)
-
 
190
> ## two.sided1 two.sided2 two.sided3
225
> ## two.sided1 two.sided2 two.sided3
191
> ## less1      less2
226
> ## less1      less2
192
> ## greater1   greater2
227
> ## greater1   greater2
193
> 
228
>
194
> ##--- How close are the stats of  (0:m)  to those of  (eps, 1:m) ------------
229
> ##--- How close are the stats of  (0:m)  to those of  (eps, 1:m) ------------
195
> 
230
>
196
> ## a version that still works with above try(.) and errors there:
231
> ## Contained errors in older versions:
197
> getC <- function(L, C) if(inherits(L,"try-error")) c(L) else L[[C]]
-
 
198
> stR <- lapply(stats, function(COMP)
232
> stR <- lapply(stats, function(COMP)
199
+            lapply(RR, function(A)
233
+            lapply(RL, function(A)
200
+                lapply(A, function(bb)
234
+                lapply(A, function(B)
-
 
235
+                    lapply(B, function(bb)
201
+                    lapply(bb, getC, C=COMP) )))
236
+                        lapply(bb, `[[`, COMP) ))))
-
 
237
> if(interactive()) {
-
 
238
+     str(stR, max.level = 2)
-
 
239
+     str(stR$p.value$`d.rank=7`, give.attr = FALSE)
-
 
240
+ }
-
 
241
> 
-
 
242
> ## short cut & speedup:
-
 
243
> unList <- function(x) .Internal(unlist(x, FALSE,  TRUE))
-
 
244
> ##                                        recurs. use.nms
-
 
245
> ## a) P-value s
-
 
246
> pv <- stR$p.value
-
 
247
>
-
 
248
> str(apv <- simplify2array(
-
 
249
+         lapply(pv, \(L0) simplify2array(
-
 
250
+                              lapply(L0, \(L) simplify2array(lapply(L, unList))))))
-
 
251
+     )
-
 
252
 num [1:5, 1:3, 1:2, 1:6] 1 1 0.5 0.25 0.125 1 1 1 1 1 ...
-
 
253
 - attr(*, "dimnames")=List of 4
-
 
254
  ..$ : chr [1:5] "n_1" "n_2" "n_3" "n_4" ...
-
 
255
  ..$ : chr [1:3] "two.sided" "less" "greater"
-
 
256
  ..$ : chr [1:2] "s0" "s."
-
 
257
  ..$ : chr [1:6] "d.rank=Inf" "d.rank=20" "d.rank=15" "d.rank=10" ...
-
 
258
> ## num [1:5, 1:3, 1:2, 1:6] 1 1 0.5 0.25 0.125 ...
-
 
259
> ## - attr(*, "dimnames")=List of 4
-
 
260
> ##  ..$ : chr [1:5] "n_1" "n_2" "n_3" "n_4" ...
-
 
261
> ##  ..$ : chr [1:3] "two.sided" "less" "greater"
-
 
262
> ##  ..$ : chr [1:2] "s0" "s."
-
 
263
> ##  ..$ : chr [1:6] "d.rank=Inf" "d.rank=20" "d.rank=15" "d.rank=10" ...
-
 
264
> object.size(apv) 				# 3144 bytes
-
 
265
3144 bytes
-
 
266
> object.size(dpv <- as.data.frame.table(apv))	# 8176 bytes
-
 
267
8176 bytes
-
 
268
> str(dpv)
-
 
269
'data.frame':	180 obs. of  5 variables:
-
 
270
 $ Var1: Factor w/ 5 levels "n_1","n_2","n_3",..: 1 2 3 4 5 1 2 3 4 5 ...
-
 
271
 $ Var2: Factor w/ 3 levels "two.sided","less",..: 1 1 1 1 1 2 2 2 2 2 ...
-
 
272
 $ Var3: Factor w/ 2 levels "s0","s.": 1 1 1 1 1 1 1 1 1 1 ...
-
 
273
 $ Var4: Factor w/ 6 levels "d.rank=Inf","d.rank=20",..: 1 1 1 1 1 1 1 1 1 1 ...
-
 
274
 $ Freq: num  1 1 0.5 0.25 0.125 1 1 1 1 1 ...
-
 
275
> str(ps. <- apv[,,"s.",])
-
 
276
 num [1:5, 1:3, 1:6] 1 0.5 0.25 0.125 0.0625 1 1 1 1 1 ...
-
 
277
 - attr(*, "dimnames")=List of 3
-
 
278
  ..$ : chr [1:5] "n_1" "n_2" "n_3" "n_4" ...
-
 
279
  ..$ : chr [1:3] "two.sided" "less" "greater"
-
 
280
  ..$ : chr [1:6] "d.rank=Inf" "d.rank=20" "d.rank=15" "d.rank=10" ...
-
 
281
> str(ps0 <- apv[,,"s0",])
-
 
282
 num [1:5, 1:3, 1:6] 1 1 0.5 0.25 0.125 1 1 1 1 1 ...
-
 
283
 - attr(*, "dimnames")=List of 3
-
 
284
  ..$ : chr [1:5] "n_1" "n_2" "n_3" "n_4" ...
-
 
285
  ..$ : chr [1:3] "two.sided" "less" "greater"
-
 
286
  ..$ : chr [1:6] "d.rank=Inf" "d.rank=20" "d.rank=15" "d.rank=10" ...
-
 
287
> (epsC <- .Machine$double.eps) # 2.2e-16
-
 
288
[1] 2.220446e-16
-
 
289
> allEQ <- function(x,y) all.equal(x, y, tolerance = 8*epsC)
-
 
290
> stopifnot(exprs = {
-
 
291
+     0 <= unlist(apv) ; unlist(apv) <= 1 # (no NA, ..)
-
 
292
+     ## ps0 does *not* vary with digits.rank :
-
 
293
+     identical(dim(print(ups0 <- drop(unique(ps0, MARGIN = 3)))), c(5L, 3L))
-
 
294
+     is.function(uNam <- function(x) `names<-`(x, NULL))
-
 
295
+     allEQ(uNam(ups0[,"two.sided"]), c(1, 2^(0:-3)))
-
 
296
+     allEQ(uNam(ups0[, "greater" ]), 2^(0:-4))
-
 
297
+     allEQ(uNam(ups0[,  "less"   ]), c(1,1,1,1,1))
-
 
298
+     ## NB: This has changed from R 4.6.0 (now using digits.zap = digits.rank):
-
 
299
+     ## ps., eps=1e-9: two possible results, boundary for 1e-9 between digits.rank = 7 and 10
-
 
300
+     identical(dim(print(ups. <- unique(ps., MARGIN = 3))), c(5L, 3L, 2L))
-
 
301
+     allEQ(ps.[,,"d.rank=Inf"], ps.[,,"d.rank=10"])
-
 
302
+     is.function(uNam <- function(x) `dimnames<-`(x, NULL))
-
 
303
+     allEQ(uNam(ups.[,"two.sided", ]), 2^cbind(0:-4, c(0L,0:-3)))
-
 
304
+     allEQ(uNam(ups.[, "greater" , ]), cbind(2^-(1:5), 2^-c(1,1:4)))
-
 
305
+     allEQ(uNam(ups.[,  "less"   , ]), cbind(1, rep(1, 5)))
-
 
306
+ })
-
 
307
    two.sided less greater
-
 
308
n_1     1.000    1  1.0000
-
 
309
n_2     1.000    1  0.5000
-
 
310
n_3     0.500    1  0.2500
-
 
311
n_4     0.250    1  0.1250
-
 
312
n_5     0.125    1  0.0625
-
 
313
, , d.rank=Inf
-
 
314
 
-
 
315
    two.sided less greater
-
 
316
n_1    1.0000    1 0.50000
-
 
317
n_2    0.5000    1 0.25000
-
 
318
n_3    0.2500    1 0.12500
-
 
319
n_4    0.1250    1 0.06250
-
 
320
n_5    0.0625    1 0.03125
-
 
321
 
-
 
322
, , d.rank=7
-
 
323
 
-
 
324
    two.sided less greater
-
 
325
n_1     1.000    1  0.5000
-
 
326
n_2     1.000    1  0.5000
-
 
327
n_3     0.500    1  0.2500
-
 
328
n_4     0.250    1  0.1250
-
 
329
n_5     0.125    1  0.0625
-
 
330
 
-
 
331
> 
-
 
332
> 
-
 
333
> ## b) Statistic - Estimate
-
 
334
> 
-
 
335
> (astat <- simplify2array(
-
 
336
+      lapply(stR[["statistic"]],
-
 
337
+             \(L0) simplify2array(
-
 
338
+                       lapply(L0, \(L) simplify2array(sapply(L, unList)))))))
-
 
339
, , s0, d.rank=Inf
-
 
340
 
-
 
341
      two.sided less greater
-
 
342
n_1.V         0    0       0
-
 
343
n_2.V         2    2       2
-
 
344
n_3.V         5    5       5
-
 
345
n_4.V         9    9       9
-
 
346
n_5.V        14   14      14
-
 
347
 
-
 
348
, , s., d.rank=Inf
-
 
349
 
-
 
350
      two.sided less greater
-
 
351
n_1.V         1    1       1
-
 
352
n_2.V         3    3       3
-
 
353
n_3.V         6    6       6
-
 
354
n_4.V        10   10      10
-
 
355
n_5.V        15   15      15
-
 
356
 
-
 
357
, , s0, d.rank=20
-
 
358
 
-
 
359
      two.sided less greater
-
 
360
n_1.V         0    0       0
-
 
361
n_2.V         2    2       2
-
 
362
n_3.V         5    5       5
-
 
363
n_4.V         9    9       9
-
 
364
n_5.V        14   14      14
-
 
365
 
-
 
366
, , s., d.rank=20
-
 
367
 
-
 
368
      two.sided less greater
-
 
369
n_1.V         1    1       1
-
 
370
n_2.V         3    3       3
-
 
371
n_3.V         6    6       6
-
 
372
n_4.V        10   10      10
-
 
373
n_5.V        15   15      15
-
 
374
 
-
 
375
, , s0, d.rank=15
-
 
376
 
-
 
377
      two.sided less greater
-
 
378
n_1.V         0    0       0
-
 
379
n_2.V         2    2       2
-
 
380
n_3.V         5    5       5
-
 
381
n_4.V         9    9       9
-
 
382
n_5.V        14   14      14
-
 
383
 
-
 
384
, , s., d.rank=15
-
 
385
 
-
 
386
      two.sided less greater
-
 
387
n_1.V         1    1       1
-
 
388
n_2.V         3    3       3
-
 
389
n_3.V         6    6       6
-
 
390
n_4.V        10   10      10
-
 
391
n_5.V        15   15      15
-
 
392
 
-
 
393
, , s0, d.rank=10
-
 
394
 
-
 
395
      two.sided less greater
-
 
396
n_1.V         0    0       0
-
 
397
n_2.V         2    2       2
-
 
398
n_3.V         5    5       5
-
 
399
n_4.V         9    9       9
-
 
400
n_5.V        14   14      14
-
 
401
 
-
 
402
, , s., d.rank=10
-
 
403
 
-
 
404
      two.sided less greater
-
 
405
n_1.V         1    1       1
-
 
406
n_2.V         3    3       3
-
 
407
n_3.V         6    6       6
-
 
408
n_4.V        10   10      10
-
 
409
n_5.V        15   15      15
-
 
410
 
-
 
411
, , s0, d.rank=7
-
 
412
 
-
 
413
      two.sided less greater
-
 
414
n_1.V         0    0       0
-
 
415
n_2.V         2    2       2
-
 
416
n_3.V         5    5       5
-
 
417
n_4.V         9    9       9
-
 
418
n_5.V        14   14      14
-
 
419
 
-
 
420
, , s., d.rank=7
-
 
421
 
-
 
422
      two.sided less greater
-
 
423
n_1.V         1    1       1
-
 
424
n_2.V         2    2       2
-
 
425
n_3.V         5    5       5
-
 
426
n_4.V         9    9       9
-
 
427
n_5.V        14   14      14
-
 
428
 
-
 
429
, , s0, d.rank=5
-
 
430
 
-
 
431
      two.sided less greater
-
 
432
n_1.V         0    0       0
-
 
433
n_2.V         2    2       2
-
 
434
n_3.V         5    5       5
-
 
435
n_4.V         9    9       9
-
 
436
n_5.V        14   14      14
-
 
437
 
-
 
438
, , s., d.rank=5
-
 
439
 
-
 
440
      two.sided less greater
-
 
441
n_1.V         1    1       1
-
 
442
n_2.V         2    2       2
-
 
443
n_3.V         5    5       5
-
 
444
n_4.V         9    9       9
-
 
445
n_5.V        14   14      14
-
 
446
 
-
 
447
>
-
 
448
> (aEst <- simplify2array(
-
 
449
+      lapply(stR[["estimate"]],
-
 
450
+             \(L0) simplify2array(
-
 
451
+                       lapply(L0, \(L) simplify2array(lapply(L, unList)))))))
-
 
452
, , s0, d.rank=Inf
-
 
453
 
-
 
454
                   two.sided less greater
-
 
455
n_1.(pseudo)median       0.0  0.0     0.0
-
 
456
n_2.(pseudo)median       0.5  0.5     0.5
-
 
457
n_3.(pseudo)median       1.0  1.0     1.0
-
 
458
n_4.(pseudo)median       1.5  1.5     1.5
-
 
459
n_5.(pseudo)median       2.0  2.0     2.0
-
 
460
 
-
 
461
, , s., d.rank=Inf
-
 
462
 
-
 
463
                   two.sided    less greater
-
 
464
n_1.(pseudo)median   1.0e-09 1.0e-09 1.0e-09
-
 
465
n_2.(pseudo)median   5.0e-01 5.0e-01 5.0e-01
-
 
466
n_3.(pseudo)median   1.0e+00 1.0e+00 1.0e+00
-
 
467
n_4.(pseudo)median   1.5e+00 1.5e+00 1.5e+00
-
 
468
n_5.(pseudo)median   2.0e+00 2.0e+00 2.0e+00
-
 
469
 
-
 
470
, , s0, d.rank=20
-
 
471
 
-
 
472
                   two.sided less greater
-
 
473
n_1.(pseudo)median       0.0  0.0     0.0
-
 
474
n_2.(pseudo)median       0.5  0.5     0.5
-
 
475
n_3.(pseudo)median       1.0  1.0     1.0
-
 
476
n_4.(pseudo)median       1.5  1.5     1.5
-
 
477
n_5.(pseudo)median       2.0  2.0     2.0
-
 
478
 
-
 
479
, , s., d.rank=20
-
 
480
 
-
 
481
                   two.sided    less greater
-
 
482
n_1.(pseudo)median   1.0e-09 1.0e-09 1.0e-09
-
 
483
n_2.(pseudo)median   5.0e-01 5.0e-01 5.0e-01
-
 
484
n_3.(pseudo)median   1.0e+00 1.0e+00 1.0e+00
-
 
485
n_4.(pseudo)median   1.5e+00 1.5e+00 1.5e+00
-
 
486
n_5.(pseudo)median   2.0e+00 2.0e+00 2.0e+00
-
 
487
 
-
 
488
, , s0, d.rank=15
-
 
489
 
-
 
490
                   two.sided less greater
-
 
491
n_1.(pseudo)median       0.0  0.0     0.0
-
 
492
n_2.(pseudo)median       0.5  0.5     0.5
-
 
493
n_3.(pseudo)median       1.0  1.0     1.0
-
 
494
n_4.(pseudo)median       1.5  1.5     1.5
-
 
495
n_5.(pseudo)median       2.0  2.0     2.0
-
 
496
 
-
 
497
, , s., d.rank=15
-
 
498
 
-
 
499
                   two.sided    less greater
-
 
500
n_1.(pseudo)median   1.0e-09 1.0e-09 1.0e-09
-
 
501
n_2.(pseudo)median   5.0e-01 5.0e-01 5.0e-01
-
 
502
n_3.(pseudo)median   1.0e+00 1.0e+00 1.0e+00
-
 
503
n_4.(pseudo)median   1.5e+00 1.5e+00 1.5e+00
-
 
504
n_5.(pseudo)median   2.0e+00 2.0e+00 2.0e+00
-
 
505
 
-
 
506
, , s0, d.rank=10
-
 
507
 
-
 
508
                   two.sided less greater
-
 
509
n_1.(pseudo)median       0.0  0.0     0.0
-
 
510
n_2.(pseudo)median       0.5  0.5     0.5
-
 
511
n_3.(pseudo)median       1.0  1.0     1.0
-
 
512
n_4.(pseudo)median       1.5  1.5     1.5
-
 
513
n_5.(pseudo)median       2.0  2.0     2.0
-
 
514
 
-
 
515
, , s., d.rank=10
-
 
516
 
-
 
517
                   two.sided    less greater
-
 
518
n_1.(pseudo)median   1.0e-09 1.0e-09 1.0e-09
-
 
519
n_2.(pseudo)median   5.0e-01 5.0e-01 5.0e-01
-
 
520
n_3.(pseudo)median   1.0e+00 1.0e+00 1.0e+00
-
 
521
n_4.(pseudo)median   1.5e+00 1.5e+00 1.5e+00
-
 
522
n_5.(pseudo)median   2.0e+00 2.0e+00 2.0e+00
-
 
523
 
-
 
524
, , s0, d.rank=7
-
 
525
 
-
 
526
                   two.sided less greater
-
 
527
n_1.(pseudo)median       0.0  0.0     0.0
-
 
528
n_2.(pseudo)median       0.5  0.5     0.5
-
 
529
n_3.(pseudo)median       1.0  1.0     1.0
-
 
530
n_4.(pseudo)median       1.5  1.5     1.5
-
 
531
n_5.(pseudo)median       2.0  2.0     2.0
-
 
532
 
-
 
533
, , s., d.rank=7
-
 
534
 
-
 
535
                   two.sided    less greater
-
 
536
n_1.(pseudo)median   1.0e-09 1.0e-09 1.0e-09
-
 
537
n_2.(pseudo)median   5.0e-01 5.0e-01 5.0e-01
-
 
538
n_3.(pseudo)median   1.0e+00 1.0e+00 1.0e+00
-
 
539
n_4.(pseudo)median   1.5e+00 1.5e+00 1.5e+00
-
 
540
n_5.(pseudo)median   2.0e+00 2.0e+00 2.0e+00
-
 
541
 
-
 
542
, , s0, d.rank=5
-
 
543
 
-
 
544
                   two.sided less greater
-
 
545
n_1.(pseudo)median       0.0  0.0     0.0
-
 
546
n_2.(pseudo)median       0.5  0.5     0.5
-
 
547
n_3.(pseudo)median       1.0  1.0     1.0
-
 
548
n_4.(pseudo)median       1.5  1.5     1.5
-
 
549
n_5.(pseudo)median       2.0  2.0     2.0
-
 
550
 
-
 
551
, , s., d.rank=5
-
 
552
 
-
 
553
                   two.sided    less greater
-
 
554
n_1.(pseudo)median   1.0e-09 1.0e-09 1.0e-09
-
 
555
n_2.(pseudo)median   5.0e-01 5.0e-01 5.0e-01
-
 
556
n_3.(pseudo)median   1.0e+00 1.0e+00 1.0e+00
-
 
557
n_4.(pseudo)median   1.5e+00 1.5e+00 1.5e+00
-
 
558
n_5.(pseudo)median   2.0e+00 2.0e+00 2.0e+00
-
 
559
 
-
 
560
> str(aEst)
-
 
561
 num [1:5, 1:3, 1:2, 1:6] 0 0.5 1 1.5 2 0 0.5 1 1.5 2 ...
-
 
562
 - attr(*, "dimnames")=List of 4
-
 
563
  ..$ : chr [1:5] "n_1.(pseudo)median" "n_2.(pseudo)median" "n_3.(pseudo)median" "n_4.(pseudo)median" ...
-
 
564
  ..$ : chr [1:3] "two.sided" "less" "greater"
-
 
565
  ..$ : chr [1:2] "s0" "s."
-
 
566
  ..$ : chr [1:6] "d.rank=Inf" "d.rank=20" "d.rank=15" "d.rank=10" ...
-
 
567
>  ## num [1:5, 1:3, 1:2, 1:6] 0 0.5 1 1.5 2 0 0.5 1 1.5 2 ...
-
 
568
>  ## - attr(*, "dimnames")=List of 4
-
 
569
>  ##  ..$ : chr [1:5] "n_1.(pseudo)median" "n_2.(pseudo)median" "n_3.(pseudo)median" "n_4.(pseudo)median" ...
-
 
570
>  ##  ..$ : chr [1:3] "two.sided" "less" "greater"
-
 
571
>  ##  ..$ : chr [1:2] "s0" "s."
-
 
572
>  ##  ..$ : chr [1:6] "d.rank=Inf" "d.rank=20" "d.rank=15" "d.rank=10" ...
-
 
573
> 
-
 
574
> ## Confidence Interval :
-
 
575
> ## c)  C.I. extraction
-
 
576
> CI <- stR[["conf.int"]]
-
 
577
> str(CI, max.level = 2)
-
 
578
List of 6
-
 
579
 $ d.rank=Inf:List of 2
-
 
580
  ..$ s0:List of 3
-
 
581
  ..$ s.:List of 3
-
 
582
 $ d.rank=20 :List of 2
-
 
583
  ..$ s0:List of 3
-
 
584
  ..$ s.:List of 3
-
 
585
 $ d.rank=15 :List of 2
-
 
586
  ..$ s0:List of 3
-
 
587
  ..$ s.:List of 3
-
 
588
 $ d.rank=10 :List of 2
-
 
589
  ..$ s0:List of 3
-
 
590
  ..$ s.:List of 3
-
 
591
 $ d.rank=7  :List of 2
-
 
592
  ..$ s0:List of 3
-
 
593
  ..$ s.:List of 3
-
 
594
 $ d.rank=5  :List of 2
-
 
595
  ..$ s0:List of 3
-
 
596
  ..$ s.:List of 3
-
 
597
>
-
 
598
> if(FALSE) { # printing chCI below is much nicer
-
 
599
+   str(aCI <- simplify2array(lapply(CI,
-
 
600
+                      function(A) simplify2array(lapply(A,
-
 
601
+                              function(B) simplify2array(lapply(B,
-
 
602
+                                         function(C) t(simplify2array(C)))))))))
-
 
603
+   ##  num [1:5, 1:2, 1:3, 1:2, 1:6] 0 0 0 0 0 ...
-
 
604
+   ## - attr(*, "dimnames")=List of 5
-
 
605
+   ##  ..$ : chr [1:5] "n_1" "n_2" "n_3" "n_4" ...
-
 
606
+   ##  ..$ : NULL
-
 
607
+   ##  ..$ : chr [1:3] "two.sided" "less" "greater"
-
 
608
+   ##  ..$ : chr [1:2] "s0" "s."
-
 
609
+   ##  ..$ : chr [1:6] "d.rank=Inf" "d.rank=20" "d.rank=15" "d.rank=10" ...
-
 
610
+   aCI # has *lost* the conf.level which is varying !!
-
 
611
+ }
202
> 
612
> 
203
> ## a) P-value
-
 
204
> pv <- stR[["p.value"]]
-
 
205
> ## only the first is NaN, all others in [0,1]:
-
 
206
> sapply(pv$s0, unlist)
-
 
207
     two.sided less greater
-
 
208
[1,]     1.000    1  1.0000
-
 
209
[2,]     1.000    1  0.5000
-
 
210
[3,]     0.500    1  0.2500
-
 
211
[4,]     0.250    1  0.1250
-
 
212
[5,]     0.125    1  0.0625
-
 
213
> sapply(pv$s., unlist) # not really close, but ..
-
 
214
     two.sided less greater
-
 
215
[1,]    1.0000    1 0.50000
-
 
216
[2,]    0.5000    1 0.25000
-
 
217
[3,]    0.2500    1 0.12500
-
 
218
[4,]    0.1250    1 0.06250
-
 
219
[5,]    0.0625    1 0.03125
-
 
220
> 
-
 
221
> pv$s0$two.sided[1] <-  1 ## artificially
-
 
222
> stopifnot(all.equal(pv$s0, pv$s., tolerance = 0.5 + 1e-6), # seen 0.5
-
 
223
+ 	  ## "less" are close:
-
 
224
+ 	  all.equal(unlist(pv[[c("s0","less")]]),
-
 
225
+ 		    unlist(pv[[c("s.","less")]]),
-
 
226
+                     tolerance = 0.03),
-
 
227
+ 	  0 <= unlist(pv), unlist(pv) <= 1) # <- no further NA ..
-
 
228
> ## b)
-
 
229
> sapply(stR[["statistic"]], unlist)
-
 
230
            s0 s.
-
 
231
two.sided.V  0  1
-
 
232
two.sided.V  2  3
-
 
233
two.sided.V  5  6
-
 
234
two.sided.V  9 10
-
 
235
two.sided.V 14 15
-
 
236
less.V       0  1
-
 
237
less.V       2  3
-
 
238
less.V       5  6
-
 
239
less.V       9 10
-
 
240
less.V      14 15
-
 
241
greater.V    0  1
-
 
242
greater.V    2  3
-
 
243
greater.V    5  6
-
 
244
greater.V    9 10
-
 
245
greater.V   14 15
-
 
246
> ## Conf.int.:
-
 
247
> ## c)
-
 
248
> sapply(stR[["estimate" ]], unlist)
-
 
249
                          s0      s.
-
 
250
two.sided.(pseudo)median 0.0 1.0e-09
-
 
251
two.sided.(pseudo)median 0.5 5.0e-01
-
 
252
two.sided.(pseudo)median 1.0 1.0e+00
-
 
253
two.sided.(pseudo)median 1.5 1.5e+00
-
 
254
two.sided.(pseudo)median 2.0 2.0e+00
-
 
255
less.(pseudo)median      0.0 1.0e-09
-
 
256
less.(pseudo)median      0.5 5.0e-01
-
 
257
less.(pseudo)median      1.0 1.0e+00
-
 
258
less.(pseudo)median      1.5 1.5e+00
-
 
259
less.(pseudo)median      2.0 2.0e+00
-
 
260
greater.(pseudo)median   0.0 1.0e-09
-
 
261
greater.(pseudo)median   0.5 5.0e-01
-
 
262
greater.(pseudo)median   1.0 1.0e+00
-
 
263
greater.(pseudo)median   1.5 1.5e+00
-
 
264
greater.(pseudo)median   2.0 2.0e+00
-
 
265
> ## d) confidence interval
613
> ## d) confidence interval __printing__
266
> formatCI <- function(ci)
614
> formatCI <- function(ci)
267
+     sprintf("[%g, %g] (%g%%)", ci[[1]], ci[[2]],
615
+     sprintf("[%g, %g] (%g%%)", ci[[1]], ci[[2]],
268
+ 	    round(100*attr(ci,"conf.level")))
616
+ 	    round(100*attr(ci,"conf.level")))
269
> nx <- length(x0)
617
> nx <- length(x0)
-
 
618
> Fval <- array("", dim = c(nx, length(alts), length(x.set)))
270
> noquote(vapply(stR[["conf.int"]], function(ss)
619
> (chCI <- noquote(vapply(CI, function(D)
-
 
620
+     vapply(D, function(ss)
271
+     vapply(ss, function(alt) vapply(alt, formatCI, ""), character(nx)),
621
+         vapply(ss, function(alt) vapply(alt, formatCI, ""), character(nx)),
272
+     matrix("", nx, length(alts))))
622
+         Fval[,,1]),
-
 
623
+     Fval)
273
, , s0
624
+     ))
-
 
625
, , s0, d.rank=Inf
-
 
626
 
-
 
627
    two.sided       less               greater
-
 
628
n_1 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
629
n_2 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
630
n_3 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
631
n_4 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
632
n_5 [0, Inf] (100%) [-Inf, 4] (100%)   [0.5, Inf] (97%)
-
 
633
 
-
 
634
, , s., d.rank=Inf
-
 
635
 
-
 
636
    two.sided          less               greater
-
 
637
n_1 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
638
n_2 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
639
n_3 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
640
n_4 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
641
n_5 [-Inf, Inf] (100%) [-Inf, 4] (97%)    [1e-09, Inf] (97%)
-
 
642
 
-
 
643
, , s0, d.rank=20
274
 
644
 
275
     two.sided       less               greater         
645
    two.sided       less               greater
276
[1,] [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%) 
646
n_1 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
277
[2,] [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%) 
647
n_2 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
278
[3,] [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%) 
648
n_3 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
279
[4,] [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%) 
649
n_4 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
280
[5,] [0, Inf] (100%) [-Inf, 4] (100%)   [0.5, Inf] (97%)
650
n_5 [0, Inf] (100%) [-Inf, 4] (100%)   [0.5, Inf] (97%)
281
 
651
 
282
, , s.
652
, , s., d.rank=20
283
 
653
 
284
     two.sided          less               greater           
654
    two.sided          less               greater
-
 
655
n_1 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
285
[1,] [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
656
n_2 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
657
n_3 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
658
n_4 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
659
n_5 [-Inf, Inf] (100%) [-Inf, 4] (97%)    [1e-09, Inf] (97%)
-
 
660
 
-
 
661
, , s0, d.rank=15
-
 
662
 
-
 
663
    two.sided       less               greater
-
 
664
n_1 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
665
n_2 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
666
n_3 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
667
n_4 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
668
n_5 [0, Inf] (100%) [-Inf, 4] (100%)   [0.5, Inf] (97%)
-
 
669
 
-
 
670
, , s., d.rank=15
-
 
671
 
-
 
672
    two.sided          less               greater
-
 
673
n_1 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
674
n_2 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
675
n_3 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
676
n_4 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
677
n_5 [-Inf, Inf] (100%) [-Inf, 4] (97%)    [1e-09, Inf] (97%)
-
 
678
 
-
 
679
, , s0, d.rank=10
-
 
680
 
-
 
681
    two.sided       less               greater
-
 
682
n_1 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
683
n_2 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
684
n_3 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
685
n_4 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
686
n_5 [0, Inf] (100%) [-Inf, 4] (100%)   [0.5, Inf] (97%)
-
 
687
 
-
 
688
, , s., d.rank=10
-
 
689
 
-
 
690
    two.sided          less               greater
-
 
691
n_1 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
286
[2,] [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
692
n_2 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
287
[3,] [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
693
n_3 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
288
[4,] [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
694
n_4 [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
289
[5,] [-Inf, Inf] (100%) [-Inf, 4] (97%)    [1e-09, Inf] (97%)
695
n_5 [-Inf, Inf] (100%) [-Inf, 4] (97%)    [1e-09, Inf] (97%)
-
 
696
 
-
 
697
, , s0, d.rank=7
-
 
698
 
-
 
699
    two.sided       less               greater
-
 
700
n_1 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
701
n_2 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
702
n_3 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
703
n_4 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
704
n_5 [0, Inf] (100%) [-Inf, 4] (100%)   [0.5, Inf] (97%)
-
 
705
 
-
 
706
, , s., d.rank=7
-
 
707
 
-
 
708
    two.sided           less               greater
-
 
709
n_1 [-Inf, Inf] (100%)  [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
710
n_2 [1e-09, Inf] (100%) [-Inf, Inf] (100%) [1e-09, Inf] (100%)
-
 
711
n_3 [1e-09, Inf] (100%) [-Inf, Inf] (100%) [1e-09, Inf] (100%)
-
 
712
n_4 [1e-09, Inf] (100%) [-Inf, Inf] (100%) [1e-09, Inf] (100%)
-
 
713
n_5 [1e-09, Inf] (100%) [-Inf, 4] (100%)   [0.5, Inf] (97%)
-
 
714
 
-
 
715
, , s0, d.rank=5
-
 
716
 
-
 
717
    two.sided       less               greater
-
 
718
n_1 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
719
n_2 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
720
n_3 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
721
n_4 [0, Inf] (100%) [-Inf, Inf] (100%) [0, Inf] (100%)
-
 
722
n_5 [0, Inf] (100%) [-Inf, 4] (100%)   [0.5, Inf] (97%)
-
 
723
 
-
 
724
, , s., d.rank=5
-
 
725
 
-
 
726
    two.sided           less               greater
-
 
727
n_1 [-Inf, Inf] (100%)  [-Inf, Inf] (100%) [-Inf, Inf] (100%)
-
 
728
n_2 [1e-09, Inf] (100%) [-Inf, Inf] (100%) [1e-09, Inf] (100%)
-
 
729
n_3 [1e-09, Inf] (100%) [-Inf, Inf] (100%) [1e-09, Inf] (100%)
-
 
730
n_4 [1e-09, Inf] (100%) [-Inf, Inf] (100%) [1e-09, Inf] (100%)
-
 
731
n_5 [1e-09, Inf] (100%) [-Inf, 4] (100%)   [0.5, Inf] (97%)
290
 
732
 
291
> 
733
>
292
> 
734
>
293
> ##-------- 2-sample tests (working unchanged) ------------------
735
> ##-------- 2-sample tests (working unchanged) ------------------
294
> 
736
>
295
> R2 <- lapply(alts, ## for all three alternatives
737
> R2 <- lapply(alts, ## for all three alternatives
296
+              function(alt)
738
+              function(alt)
297
+                  lapply(seq_along(x0), function(k)
739
+                  lapply(seq_along(x0), function(k)
298
+                          wilcox.test(x = x.set$s0[[k]], y = x.set$s.[[k]],
740
+                          wilcox.test(x = x.set$s0[[k]], y = x.set$s.[[k]],
299
+                                      exact=TRUE, conf.int=TRUE, alternative = alt)))
741
+                                      exact=TRUE, conf.int=TRUE, alternative = alt)))
300
> length(w2 <- warnings()) # 27
742
> length(w2 <- warnings()) # 1  (was '27')
301
[1] 1
743
[1] 1
302
> unique(w2) # 3 different ones
744
> if(!identical(w2, w1)) # typically they *are* identical ==> no new warnings
303
Warning message:
745
+     summary(w2)
304
In ks.test.default(round(ds2, 1), "pnorm", exact = TRUE) :
-
 
305
  ties should not be present for the one-sample Kolmogorov-Smirnov test
-
 
306
> 
746
>
-
 
747
>
307
> table(uc2 <- unlist(c2 <- lapply(R2, function(A) lapply(A, class))))
748
> table(uc2 <- unlist(c2 <- lapply(R2, function(A) lapply(A, class))))
308
 
749
 
309
htest 
750
htest
310
   15 
751
   15
311
> stopifnot(uc2 == "htest")
752
> stopifnot(uc2 == "htest")
312
> 
753
>
313
> stR2 <- lapply(stats,
754
> stR2 <- lapply(stats,
314
+                function(COMP)
755
+                function(COMP)
315
+                    lapply(R2, function(A) lapply(A, getC, C=COMP)))
756
+                    lapply(R2, function(A) lapply(A, `[[`, COMP)))
316
> 
757
>
317
> lapply(stats[-3], ## -3: "conf.int" separately
758
> lapply(stats[-3], ## -3: "conf.int" separately
318
+        function(ST) sapply(stR2[[ST]], unlist))
759
+        function(ST) sapply(stR2[[ST]], unlist))
319
$statistic
760
$statistic
320
  two.sided less greater
761
  two.sided less greater
321
W       0.0  0.0     0.0
762
W       0.0  0.0     0.0
Line 338... Line 779...
338
difference in location    -5e-10 -5e-10  -5e-10
779
difference in location    -5e-10 -5e-10  -5e-10
339
difference in location     0e+00  0e+00   0e+00
780
difference in location     0e+00  0e+00   0e+00
340
difference in location     0e+00  0e+00   0e+00
781
difference in location     0e+00  0e+00   0e+00
341
difference in location     0e+00  0e+00   0e+00
782
difference in location     0e+00  0e+00   0e+00
342
 
783
 
343
> 
784
>
344
> noquote(sapply(stR2[["conf.int"]], function(.) vapply(., formatCI, "")))
785
> noquote(sapply(stR2[["conf.int"]], function(.) vapply(., formatCI, "")))
345
     two.sided          less               greater           
786
     two.sided          less               greater
346
[1,] [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
787
[1,] [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
347
[2,] [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
788
[2,] [-Inf, Inf] (100%) [-Inf, Inf] (100%) [-Inf, Inf] (100%)
348
[3,] [-Inf, Inf] (100%) [-Inf, 2] (100%)   [-2, Inf] (100%)  
789
[3,] [-Inf, Inf] (100%) [-Inf, 2] (100%)   [-2, Inf] (100%)
349
[4,] [-3, 3] (100%)     [-Inf, 2] (97%)    [-2, Inf] (97%)   
790
[4,] [-3, 3] (100%)     [-Inf, 2] (97%)    [-2, Inf] (97%)
350
[5,] [-3, 3] (96%)      [-Inf, 2] (95%)    [-2, Inf] (97%)   
791
[5,] [-3, 3] (96%)      [-Inf, 2] (95%)    [-2, Inf] (97%)
351
> 
792
>
352
> 
793
>
353
> proc.time()
794
> proc.time()
354
   user  system elapsed 
795
   user  system elapsed 
355
  0.237   0.012   0.240 
796
  0.544   0.273   0.981