My question is more about the methodology. Assuming in some experiment we have measured quantity $y$ per each unit of time $x.$ So $y$ and $x$ form our data set here. Moreover, we know that they are related by a power law type of relation, e.g., $y = D x^{\alpha},$ where $D$ is just a constant.
Now to extract $\alpha$ from the data-set, I know two ways:
a) Calculating the logs of our data, we can then compute the derivative of the $\ln(y)$ w.r.t $\ln(x),$ so $\frac{d\ln y}{d\ln x}=\alpha$ and extract the power. One problem with this is that the sampling may not have been done logarithmically, so the spacings between the log'ed values are different. That means numerically it is going to be hard to accurately compute such derivative.
b) Another way would be: taking the logs again as in above, but then we just fit the log'ed data with a line, the slope of which should give us an average $\alpha,$ right? Assuming this is correct, one problem is that if $\alpha$ is changing during different time scales of the experiment, the above fit wouldn't capture it. Maybe one could perform the fits piece-wise.
Questions:
- Have I laid out the above methods correctly? (e.g., is b) correct?)
- Does one method come more recommended or it really depends on the context? (i.e., in view of the aforementioned difficulties) Finally, please feel free to suggest other ways of extracting $\alpha$ if you know of different methods, I'm very curious to find out.
(If you prefer explaining your method with an example, I have created dummy data for purposes of illustration, here's the link, first column is $x$ and second column $y.$)
Clarifications upon reading discussions in the comment section:
The aim here is only to tackle the problem of how to reasonably estimate (for instance by fitting) power laws that describe a given bivariate data set, and more precisely, finding power laws that correspond to each region of interest [*] (i.e., subsets of the data). With this in mind, what the user Nick Cox has proposed as answer, is precisely on point.
[*]: thus e.g., fitting subsets of the data, and more contextually, looking for different power laws at different time-scales, because for instance from a physical point of view we expect the data to exhibit different power laws.