binom.test(x, n, p=0.5, alternative="two.sided")
"two.sided"
(not equal to
p
),
"less"
(less than
p
) or
"greater"
(greater than
p
).
class
attribute
"htest"
,
representing the result of binomial test:
The exact probabilities are computed for the binomial distribution.
The probability of success is equal to
p
.
x
is the number of successes out of
n
independent trials, each with the
same probability of success.
Conover, W. J. (1980). Practical Nonparametric Statistics, 2nd ed. Wiley, New York.
x <- rnorm(100) y <- sum(x>0) binom.test(y, 100) # median == 0 ? y <- rnorm(100) d <- x - y binom.test(sum(d>0),length(d)) # sign test