A power law is just a name for a particular form of distribution, specifically:
$$ \begin{align}
p(x) &\propto x^{-\alpha} \textrm{ } \textrm{ or}\\
p(x=X) &\propto x^{-\alpha}
\end{align}
$$
depending on whether the data are continuous or discrete. Despite a lot of hype, there's nothing particularly mystical or magical about them. Power law-distributed data has a long tail (highly right skewed) and falls along a (negatively-sloped) line on a log-log plot. Cosma Shalizi has a great blog post on determining whether your data is actually power law distributed. Importantly, he points out that many other distributions also share those properties (e.g., log-normal) and the usual trick of fitting a straight line to a log-log plot isn't particularly well-founded. In the post, he also links to some papers showing that many putative power law relationships aren't actually great fits to the data.
In brief, he recommends the following steps:
- Maximum likelihood estimation to find the scaling exponent ($\alpha)$
- The goodness of fit procedure described here to where the power law-y region begins
- A K-S test to check goodness of fit (using a bootstrap and not the regular tables because you're testing against an estimated fit).
- Vuong's test for model selection against other heavy-tailed distributions (e.g., log-normal)
For the specific case of Zipf's law, it shows that $\log(\textrm{rank}) \propto \log(\textrm{frequency})$ for many natural languages. If you want to compute this specifically, you will need to turn your data into ranks and frequencies, which seems like it will probably entail sorting it.
Most other power law relationships seem to describe a survival function (e.g., sales of books) and these also necessarily involve sorting. They don't, however, necessarily involve binning into a histogram: you can--and shoud--generate these directly from the data.
The reason Zipf's law sorts words by frequency is that words inherently don't have a numeric order. Response time is already ordered so there's no real sense in reordering it by frequency.
– Alex R. Apr 05 '16 at 00:01