Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different fit for specified xmin vs. removing x<xmin from data #71

Closed
LeoQK opened this issue Mar 11, 2019 · 1 comment
Closed

Different fit for specified xmin vs. removing x<xmin from data #71

LeoQK opened this issue Mar 11, 2019 · 1 comment

Comments

@LeoQK
Copy link

LeoQK commented Mar 11, 2019

Hi & thank you for creating powerlaw.

My problem concerns specifying xmin in powerlaw.Fit as opposed to fitting to data that excludes x-values below xmin.

As you can see from the output below, specifying xmin does not result in a good fit (first plot). However, when I actually remove values below the same xmin from the data, I obtain a good fit (second plot). I obtain xmin through fit.xmin.

Edit: fit.alpha is the same in both cases at 2.85.

When plotting the fitted power law, I would like to include values below xmin in the CCDF of the data and have the power law fit only to to values larger than xmin. But I am lost as to how I can achieve that.

Plot for specifying xmin in powerlaw.Fit:
nofit

Plot for removing values below xmin from the data:
fit

xmin=12 in my model.

The main code for the first plot, specifying xmin in powerlaw.Fit, is given below.

data_ccdf = powerlaw.ccdf(data)
fit = powerlaw.Fit(data, discrete=True, xmin=12)
fit.power_law.plot_ccdf(color="black")
plt.scatter(data_ccdf[0], data_ccdf[1], facecolors='none', edgecolors='b')

Thank you for your time!

@jeffalstott
Copy link
Owner

Thanks for using powerlaw! This was discussed in issue #41. We're still waiting on someone to make a pull request to implement this.

@LeoQK LeoQK closed this as completed Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants