Finding scaling behavior of functions with log factors

43 Views Asked by At

For a function that shows power law behavior we can find the exponent from the slope of a log-log plot. But suppose there is a function of the form, $$ x^n log(x)^m,$$ how does one find $m$ and $n$ given the ability to evaluate it at various values of $x$.

2

There are 2 best solutions below

0
On BEST ANSWER

Suppose that you have $n$ data points $(x_i,y_i)$ and that the model that you want to fit is $$y=a\,x^n\,(\log(x))^m$$ as Ross Millikan already answered, you can make it linear taking the logarithms of both sides $$\log(y)=\log(a)+n\, \log(x)+m\, \log(\log(x))=b+n\, \log(x)+m\, \log(\log(x))$$ and a multilinear regression will easily provide estimates of the parameters.

However, you must take care that what you measure is $y$ (not $\log(y)$) that is to say that you look for the minimum of $$SSQ_1=\sum_{i=1}^n \left(a\,x_i^n\,(\log(x_i))^ m-y_i\right)^2$$ while the preliminary step corresponds to the minimization of $$SSQ_2=\sum_{i=1}^n \left(\log(a)+ n\log(x_i)+m \log(\log(x_i)) -\log(y_i)\right)^2$$ which not the same and could even be quite different in the case of significant errors.

For illustration purposes, let us consider the following data set $$\left( \begin{array}{cc} x & y \\ 2 & 10 \\ 3 & 90 \\ 4 & 260 \\ 5 & 560 \\ 6 & 1000 \\ 7 & 1600 \\ 8 & 2380 \\ 9 & 3300 \\ 10 & 4400 \end{array} \right)$$

The preliminary calculation would lead to $$\log(y)=2.97997+1.00476 \log (x)+3.68957 \log (\log (x))$$ corresponding to a good fit $(R^2=0.999981)$.

Using these as starting guesses, the nonlinear regression will lead to $$y=15.183\, x^{1.26075} \,\log ^{3.31726}(x)$$ $(R^2=0.999994)$ and you can easily see how different are the parameters.

In the next table, I reproduce the values of the predicted $y$'s for each model $$\left( \begin{array}{cccc} x & y & \text{linear} &\text{nonlinear} \\ 2 & 10 & 10.2178 & 10.7859 \\ 3 & 90 & 83.9988 & 82.8666 \\ 4 & 260 & 264.541 & 257.618 \\ 5 & 560 & 574.140 & 559.985 \\ 6 & 1000 & 1024.54 & 1006.02 \\ 7 & 1600 & 1621.96 & 1606.61 \\ 8 & 2380 & 2369.50 & 2369.41 \\ 9 & 3300 & 3268.40 & 3299.94 \\ 10 & 4400 & 4318.78 & 4402.23 \end{array} \right)$$

I let you concluding about what is the best for interpolation or extrapolation.

0
On

If $n,m$ are known to be integers it should be relatively easy. The $\log x$ term varies very slowly so evaluate the function for a range of $x$ values. Most of the variation will be due to the $x^n$ term so ignore the $\log$ term and pick the closest integer. Then you can divide that out and find the $m$ term.

If you don't know they are integers you can just compute $\log f(x) = n \log x + m\log \log x +c$ for a bunch of points and use linear regression to find $n,m,c$