signtest_pvalue: p-value for a one sample sign test

View source: R/signtest_pvalue.R

signtest_pvalueR Documentation

p-value for a one sample sign test

Description

p-value for a one sample sign test based on the binomial distribution.

Usage

signtest_pvalue(x, alternative = "two.sided", theta0 = 0, ...)

Arguments

x

number vector.

alternative

type of alternative hypothesis

theta0

null value of the parameter

...

optional arguments. currently ignored.

Details

Returns p-value using the binomial distribution.

Value

a numeric scalar — the p-value — is returned

Author(s)

John Kloke, Joseph McKean

References

Kloke, J. and McKean, J.W. (2014), Nonparametric statistical methods using R, Boca Raton, FL: Chapman-Hall.

Examples

x <- round(rt(19,9) + 2,1)
signtest_pvalue(x,alternative='greater')
S <- sum(x > 0)
M <- sum(x != 0)
1-pbinom(S-1,M,0.5)
x <- round(rt(19,9) + 0,1)
signtest_pvalue(x)
S <- sum(x > 0)
M <- sum(x != 0)
2*min(pbinom(S,M,0.5), 1-pbinom(S-1,M,0.5))

npsm documentation built on Nov. 15, 2023, 1:08 a.m.