Skip to content

Commit 75d8afd

Browse files
author
hornik
committed
Updated.
git-svn-id: https://svn.r-project.org/R/trunk@88742 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 5cbbc0c commit 75d8afd

File tree

2 files changed

+46
-36
lines changed

2 files changed

+46
-36
lines changed

src/library/stats/tests/ks-test.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ sapply(pv$s0, unlist)
7272
sapply(pv$s., unlist) # not really close, but ..
7373

7474
pv$s0$two.sided[1] <- 1 ## artificially
75-
stopifnot(all.equal(pv$s0, pv$s., tol = 0.5 + 1e-6), # seen 0.5
75+
stopifnot(all.equal(pv$s0, pv$s., tolerance = 0.5 + 1e-6), # seen 0.5
7676
## "less" are close:
7777
all.equal(unlist(pv[[c("s0","less")]]),
78-
unlist(pv[[c("s.","less")]]), tol = 0.03),
78+
unlist(pv[[c("s.","less")]]),
79+
tolerance = 0.03),
7980
0 <= unlist(pv), unlist(pv) <= 1) # <- no further NA ..
8081
## b)
8182
sapply(stR[["statistic"]], unlist)

src/library/stats/tests/ks-test.Rout.save

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
R Under development (unstable) (2023-04-19 r84284) -- "Unsuffered Consequences"
3-
Copyright (C) 2023 The R Foundation for Statistical Computing
4-
Platform: aarch64-apple-darwin22.4.0 (64-bit)
2+
R Under development (unstable) (2025-08-29 r88740) -- "Unsuffered Consequences"
3+
Copyright (C) 2025 The R Foundation for Statistical Computing
4+
Platform: x86_64-pc-linux-gnu
55

