# Some questions about single sample sign test

$$S^+$$ : number of values greater than the median.

$$S^-$$ : number of values less than the median.

Question 1

For the given hypothesis and sample size, state whether the null hypothesis should be rejected at the 5% significance level

$$H_0:$$ median = k

$$H_1:$$ median < k

$$n=8$$ and $$S^+= 3$$.

## My work for Question 1:

$$X$$ : number of values, out of 8, greater than median.

$$X \sim B (8,0.5)$$

$$P(X \le 3)=0.5^8\sum _{r=0}^{3}8Cr=0.363$$.

Since the test statistic ($$=3$$) is not within rejection region, we do not reject null hypothesis.

Is this the correct way to do this question?

Here's another question where I used the above method but got the incorrect answer :

Question 2

For the given hypothesis and sample size, state whether the null hypothesis should be rejected at the 5% significance level

$$H_0:$$ median = k

$$H_1:$$ median > k

$$n=15$$ and $$S^+= 11$$.

## My work for Question 2:

$$X$$ : number of values, out of 15, greater than median.

$$X \sim B (15,0.5)$$ $$P(X \ge 11)=0.5^{15}\sum _{r=11}^{15}15Cr=0.059$$.

Since the test statistic ($$=11$$) is not within rejection region, we do not reject null hypothesis.

However, according to the answer sheet, my answer for question 2 is incorrect. Null hypothesis should have been rejected.

Where did I mess up?

1. Would the procedure/conclusion change if we were told instead that $$S^-=3$$ for first question and $$S^-=11$$ for the second question?
2. If $$H_1$$: median $$>k$$ and $$s^+, on which tail do I place the rejection region?

After doing some research on the topic, I managed to clear my doubts.

Here are some notes/examples which helped me a lot :

https://online.stat.psu.edu/stat415/lesson/20/20.1

https://en.wikipedia.org/wiki/Sign_test

For question 1, my answer/method is correct. However, there was no need to carry out calculations. If null hypothesis is true, we expect half of the number of values to be less than median and half of the number of values to be greater than median. Now, if $$H_1$$ was true, we expect $$S^+>n/2 \implies P(X\ge S^+)>0.5 > 0.05.$$ Graphically this means that $$S^+$$ lies before $$n/2$$ and outside rejection region.

$$\therefore H_1$$ cannot be true $$\implies$$ do not reject $$H_o$$

For question 2, I still think that my answer/method is correct.

$$H_0$$: median = k

$$H_1$$: median < k

$$n=8$$ and $$S^-=3$$.

Again, no calculations are required here. If $$H_1$$ was true, we would have expected more values smaller than median, i.e, $$S^->n/2 \implies P(X\ge S^-)>0.5 > 0.05.$$ Graphically this means that $$S^-$$ lies before $$n/2$$ and outside rejection region.

Let's try a 'normal' question which requires calculation.

$$H_0$$: median = k

$$H_1$$: median < k

$$n=8$$ and $$S^-=5$$. Significance level 5%

X: number of values, out of 5, less than median

$$P(X\ge 5| X \sim B(8,0.5))=0.36328>0.05$$

Do not reject $$H_o$$

Here's a diagram that illustrates this question.

If $$H1$$: median > k and $$s+, on which tail do I place the rejection region?

Rejection region is on the right. But here also no calculation is required because $$S^+$$ will be on the left.

Notes to myself:

• Ask yourself what is expected if $$H_1$$ is true?
• Draw the binomial distribution of $$X$$, the number of values less/greater than median, to better understand what is happening.

If I made any mistakes, please let me know as I am still learning.

• If $S^{+}=S^{-}$, How to calculate the p-value? Commented Sep 22, 2022 at 22:42
• We do not actually care how $S^+$ compares with $S^-$ when calculating the p-value. For a given binomial distribution $X \sim (n,p)$, we can calculate the p-value using the binomial distribution formula. Commented Sep 23, 2022 at 8:27
• I wonder the correct formula for calculating p-value. I was trouble by the following problem: Suppose we have a sample size of 12 and 6 values are below our hypothesized median of mxand 6 are above. In two-tailed test, according to the formula,we get the p-value :$2\sum_{i=0}^6\tbinom{12}{i}(\frac{1}{2})^n$, which is greater than 1. Commented Sep 23, 2022 at 9:57
• @mathbeginner You are not supposed to multiply by 2. In your case, you should calculate only the sum of probabilities for left-tail. Commented Sep 24, 2022 at 6:58
• If we Assume $H_0：Me=M0, H_1:Me\neq M0$, it was a 2-tailed test, why we only calculate the sum of probabilities fir left tail? Commented Sep 24, 2022 at 11:23