Powerfit not fitting to the empirical data

28 Views Asked by At

I am trying to fit some data with an powerlaw fit, but the powerlaw starts at the right xmin which is 230, but it always starts at y level = 1 , when it should start at cords = (x,y) = (230,0.3) , What am i doing wrong? The datasets are from Newman, but why is the redline alwas starting at y = 1?

fitted data


def powerPlot(fit):
    plt.figure()
    fig1 = fit.plot_ccdf(original_data=True, color='blue', linestyle='', marker='o', markersize=10, markerfacecolor='none', label='CCDF')
 
    fit.power_law.plot_ccdf(ax=fig1, survival=True, color='red', linestyle='--', alpha=1)
    fit.truncated_power_law.plot_ccdf(ax=fig1, color='purple', linestyle='--', alpha=1)




import pipe 
import plotsettings as ps
import printValues as pV
import plotDist as pD


def main():

    data = pipe.getData("Black.txt")

    fit = powerlaw.Fit(data) 
    fit2 = powerlaw.Fit(data, xmin = fit.xmin, xmax = fit.xmax , alpha = fit.alpha, discrete = True)
    
    #fit3 = powerlaw.Fit(data, xmin = 1)
    #pV.printAlpha(fit)
    #pV.printXmin(fit)
    #pV.printRAndP(fit)
    #pD.bigPlot(fit2)

   # pV.printBig(fit2)
   # pD.bigPlot(fit)
    pD.powerPlot(fit2)
   # pD.expPlot(fit2)
    #pD.normPlot(fit2)

    ps.setPlot("Words.txt")

main()

I tried to make the powerlaw fit to the empirical data, it kinda fits but it starts at the right x level but wrong y level

0

There are 0 best solutions below