[R] about power.law.fit
Gábor Csárdi
csardi at rmki.kfki.hu
Mon Jan 19 15:35:40 CET 2009
power.law.fit simply ML fits the 'prob(d) = d^\alpha' model to the
input, where d is positive integer. It seems to work for me:
> data <- sample(1:10000, prob=(1:10000)^-3, rep=TRUE)
> power.law.fit(data)
Call:
mle(minuslogl = mlogl, start = list(alpha = start))
Coefficients:
alpha
3.017056
> data <- sample(1:10000, prob=(1:10000)^-2, rep=TRUE)
Warning message:
In sample(1:10000, prob = (1:10000)^-2, rep = TRUE) :
Walker's alias method used: results are different from R < 2.2.0
> power.law.fit(data)
Call:
mle(minuslogl = mlogl, start = list(alpha = start))
Coefficients:
alpha
2.016645
It returns with an "mle" object, so you can call 'confint', 'logLik',
etc. on it, see "mle-class" for details.
> tmp <- power.law.fit(data)
> summary(tmp)
Maximum likelihood estimation
Call:
mle(minuslogl = mlogl, start = list(alpha = start))
Coefficients:
Estimate Std. Error
alpha 2.016645 0.01085921
-2 log L: 32150.62
> confint(tmp)
Profiling...
2.5 % 97.5 %
1.995522 2.038091
Gabor
ps. there is also an igraph-help mailing list, FYI. Just in case I
miss your questions here....
On Sun, Jan 18, 2009 at 4:50 PM, Weijia You <weijiawx at gmail.com> wrote:
> Dear all,
>
> I'm using igraph for some analysis about the network I have. I have a
> question about the function "power.law.fit".
>
> I wonder if there is any test for checking whether the "power.law.fit" is
> good for the input, i.e., under which situation, could we use this function
> to get a reliable result. I'm afraid even I input a random graph without any
> property of "power-law" characteristics, it will returns an outcome which
> seems to be a fit to available data while it has no meaning to us. Is there
> any index like "goodness of fit" ?
>
> Thank you for any comments.
>
> Best!
> Weijia
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
More information about the R-help
mailing list