In the middle of the page here, the author claims that SSE can be broke up into SSLF and SSPE. I.e.
$$\sum_i^c \sum_j^{n_j} (y_{ij} - \hat{y}_{ij})^2 = \sum_i^c \sum_j^{n_j} (\bar{y}_i - \hat{y_{ij}})^2 + \sum_i ^c \sum_j^{n_j}(y_{ij} - \bar{y}_i)^2$$
How can I go about showing this? I've tried expanding the left side, but I think I am missing something.
Note, as a comment here mentions $y_{ik}$ corresponds to the same $x$ value as $y_{ij}$. i.e. the first index $i$ being the same means the $x$-value is the same.
$$ \sum_{i=1}^c \sum_{j=1}^{n_i} (y_{ij} - \hat{y}_{ij})^2 = \sum_{i=1}^c \sum_{j=1}^{n_i} (\bar{y}_i - \widehat y_i)^2 + \sum_{i=1}^c \sum_{j=1}^{n_i}(y_{ij} - \bar{y}_i)^2 $$ Above, I made some corrections:
I have $n_i$ where the the question has $n_j.$ This is the number of observations for a given $x$ value $x_i.$
Since the fitted value $\widehat y_{ij}$ remains the same for different values of $j$ as long as the index $i$ does not change, so one can denote it by $\widehat y_i.$ The mean $\bar y_i$ is the average $y$-value among all observations with the same $x$-value $x_i.$ The fitted value $\widehat y_i$ comes from fitting a straight line.
The lack-of-fit sum of squares is the sum of $(\bar y_i - \widehat y_i)^2,$ not the sum of $(\bar y_i - y_{ij})^2.$
So I will write this identity as follows: $$ \sum_{i=1}^c \sum_{j=1}^{n_i} (y_{ij} - \hat{y}_i)^2 = \sum_{i=1}^c \sum_{j=1}^{n_i} (\bar{y}_i - \widehat y_i)^2 + \sum_{i=1}^c \sum_{j=1}^{n_i}(y_{ij} - \bar{y}_i)^2 $$ Now we have \begin{align} \sum_{i=1}^c \sum_{j=1}^{n_i} (y_{ij} - \widehat y_i)^2 & = \sum_{i=1}^c \sum_{j=1}^{n_i} ((y_{ij} - \bar y_i) + (\bar y_i - \widehat y_i))^2 \\[10pt] & = \sum_{i=1}^c \sum_{j=1}^{n_i} ((y_{ij} - \bar y_i)^2 + (\bar y_i - \widehat y_i)^2 + 2\,\underbrace{(y_{ij} - \bar y_i)(\bar y_i - \widehat y_i)}\,) \end{align} It remains only to show that the sum of the terms over then $\underbrace{\text{underbrace}}$ is $0.$
We have $$ \sum_{i=1}^c \sum_{j=1}^{n_i} \big( (y_{ij} - \bar y_i)(\bar y_i - \widehat y_i) \big) $$ As $j$ goes from $1$ to $n_i,$ the factor $(\bar y_i - \widehat y_i)$ does not change. Therefore it can be pulled out of that sum: $$ \sum_{i=1}^c \sum_{j=1}^{n_i} \big( (y_{ij} - \bar y_i)(\bar y_i - \widehat y_i) \big) = \sum_{i=1}^c \left( (\bar y_i - \widehat y_i) \sum_{j=1}^{n_i} (y_{ij} - \bar y_i) \right). $$ Lastly, we only need to observe that $$ \sum_{j=1}^{n_i} (y_{ij} - \bar y_i) =0. $$