Let
\begin{equation} SSLF = \sum_{i=1}^{m}n_{i}(\bar{y_{i}} - \hat{y_{i}})^{2} \end{equation}
then
\begin{equation} \sum_{i=1}^{m}n_{i}(\bar{y_{i}} - \hat{y_{i}})^{2} = n(\bar{\overrightarrow{y}} - \hat{\overrightarrow{y}})'(\bar{\overrightarrow{y}} - \hat{\overrightarrow{y}}) \end{equation}
where $n = (n_{1},...,n_{m})$
and
\begin{equation} n(\bar{\overrightarrow{y}} - \hat{\overrightarrow{y}})'(\bar{\overrightarrow{y}} - \hat{\overrightarrow{y}}) = n(\bar{\overrightarrow{y}} - H\overrightarrow{y})'(\bar{\overrightarrow{y}} - H\overrightarrow{y}) \end{equation}
where $H$ is the Hat matrix.
I believe I need to work it down to
\begin{equation} \bar{\overrightarrow{y}}'(I - H)\bar{\overrightarrow{y}} \end{equation}
So that I can get the degrees of freedom as $m - (k+1)$ but I am having trouble doing that.
the second line is wrong: $$ \sum n_i (y_i-\hat y_i)^2 = (y-\hat y)^T N (y-\hat y), $$ where $N$ is diagonal matrix with diagonal entries $n_i$. Using $\hat y = Hy$, $$ (y-\hat y)^T N (y-\hat y) = ((I-H)y)^T N ((I-H)y) = y^T(I-H)^TN(I-H)y. $$