I'm trying to derive the derivative of the chi-squared function w.r.t. the parameter vector $p$.
With $\chi^2$ being:
$\chi^2(p) = \sum \left[ \frac{y(t_i) - \hat{y}(ti_i; p)}{\sigma_{y_i}} \right]^2$
with $y$ being a 1xn vector, $\hat{y}$ being 1xn and $\sigma$ being a nxn symmetric matrix. In vector notation:
$$ (y - \hat{y}(p))^TW(y-\hat{y}(p)) \\ = y^TWy - 2y^TW\hat{y} + \hat{y}^TW\hat{y} $$ with $W = 1/\sigma^2_{yi}$. I dropped the dependence of $\hat{y}$ on $p$ on the second line for simplicity.
What i get is this:
$$ \frac{\partial}{\partial{p}}\chi^2 = \frac{\partial}{\partial{p}} \left( y^TWy - 2y^TW\hat{y} + \hat{y}^TW\hat{y} \right) \\ = -2y^TW + \hat{y}^T(W + W^T) \\ = -2(y-\hat{y})^TW $$
However according to this the solution should be:
$$ \frac{\partial}{\partial{p}}\chi^2 = 2(y-\hat{y})^TW \frac{\partial}{\partial{p}} (y-\hat{y}) \\ = -2(y-\hat{y})^TW \left[ \frac{\partial{\hat{y}}}{\partial{p}}\right] \\ = -2(y-\hat{y})^TWJ $$
where $J$ is the Jacobian. So somehow i seem to be missing the jacobian $J$ in my derivation. Can someone explain why?
$$ \frac{\partial}{\partial{p}}\chi^2 = \frac{\partial}{\partial{p}} (y^TWy) - \frac{\partial}{\partial{p}} (2y^TW\hat{y}) + \frac{\partial}{\partial{p}} (\hat{y}^TW\hat{y}) \ = -2y^TW + \hat{y}^T(W + W^T) \ = -2(y-\hat{y})^TW $$
the first term drops since it's a constant, $2y^TW$ is a constant so $\frac{\partial}{\partial{p}}(2y^TW\hat{y}) = 2y^TW $ no? and the derivative of the last term $\hat{y}^TW\hat{y}$ is $\hat{y}^T(W + W^T)$; just like the derivative of the quadratic form
– Tadzio Jun 03 '18 at 10:01