A power law is a functional relationship between two quantities, where one quantity varies as a power of another.
Questions tagged [power-law]
124 questions
32
votes
4 answers
Random number generator that produces a power-law distribution?
I'm writing some tests for a C++ command line Linux app. I'd like to generate a bunch of integers with a power-law/long-tail distribution. Meaning, I get a some numbers very frequently but most of them relatively infrequently.
Ideally there…

twk
- 16,760
- 23
- 73
- 97
18
votes
2 answers
Fitting a curve to a power-law distribution with curve_fit does not work
I am trying to find a curve fitting my data that visually seem to have a power law distribution.
I hoped to utilize scipy.optimize.curve_fit, but no matter what function or data normalization I try, I am getting either a RuntimeError (parameters…

kpax
- 621
- 1
- 8
- 18
9
votes
4 answers
python plot and powerlaw fit
I have the following list:
[6, 4, 0, 0, 0, 0, 0, 1, 3, 1, 0, 3, 3, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 2, 3, 3, 2, 5, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 0, 0, 0, 2, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1,…

Tasos
- 7,325
- 18
- 83
- 176
8
votes
1 answer
Fit a power law to empirical data in Python
I'm experimenting with fitting a power law to empirical data using the powerlaw module. I have created the following data that follows a power law distribution of exponent 2:
x = range(1,1000)
y = []
for i in x:
y.append(i**(-2))
I'm expecting…

Moses Xu
- 2,140
- 4
- 24
- 35
7
votes
4 answers
Correct way to standardize/scale/normalize multiple variables following power law distribution for use in linear combination
I'd like to combine a few metrics of nodes in a social network graph into a single value for rank ordering the nodes:
in_degree + betweenness_centrality = informal_power_index
The problem is that in_degree and betweenness_centrality are…

Jacob Rigby
- 1,323
- 2
- 15
- 20
7
votes
2 answers
Linear regression in R (normal and logarithmic data)
I want to carry out a linear regression in R for data in a normal and in a double logarithmic plot.
For normal data the dataset might be the follwing:
lin <- data.frame(x = c(0:6), y = c(0.3, 0.1, 0.9, 3.1, 5, 4.9, 6.2))
plot (lin$x, lin$y)
There I…

R_User
- 10,682
- 25
- 79
- 120
7
votes
1 answer
Python power law fit with upper limits & asymmetric errors in data using ODR
I'm trying to fit some data to a power law using python. The problem is that some of my points are upper limits, which I don't know how to include in the fitting routine.
In the data, I have put the upper limits as errors in y equal to 1, when the…

astrostudent
- 71
- 1
- 3
6
votes
2 answers
How to properly fit data to a power law in Python?
I am considering the number of occurrence of unique words in the Moby Dick novel and using the powerlaw python package to fit words’ frequencies to a power law.
I am not sure why I can't recapitulate the results from previous work by Clauset et al.…

0x90
- 39,472
- 36
- 165
- 245
5
votes
2 answers
How to perform a joint fit of several curves (in Python)?
Suppose I'm fitting some data points by a simple linear regression. Now I'd like to perform several joint linear regressions for several sets of data points. More specifically, I want one parameter to be equal among all fits, which is schematically…

Beaker
- 179
- 2
- 8
5
votes
3 answers
Zipf's Law in Java for text generation - too slow
Hey there I'm working on a textgenerator, that should generate millions of different texts.
to make the content of each text realistic I used Zipf's Law
It is working well, the word distribution is correct.
But the following next() function is…

Any1
- 182
- 2
- 15
5
votes
3 answers
python scipy stats pareto fit: how does it work
... help and online documentation say the function scipy.stats.pareto.fit takes as variables the dataset to be fitted, and optionally b (the exponent), loc, scale.
the result comes as triplet (exponent, loc, scale)
generating data from the same…

0range
- 2,088
- 1
- 24
- 32
4
votes
1 answer
How can I generate a sample from a log-normal distribution with Pareto tail in R?
I would like to generate a sample from a log-normal distribution with Pareto tail in R. Can somebody help me? Thanks.

stochazesthai
- 617
- 1
- 7
- 20
4
votes
1 answer
Multiple power law plots with package poweRlaw
I tried using the package poweRlaw to plot a few powerlaw fits. It seems working for a single curve. But I could not plot multiple plots on the same graph.
Ref: Is there a way within this package?
[P.S. I am a novice]
set.seed(1)
x1 <-…

Attu nonUser De
- 43
- 2
- 6
3
votes
1 answer
Comparing Power Law with other Distributions
I'm using Jeff Alstott's Python powerlaw package to try fitting my data to a Power Law. Jeff's package is based on the paper by Clauset et al which discusses the Powerlaw.
First, some details on my data:
It is discrete (word count data);
It is…

born to hula
- 1,274
- 5
- 18
- 36
3
votes
0 answers
Fitting a power law for extrapolation
I am trying to figure out how to interpolate a function, and I want to be able to extrapolate a small way beyond the interpolation range. There is some background theory which leads me to expect that the behavior for large values of the dependent…

лаетековский чайник
- 51
- 4