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
0
votes
1 answer
assigning items of a list to the nodes of a graph
I want to assign items of a list to the nodes of a graph one by one as attributes of those nodes. The code is as follows but it doesn't loop through the second "for". How can I fix this?
r = bernoulli.rvs(p=0.4, size=100)
G =…

p a a
- 3
- 3
0
votes
1 answer
Linear regression to fit a power-law in Python
I have two data sets index_list and frequency_list which I plot in a loglog plot by plt.loglog(index_list, freq_list). Now I'm trying to fit a power law a*x^(-b) with linear regression. I expect the curve to follow the initial curve closely but the…

StijnVanDijk
- 3
- 1
- 3
0
votes
2 answers
Problem with r2 value of power law fit: Is this fit really worse than a straight line?
I have a dataframe of x and y data. The data exhibit a general power law form so I would like to fit a curve that's a power law. However when I do so I get a r2 value of -2.63 which tells me that the fit is worse than a straight line would be. Is…

JAG2024
- 3,987
- 7
- 29
- 58
0
votes
1 answer
generate scale free network with power-law degree distribution by python
I write this code to generate scale free network with power law degree distribution.
import networkx as nx
import random
N = 1000
exponent = 2.2
test = [int(random.paretovariate(exponent-1)) for i in range(N)]
graph =…

Atefeh Rashidi
- 485
- 1
- 8
- 32
0
votes
1 answer
Power law distribution fitting in Python
I am using different python to fit density functions on a dataset. This data set is made of positive time values starting from 1 second.
I tested different density functions from scipy.statistics and the powerlaw library, as well as my own functions…

rhcpps
- 31
- 1
- 5
0
votes
1 answer
Fitting power law for income distribution
I am working with micro-data on total net household income for different countries and before computing inequality indexes, I want to adjust the right tail to take into account the sensitivity of these indexes to top incomes and top-missing.…

Luca Giangregorio
- 115
- 7
0
votes
1 answer
How to fix "Error in m$getDat() : attempt to apply non-function" when estimating xmin for poweRlaw
I'm trying to fit a power law distribution to some sample data. I am trying to find xmin using the estimate_xmin() function. Does anyone know why I get an error about attempting to apply a non-function?
abs.logreturns <-…

sam.1992
- 1
0
votes
0 answers
Levy walks / power law distributions using Unity / C#
I'm wanting to create some AIs with a Levy flight based random walk. I've currently got them moving with a completely random walk (random distance between a min and max value, and random waiting time between a min and max value). I'm aware that Levy…
0
votes
1 answer
Fitting data using broken power-law in gnuplot
I want to fit my data with broken power law function. I am using data from two different files and this is the code that I am using to fit my data in gnuplot tool
set term wxt
p 'Data1.dat' u 1:($8*100):2:($9*100) w xyerr lt 7 t '', \
…

Arya Stark
- 11
- 4
0
votes
0 answers
Can we find out if a distribution is following a power law distribution by using a qqplot ( using R)?
I want to find out if a given distribution follows a power law. My question is, can we use a qq plot to do this?
I first estimate the xmin by integrating over the entire dataset. Following which, I found alpha using MLE. (xmin and alpha are…

Piyush Gupta
- 1
- 1
0
votes
1 answer
Pandas: How to split a column of a dataframe, which follows powerlaw into two based on frequency distribution?
I have a data frame of 1 million records with 5 columns.
unique_index,name,company_name,city_id,state_id
Column, company_name, has 100k unique records. This follows a power law. Top 5000 company_names cover 70% of the records.
I want to take equal…

pnv
- 1,437
- 3
- 23
- 52
0
votes
1 answer
Curvefitting for power law function y= a(x^b)+c
I am new to MATLAB, and I am trying to fit a power law through a dataset. I have been trying to use isqcurvefit function, but I am unsure how to proceed as the instructions found through Google are too convoluted for a beginner. I would like to…

Tom
- 11
- 1
0
votes
1 answer
powerlaw Python package errors
I'm currently trying to fit a set of (positive) data with the powerlaw.Fit() function from the powerlaw package. However, every single time I do this I obtain the following message:
which I've been trying to figure…

Jayjay95
- 199
- 9
0
votes
1 answer
power-law curve fitting scipy, numpy not working
I came up with a problem in fitting a power-law curve on my data. I have two data sets: bins1 and bins2
bins1 acting fine in curve-fitting by using numpy.linalg.lstsq (I then use np.exp(coefs[0])*x**coefs[1] to get power-law equation)
On the other…

Sina
- 161
- 1
- 5
0
votes
0 answers
Fit power law using scipy minimize
I want to do maximum likelihood estimation using scipy minimize for a function of the form
y = a * x^b
where the errors are assumed to be normally distributed around the predictions. Currently, the true parameters cannot be recovered at all (see…

beginneR
- 3,207
- 5
- 30
- 52