power.law.fit fits a power-law distribution to a
data set.power.law.fit(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. power.law.fit 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 <- power.law.fit(d+1, 10)
fit2 <- power.law.fit(d+1, 10, implementation="R.mle")
fit1$alpha
coef(fit2)
fit1$logLik
logLik(fit2)Run the code above in your browser using DataLab