Is a pair of null hypothesis and alternative hypothesis always complementary? Is a pair of null hypothesis and alternative hypothesis always complementary? If not, when are they usually not complementary?
 A: I have been having the same question, too. The part confuses me is that in many places I saw that $H_0$ and $H_a$ are not complementary, e.g., $H_0$: $\mu$ = 0, $H_a$: $\mu$ < 0, rather than $H_0$: $\mu$ >= 0, $H_a$: $\mu$ < 0,
After going through some searches, my current understanding is that $H_0$ and $H_a$ should be complementary for hypothesis testing to work (otherwise, $H_a$ is not the only alternative to $H_0$, and rejecting $H_0$ doesn't mean we can accept $H_a$). But we only need to calculate test statistic under the assumption when null hypothesis takes the equal sign (in previous example, that is when $\mu$ = 0).
You can refer to this lecture note. At the same time, below is my take to clarify my point using an example.

Clarification with an example
Suppose we want to test if a coin is biased towards head, then $H_a$ in this case should be "Probability of head, $\theta$, is greater than 0.5". Since this is a one sided test, then $H_0$ should be "Probability of head, $\theta$, is less than or equal to 0.5". In math expressions:
$$
H_0: \theta <= 0.5\\
H_a: \theta > 0.5
$$
The next step is to:


*

*Suppose $H_0$ is true.

*Pick and calculates the test statistic under the assumption of $H_0$ being true, e.g., x.


*

*Test statistic is the number of heads in 100 throws.


*Calculates the probability that test statistic is at least as extreme as x.


*

*In this case "extreme" means only values that are too large, since null hypothesis assumes that coin is less likely to show head.



When $H_0$ is true, this means that $\theta$ can be 0.5, 0.49, 0.3, or any value that's less than/equal to 0.5. If that's the case, doesn't that mean we should calculate not one but many test statistics? My understanding is yes. However, we don't really need to calculate all the test statistics to determine what is extreme. We can illustrate it by plotting the density curves with a few different parameters.
df.l1.e1 = 
  data.frame(x1=1:100,
             d1=dbinom(1:100, 100, prob = 0.5),
             d2=dbinom(1:100, 100, prob = 0.45),
             d3=dbinom(1:100, 100, prob = 0.4),
             d4=dbinom(1:100, 100, prob = 0.35),
             d5=dbinom(1:100, 100, prob = 0.3)) %>%
  gather(key = "scenario", value = "density", -x1)

p1 = ggplot(df.l1.e1, aes(x1, density, color = scenario)) + 
  geom_line() + geom_point() +
  geom_vline(xintercept = qbinom(1-0.05,100,0.5))

p1


The 5 different curves represents 5 differnt density functions of a binomial distribution. They have the same sample size (100), but different probability of success. The vertical line shows the critical value (in this case 58) for d1 scenario. It means under d1 scenario, the probability of getting heads 58 or more times (i.e., at least as extreme as 58) is 5%.
As $\theta$ gets smaller, the density function moves more and more to the left. This means that the critial values for scenrarios, d2, d3, etc. will be smaller than 58. In other words, 58 is considered an extreme event for all these scenarios. Now we can see that if test statistic is 58 or more, then no matter what value $\theta$ takes, as long as it's less than/equal to 0.5, the test result will be an extreme event.
If the test statistic is, for example, 57, then we cannot reject $H_0$, because although under d2, d3... scenarios the result is extreme, it is not extreme when under d1 scenario. As a result, we cannot reject $H_0$.
So based on my current understaning, $H_0$ and $H_a$ should be complementary for one-sided test, but we only need to calculate test statistic under the assumption when null hypothesis takes the equal sign.
