Skip to content

question about sign test

2 messages · T Bal, Joshua Wiley

#
Hi,

That seems a reasonable enough approach to me.

(p <- pnorm(0, mean = 1, sd = .5))

is the probability of a value being less than or up to 0 from the
distribution you specified.  Using that, lets repeat your little test
1000 times using your code, and then using ribnom() where the
probability that a value is 1 is 1 - p (i.e., if p is the probability
<= 0, then 1 - p is the probability of > 0).

res1 <- replicate(1000, binom.test(sum(rnorm(15, 1, 0.5) > 0), 15, p =
0.5, alternative="two")$p.value)

res2 <- replicate(1000, binom.test(sum(rbinom(15, 1, 1 - p)), 15, p =
0.5, alternative="two")$p.value)

now we can look at the average p-value from both techniques:

mean(res1)
mean(res2)

they are quite similar.  I ran each of them with 100,000 replicates
for stability and got:
[1] 0.0007627936
[1] 0.0007608844

I hope this helps,

Josh
On Sun, May 20, 2012 at 9:34 AM, T Bal <studenttbal at gmail.com> wrote: