Simulating data and fitting when power-law exponent is negative fails

23 views
Skip to first unread message

danielko...@gmail.com

unread,
Jun 18, 2019, 6:21:56 PM6/18/19
to powerlaw-general
Hi Jeff,

I'm interested in working with a physical system (amorphous solids) that generates a statistical distribution that is expected to obey a "negative" power-law P(x)~x^0.5 over some x range (1e-6,1e0) before some non-powerlaw function truncates the distribution. The physical meaning of 'x' is the stress necessary to induce plastic failure in a region of the material -- for a stable solid we expect that no sites should be unstable (x = 0) so we expect a "negative" power-law. I want to use the maximum likelihood estimator method to automatically extract the power-law for this distribution, however, I'm having some difficulty convincing the powerlaw package to fit to a powerlaw that it considers "negative". 

I've illustrated a few of the problems I'm having in an attached python file. The first is that x-min / x-max are behaving very strangely when generating simulated data with your package -- namely that xmin seems to behave as the upper cut-off rather than the lower cut-off, while x-max seems to behave as a lower-cutoff for that data.

The real problem comes when I try to this distribution. Fitting a sample of 10000 data points generated by your package yields alpha > 1 in all cases. If you pass the parameter_range property, restricting alpha to be between, say, -0.8 and -0.1 and do not pass xmin or xmax it causes the computation to respond with a RuntimeWwarning: "invalid value encountered in double_scalars". 

If you pass a restricted parameter range and DO pass an xmin and xmax, you instead receive an error "Power_Law" object has no attribute 'parent_Fit'. 

Do you have any suggestions for how to fit this distribution correctly? Ideally, I'd also like to compare to a Weibull distribution (with an exponent of 1.5 say), however, to do that you first need to successfully create a Fit object, which I am currently unable to do. 

Cheers,
Daniel
fittinx.py

Jeff Alstott

unread,
Jun 18, 2019, 11:34:08 PM6/18/19
to powerlaw...@googlegroups.com
Hi Daniel,

Thanks for using powerlaw! In powerlaw, and in the Clauset et al. 2007 paper that powerlaw's methods are based on, alpha is defined as being greater than 1. If alpha is smaller than that, the math and the code breaks. Sorry!

Jeff

--
You received this message because you are subscribed to the Google Groups "powerlaw-general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to powerlaw-gener...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/powerlaw-general/ab067e34-a34d-4a11-b212-367225809ace%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

danielko...@gmail.com

unread,
Jun 20, 2019, 1:18:55 PM6/20/19
to powerlaw-general
Hi Jeff (and any future readers),

I found a workable solution that should have occurred to me earlier: If x is distributed P(x)~x^theta, where theta > 0, then you can instead look at y = 1/x and the distribution P(y), which we would expect to be distributed as P(y)~y^(-(2+theta)). Not sure what this does to the error propagation, but the approach seems to work fairly reliably. 

Cheers,
Daniel
To unsubscribe from this group and stop receiving emails from it, send an email to powerlaw...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages