jeffalstott / powerlaw

600 stars 132 forks source link

how to calculate the R value properly for discrete data #94

Open dddyx opened 2 years ago

dddyx commented 2 years ago

Hi Jeff, Thanks for your great work ! I'm in trouble calculating the R-value for discrete data. My code is:

import  powerlaw
theoretical_distribution=powerlaw.Power_Law(xmin=2,parameters=[10],discrete=True) 
simulated_data=theoretical_distribution.generate_random(10000)
fit = powerlaw.Fit(simulated_data,discrete=True)

R, p = fit.distribution_compare('power_law', 'exponential', normalized_ratio=True) 

the results are:

R= -1.1743540614477388
p= 0.24025323758420514

Does this mean that the distribution of the data tends to be more exponential? Or is there something wrong with my understanding Thanks again for the tool!