# Fitting power law with shift to experimental data

I have some data that I can tell visually that scales like a power law. However, the $$x\rightarrow \infty$$ and $$y\rightarrow \infty$$ asymptotes of the data are nonzero. I should thus fit the data to something of the form

$$y=a(x-b)^c+d$$

I am trying to do this with Matlab's curve fitting tool, which can do nonlinear least squares fitting. However, this fails horribly, as the fit converges to a curve that looks nothing like the data (often a stright line), with the fitted values of $$b$$ and $$d$$ completely off from what I can tell from the data. The confidence interval for coefficients are also horrible, spanning multiple orders of magnitude.

I have tried guessing $$b$$ and $$d$$ and then fitting $$y=ax^c$$, but this seems to depend sensitively on my choice of $$b$$ and $$d$$, where a small change in their values make the fit significantly better or worse.

Why is fitting $$y=a(x-b)^c+d$$ so problematic numerically? What is the right way of doing this fit?

• Excel's Solver package can probably be made to fit this equation. Do you know how to use Solver? – David White Jul 10 at 16:01
• @DavidWhite I don't, unfortunately. What does Excel's solver package do that allows for the fit? At this point, I don't even understand why this fit is so difficult numerically. – sodiumnitrate Jul 10 at 16:13
• Are you willing to send me your data? – David White Jul 10 at 16:42
• @DavidWhite It's some experimental data that belongs to collaborators, so I can't, unfortunately. – sodiumnitrate Jul 10 at 16:57
• OK. I'll construct a spreadsheet with dummy data that match your functional form and you can fill in the real data. Are you willing to send contact information so I can do that? – David White Jul 10 at 17:17

The common methods to fit the function : $$y=a(x-b)^c+d\tag 1$$ to a given data are non-linear regression. Often the difficulty is to find initial values for the parameters in order to start an iterative process. The trouble arrises if the "guessed" values are not close enough to the optimal values which are unknown at first.

A non-iterative method which doesn't require guessed values is shown in the paper https://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales

The case of function $$(1)$$ doesn't appears explicitly in the paper but a simple adaptation gives the procedure below :

NUMERICAL EXAMPLE :

FOR INFORMATION :

The linearization of the regression is obtained thanks to an integral equation : $$\int y(x)dx=A\,x\,y+B\,y+C\,x+D\quad\text{with}\quad A=\frac{1}{c+1}\quad\text{and}\quad B=-\frac{b}{c+1}$$ In the above procedure the approximate $$S_k$$ of the discret values of the integral are computed on a rough manner. The final fitting is very sensitive to the values of the integral. That is why the number of points must be large enough and the scatter not too large.

10 points as above are generally not enough, but this was only for a simplified example.

Also the regression with respect to the integral equation has not the same criteria of fitting than the regression with respect to the function itself. If a specific criteria of fitting is specified a post-treatment might be necessary in case of non negligible scater of the data.

If practice, if the above method leads to results not accurate enough, one have to proceed to a post-treatment with a common non-linear regression. The results of the above procedure are good guesses to initiate the iterative process. This makes more robust the non-linear regression.