Let $Y_1,...,Y_n$ $(n>2)$ be independent observations from a normal distribution with an unknown variance $\sigma^2$. The first $n-1$ observations are known to be from the same normal distribution but before the last observation, it is suspected that the mean of the observations has changed. What is the linear model of this situation? What is the F-test for the situation for which the hypothesis is that observation $n$ is from the same normal distribution as the first $n-1$ observations?
My solution so far:
$Y_1,...,Y_n\sim N(\mu_p,\sigma^2)$, $p=1,2$
Now the matrix form of the situation is
$$\begin{bmatrix} Y_1 \\ Y_2 \\ \vdots \\ Y_{n-1} \\ Y_n\end{bmatrix}=\begin{bmatrix}1 & 0 & 0 & \cdots & 0 \\ 0 & 1 & 0 & \cdots & 0 \\ \vdots & \vdots & \ddots & \cdots & 0 \\ 0 & 0 & 0 & \cdots & 1 \end{bmatrix} \begin{bmatrix} \mu_1 \\ \mu_1 \\ \vdots \\ \mu_2 \end{bmatrix}+\epsilon, \quad \epsilon\sim N(0, I\sigma^2).$$
Does this seem correct? I also don't know write out the hypothesis in a way I can form an F-test out of it.
Define $D_i=1\{i=n\}$. Then the corresponding regression model is $$ Y_i=\mu+\gamma D_i+\varepsilon_i, \quad \varepsilon_i\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,\sigma^2). $$ Testing the mentioned hypothesis is equivalent to testing $H_0:\gamma=0$ vs. $H_1:\gamma\ne 0$.