66
R is free software and comes with ABSOLUTELY NO WARRANTY.
77
You are welcome to redistribute it under certain conditions.
@@ -170,17 +170,19 @@ $s.[[5]]
170170
+ wilcox.test(x, exact=TRUE, conf.int=TRUE, alternative = alt)
171171
+ ## )
172172
+ )))
173-
There were 52 warnings (use warnings() to see them)
173+
There were 55 warnings (use warnings() to see them)
174174
> length(ww <- warnings()) # 52 (or 43 for x0 <- 0:3)
175-
[1] 52
175+
[1] 55
176176
> unique(ww) # 4 different ones
177177
Warning messages:
178-
1: In wilcox.test.default(x, exact = TRUE, conf.int = TRUE, ... :
179-
cannot compute exact p-value with zeroes
178+
1: cannot compute confidence interval when all observations are zero or tied
180179
2: In wilcox.test.default(x, exact = TRUE, conf.int = TRUE, ... :
180+
cannot compute exact p-value with zeroes
181+
3: In wilcox.test.default(x, exact = TRUE, conf.int = TRUE, ... :
181182
cannot compute exact confidence interval with zeroes
182-
3: cannot compute confidence interval when all observations are zero or tied
183-
4: In wilcox.test.default(x, exact = TRUE, conf.int = TRUE, ... :
183+
4: In .wilcox_test_one_cint_asymp(x, n, alternative, conf.level, ... :
184+
requested conf.level not achievable
185+
5: In .wilcox_test_one_cint_exact(x, n, alternative, conf.level) :
184186
requested conf.level not achievable
185187
>
186188
> cc <- lapply(RR, function(A) lapply(A, function(bb) lapply(bb, class)))
@@ -225,10 +227,11 @@ character(0)
225227
[5,] 0.0625 1 0.03125
226228
>
227229
> pv$s0$two.sided[1] <- 1 ## artificially
228-
> stopifnot(all.equal(pv$s0, pv$s., tol = 0.5 + 1e-6), # seen 0.5
230+
> stopifnot(all.equal(pv$s0, pv$s., tolerance = 0.5 + 1e-6), # seen 0.5
229231
+ ## "less" are close:
230232
+ all.equal(unlist(pv[[c("s0","less")]]),
231-
+ unlist(pv[[c("s.","less")]]), tol = 0.03),
233+
+ unlist(pv[[c("s.","less")]]),
234+
+ tolerance = 0.03),
232235
+ 0 <= unlist(pv), unlist(pv) <= 1) # <- no further NA ..
233236
> ## b)
234237
> sapply(stR[["statistic"]], unlist)
@@ -252,21 +255,21 @@ greater.V 10 15
252255
> ## c)
253256
> sapply(stR[["estimate" ]], unlist)
254257
s0 s.
255-
two.sided1 NaN 1.0e-09
256-
two.sided.midrange 1.0 5.0e-01
257-
two.sided.(pseudo)median 1.5 1.0e+00
258-
two.sided.(pseudo)median 2.0 1.5e+00
259-
two.sided.(pseudo)median 2.5 2.0e+00
260-
less1 NaN 1.0e-09
261-
less.midrange 1.0 5.0e-01
262-
less.(pseudo)median 1.5 1.0e+00
263-
less.(pseudo)median 2.0 1.5e+00
264-
less.(pseudo)median 2.5 2.0e+00
265-
greater1 NaN 1.0e-09
266-
greater.midrange 1.0 5.0e-01
267-
greater.(pseudo)median 1.5 1.0e+00
268-
greater.(pseudo)median 2.0 1.5e+00
269-
greater.(pseudo)median 2.5 2.0e+00
258+
two.sided.midrange 0.0 1.0e-09
259+
two.sided.(pseudo)median 0.5 5.0e-01
260+
two.sided.(pseudo)median 1.0 1.0e+00
261+
two.sided.(pseudo)median 1.5 1.5e+00
262+
two.sided.(pseudo)median 2.0 2.0e+00
263+
less.midrange 0.0 1.0e-09
264+
less.(pseudo)median 0.5 5.0e-01
265+
less.(pseudo)median 1.0 1.0e+00
266+
less.(pseudo)median 1.5 1.5e+00
267+
less.(pseudo)median 2.0 2.0e+00
268+
greater.midrange 0.0 1.0e-09
269+
greater.(pseudo)median 0.5 5.0e-01
270+
greater.(pseudo)median 1.0 1.0e+00
271+
greater.(pseudo)median 1.5 1.5e+00
272+
greater.(pseudo)median 2.0 2.0e+00
270273
> ## d) confidence interval
271274
> formatCI <- function(ci)
272275
+ sprintf("[%g, %g] (%g%%)", ci[[1]], ci[[2]],
@@ -277,12 +280,18 @@ greater.(pseudo)median 2.5 2.0e+00
277280
+ matrix("", nx, length(alts))))
278281
, , s0
279282

280-
two.sided less greater
281-
[1,] [NaN, NaN] (0%) [-Inf, NaN] (0%) [NaN, Inf] (0%)
282-
[2,] [NaN, NaN] (0%) [-Inf, NaN] (0%) [NaN, Inf] (0%)
283-
[3,] [1.5, 1.5] (0%) [-Inf, 1.5] (0%) [1.50001, Inf] (20%)
284-
[4,] [1.00007, 2.99993] (60%) [-Inf, 2.00002] (60%) [1.00009, Inf] (80%)
285-
[5,] [1.00006, 3.99994] (80%) [-Inf, 3.00002] (80%) [1.00009, Inf] (90%)
283+
two.sided less
284+
[1,] [NaN, NaN] (0%) [-Inf, NaN] (0%)
285+
[2,] [0.5, 0.5] (0%) [-Inf, 0.5] (0%)
286+
[3,] [6.57258e-05, 1.99993] (60%) [-Inf, 1.00002] (60%)
287+
[4,] [5.6384e-05, 2.99994] (80%) [-Inf, 2.00002] (80%)
288+
[5,] [0.999997, 3] (80%) [-Inf, 2.99998] (80%)
289+
greater
290+
[1,] [NaN, Inf] (0%)
291+
[2,] [0.500007, Inf] (20%)
292+
[3,] [8.76344e-05, Inf] (80%)
293+
[4,] [9.39734e-05, Inf] (90%)
294+
[5,] [0.999983, Inf] (90%)
286295

287296
, , s.
288297

@@ -307,7 +316,7 @@ There were 27 warnings (use warnings() to see them)
307316
[1] 27
308317
> unique(w2) # 3 different ones
309318
Warning messages:
310-
1: In wilcox.test.default(x = x.set$s0[[k]], y = x.set$s.[[k]], ... :
319+
1: In .wilcox_test_two_cint_exact(x, y, n.x, n.y, alternative, ... :
311320
Requested conf.level not achievable
312321
2: In wilcox.test.default(x = x.set$s0[[k]], y = x.set$s.[[k]], ... :
313322
cannot compute exact p-value with ties
@@ -362,4 +371,4 @@ difference in location 3.741417e-05 3.741417e-05 3.741417e-05
362371
>
363372
> proc.time()
364373
user system elapsed
365-
0.130 0.017 0.145
374+
0.246 0.024 0.250

0 commit comments

Comments
 (0)