$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.
$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?
Some additional questions about single sample sign test :
- Would the procedure/conclusion change if we were told instead that $S^-=3$ for first question and $S^-=11$ for the second question?
- If $H_1$: median $>k$ and $s^+<n/2$, 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.
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.
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.
Rejection region is on the right. But here also no calculation is required because $S^+$ will be on the left.
Notes to myself:
If I made any mistakes, please let me know as I am still learning.