fit_power_law fits a power-law distribution to a data set.fit_power_law(x, xmin = NULL, start = 2, force.continuous = FALSE,
implementation = c("plfit", "R.mle"), ...)R.mleplfitNULL. The lower bound for fitting the
power-law. If NULL, the smallest value in x will be used for
the R.mleR.mleplfitmle, if the R.mleplfitimplementation argument. If it is
R.mlemlemle-class for details.If implementation is plfit
xmin were used from the input vector.fit_power_law provides two maximum likelihood implementations. If
the implementation argument is R.mleplfit
The plfit
Aaron Clauset, Cosma R .Shalizi and Mark E.J. Newman: Power-law distributions in empirical data. SIAM Review 51(4):661-703, 2009.
mle# This should approximately yield the correct exponent 3
g <- barabasi.game(1000) # increase this number to have a better estimate
d <- degree(g, mode="in")
fit1 <- fit_power_law(d+1, 10)
fit2 <- fit_power_law(d+1, 10, implementation="R.mle")
fit1$alpha
stats4::coef(fit2)
fit1$logLik
stats4::logLik(fit2)Run the code above in your browser using DataLab