0
$\begingroup$

I am trying to find the second-partial derivatives for the following equation:

$$g = \sum_{i=1}^n \left(y_i - \frac{\theta_1 x_i}{x_i+\theta_2}\right)^2$$

Here, $\theta_1$ and $\theta_2$ are the model parameters.

I start by finding the first-order partial derivatives:

1) $\frac{\partial g}{\partial\theta_1} = 2(y_i-\frac{\theta_1x_i}{x_i+ \theta_2})(\frac{-x_i}{x_i+\theta_2})$

2) $\frac{\partial g}{\partial\theta_2} = 2(y_i-\frac{\theta_1x_i}{x_i+ \theta_2})(\frac{-\theta_1x_i}{(x_i+\theta_2)^2})$

Then, I find the second-order partial derivatives:

1) $\frac{\partial g}{\partial\theta_1^2} = 2[(y_i-\frac{\theta_1x_i}{x_i+ \theta_2})(0)+(\frac{-x_i}{x_i+\theta_2})(\frac{-x_i}{x_i+\theta_2})] = 2(\frac{x_i}{x_i+\theta_2})^2$

2) $\frac{\partial g}{\partial\theta_2^2} = 2[(y_i-\frac{\theta_1x_i}{x_i+ \theta_2})(\frac{2\theta_1x_i}{(x_i+\theta_2)^3})+(\frac{\theta_1x_i}{(x_i+\theta_2)^2})(\frac{-\theta_1x_i}{(x_i+\theta_2)^2})] = 2[(y_i-\frac{\theta_1x_i}{x_i+ \theta_2})(\frac{2\theta_1x_i}{(x_i+\theta_2)^3})-(\frac{\theta_1x_i}{(x_i+\theta_2)^2})^2]$

3) $\frac{\partial g}{\partial\theta_1\theta_2} = \frac{-4}{(x_i+\theta_2)^3}$

I am a bit hesitant about my work, especially the way that second partial derivative for $\theta_2$ seems so much messy than that for $\theta_1$. If there is anything wrong with my work, I would really like to figure out how to correctly solve this!

$\endgroup$
0
$\begingroup$

I re-write the same function with different notations to write it easier as $$g=\left(y-\frac{p x}{q+x}\right)^2$$ where $p,q$ are variables. $$\frac{\partial g}{\partial p}=-\frac{2 x \left(y-\frac{p x}{q+x}\right)}{q+x}$$ $$\frac{\partial^2 g}{\partial p^2}=\frac{2 x^2}{(q+x)^2}$$ $$\frac{\partial g}{\partial q}=\frac{2 p x \left(y-\frac{p x}{q+x}\right)}{(q+x)^2}$$ $$\frac{\partial^2 g}{\partial q^2}=\frac{2 p^2 x^2}{(q+x)^4}-\frac{4 p x \left(y-\frac{p x}{q+x}\right)}{(q+x)^3}$$ $$\frac{\partial^2 g}{\partial p \partial q}=\frac{\partial^2 g}{\partial q\partial p}=\frac{2 x \left(y-\frac{p x}{q+x}\right)}{(q+x)^2}-\frac{2 p x^2}{(q+x)^3}$$

Note: your $\frac{\partial g}{\partial \theta_2}$ is incorrect, there is no "-" sign in the second bracket since $\theta_2$ is in the denominator.

$\endgroup$
  • $\begingroup$ All summations are missing ... but it does not matter since they could be added later. $\endgroup$ – Claude Leibovici Apr 9 '15 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.