Least squares fit to a an exponential equation with one unknown

1.2k Views Asked by At

I have this equation

$$y = s - cx^{1.85}$$

where s is a known integer and c is unknown. I want to use the least squares method to find the best value of c that fits a set of points.

I've used $\sum (log y) - 1.85\sum(log x)\over n$ and used that as an exponent to e to be c, but doesn't seem correct.

How can I use least squares to determine the variable c?

1

There are 1 best solutions below

2
On BEST ANSWER

Let me put it in a more general form.

You have a model $$y=s -c x^a$$ and a set of $n$ data points $(x_i,y_i)$ and you need to adjust the parameters in the sense of least squares. This means that you want to minimize $$F=\sum_{i=1}^n\big( s-c x_i^a-y_i\big)^2$$ with respect to the parameters. As usual, you will write the partial derivatives with respect to each parameter and set all of them equal to $0$. The model will be nonlinear if parameter $a$ has to be adjusted and this would require nonlinear regression.

In the case of the post, where $s$ and $s$ are fixed, the problem is simple since $$\frac{dF}{dc}=-2\sum_{i=1}^n x_i^a\big(s-c x_i^a-y_i\big)=0$$ Expanding the sum and grouping terms, we then arrive to $$c=\frac{\sum_{i=1}^n x_i^a(s-y_i)}{\sum_{i=1}^n x_i^{2a}}$$

You could have made life simpler defining $z_i=s-y_i$ and $t_i=x_i^a$ which reduces the model to $z=c t$ which would lead to $$c=\frac{\sum_{i=1}^n t_i z_i}{\sum_{i=1}^n t_i^{2}}$$ which is the slope of the straight line going through origin when using the transformed variables.

This is definitely the way I recommend you to use : start with your $(x_i,y_i)$ values, define the $(t_i,z_i)$ and compute $c$ according to the last formula.