[Math] Question about derivatives, Jacobian Matrix and non-linear least square curve fitting

derivativesregression

I am working with a software package that performs non-linear least squares curve fitting. The goal of curve fitting is to calculate the coefficients of an equation given x,y points.

The software also provides for user to supply a Jacobian matrix to improve convergence time and accuracy.

The problem I am having is understanding the exact nature of the partial derivatives required for the Jacobian.

The software seems to require partial derivatives with respect to the coefficients, not the independent variable.

Below are two examples that shows the original equation and the derivatives used to form the Jacobian for curve fitting.

Test Code 1. This equation has three coefficients, $p_0, p_1, p_2.$

$$\begin{align}
u_i &= 0.45 + 0.05 x_i\\
a_i &= e^{(10p_1/(u_i+p_2) – 13.0)}\\
y_i &= p_0* a_i \\
\\
{\partial p_0/\partial y}_i &= a_i\\
{\partial p_1/\partial y}_i &= 10 * p_0 * a_i/(u_i+p_2)\\
{\partial p_2/\partial y}_i &= -10 * p_0 * p_1 * a_i / ((u_i+p_2)^2)
\end{align}
$$

Test Code 2. This equation has three coefficients, $p_0, p_1, p_2.$

$$\begin{align}
y_i &= p_0 * e^{-p_1*x_i} + p_2\\
\\
{\partial p_0/\partial y}_i &= e^{-p_1*x_i}\\
{\partial p_1/\partial y}_i &= -p_0*x_i*e^{-p_1*x_i}\\
{\partial p_2/\partial y}_i &= 1\\
\end{align}
$$

I understand the derivative of ${\partial p_0/\partial y}_i$ for Test Code 1. This is of the form $ap_0$. The ${\partial p_0/\partial y}_i$ of $ap_0$ is $a$.

I understand the derivatives of ${\partial p_0/\partial y}_i$ and ${\partial p_2/\partial y}_i$ for Test Code 2. This is of the form $ap_0 + b$, and $p_2$ respectively. The derivatives ${\partial p_0/\partial y}$ and ${\partial p_2/\partial y}$ are $a$ and $1$, respectively.

I do not remember how to obtain the derivatives for the other partials. I believe that answer lies in $dx/dye^x = e^x$ and the chain rule.

The equation I am working with is a form of the Gaussian equation

$$\begin{align}
a &= 1/(\sigma*\sqrt{2\pi})\\
b &= 2 *\sigma^2\\
c &= -(x-x_0)^2\\
y_i &= a * e^{c/b}\\
\end{align}
$$

I require the partials $\partial\sigma/\partial y$ and $\partial x_0/\partial y$ to build the Jacobian.

Thanks in advance to the members of Mathematics for any assistance.

Best Answer

I was able to get the partial derivatives to the equations above from the following site.

http://www.derivative-calculator.net/

Related Question