Skip to contents

The p-value is the asymptotic one; it is unreliable for very small samples and for heavily tied data, and ties is returned so a caller can see whether that applies.

Usage

Kstest1(x, y, terms = 200)

Arguments

x, y

The two samples, each of length at least 1.

terms

Terms of the alternating series used for H(t).

Value

List with statistic, scaled, p_value, n1, n2, ties.

Details

Formula: D = sup_x |F1(x) - F2(x)|; t = sqrt(n1 n2/(n1 + n2)) D; p = 1 - H(t) = 2 sum_{j>=1} (-1)^{j-1} exp(-2 j^2 t^2)

References

Wasserman (2004), All of Statistics, Section 15.4 and Theorem 15.12, equation (15.14).

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Kstest1(V, V)
#> $statistic
#> [1] 0
#> 
#> $scaled
#> [1] 0
#> 
#> $p_value
#> [1] 1
#> 
#> $n1
#> [1] 8
#> 
#> $n2
#> [1] 8
#> 
#> $ties
#> [1] 8
#> 
#> $method
#> [1] "Two-sample KS test, Wasserman Theorem 15.12"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"