An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20060215/381208c7/attachment.pl
power law
2 messages · Glazko, Galina, Gábor Csárdi
5 days later
See the methods here: http://arxiv.org/abs/cond-mat/0412004 You can simply use the formula given here for continuous data. Discrete data is a bit more tricky, this is the function I'm using: # ------------------------------------------------- power.law.fit <- function(x, xmin=NULL, start=2, ...) { if (length(x) == 0) { error("zero length vector") } if (length(x) == 1) { error("vector should be at least of length two") } require(stats4) if (is.null(xmin)) { xmin <- min(x) } n <- length(x) x <- x[ x >= xmin] if (length(x) != n) { warning("too small values eliminated from vector") n <- length(x) } mlogl <- function(alpha) { C <- 1/sum( (xmin:10000)^-alpha ) -n*log(C)+alpha*sum(log(x)) } alpha <- mle(mlogl, start=list(alpha=start), ...) alpha } # ------------------------------------------------- The function (with is manual page) is also included in the igraph package, see http://cneurocvs.rmki.kfki.hu/igraph Hope this helps, Gabor
On Wed, Feb 15, 2006 at 08:07:50AM -0500, Glazko, Galina wrote:
Dear list, Does anyone know how to fit the power law distribution? I have the empirical distribution and would like to check whether it fits power law (with the power estimated from the data). Any hints are appreciated Best regards Galina [[alternative HTML version deleted]]
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Csardi Gabor <csardi at rmki.kfki.hu> MTA RMKI, ELTE TTK