Skip to contents

Ties at md carry no information and are discarded, so the effective n is returned rather than the input length.

Usage

Sgntest(x, md = 0)

Arguments

x

The sample.

md

Null median.

Value

List with statistic, p_value, n_effective, n_ties, estimate, n.

Details

Formula: S = #{x_i > md}, m = #{x_i != md}; S ~ Binomial(m, 1/2) under H0; two-sided p = 2 P(Bin(m, 1/2) >= max(S, m - S)), capped at 1

References

Dixon & Mood (1946), Journal of the American Statistical Association 41(236), 557-566 – the primary source. Wasserman (2004), All of Statistics, does not contain the sign test.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Sgntest(V)
#> $statistic
#> [1] 8
#> 
#> $p_value
#> [1] 0.0078125
#> 
#> $n_effective
#> [1] 8
#> 
#> $n_ties
#> [1] 0
#> 
#> $estimate
#> [1] 4.5
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Exact sign test, Binomial(m, 1/2)"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"