[R] Power Law Exponents

Spencer Graves
Fri, 20 Jun 2003 14:33:54 -0000

Have you looked at coef(lm (log10(vouty) ~ log10(voutx)))?  This the
slope / coefficient of log10(voutx) should be an estimate of the power.

	  Why do yo think the exponent is wrong?  If the plot looks like a
rough ellipse, then this is a standard way to fit this.

	  This assumes that log10(vouty)=b0+b1*log10(voutx)+e,
where the e's are indepndent, normally distributed with mean 0 and
constant variance.  The reverse, log10(voutx)=c0+c1*log10(vouty)+f, is a
different model:  The first assumes there is no error in voutx;  all the
error is in vouty.  The second assumes the opposite.

	  If neither is what you want, then you need some kind of errors in X
regression.  I need that so seldom that I'm not certain what softwarre
to suggest, but I believe I've seen comments on this list indicating
there is R software available for solving this problem.

hth, spencer graves

Martin H. Robinson wrote:
> I am having difficulty with the calculation of the power law exponent
> for set of nodes within a graph.
>
> Specifically, I am interested in the distribution of in-degree and
> out-degree among communities of web pages where the web pages are the
> nodes of the graph and the hyperlinks the edges.
> According to the literature, the distribution of incoming and outgoing
> links obeys a power law distribution and exponents have been reported
> for out-degree of 2.45 and 2.1 for in-degree. Apparently, this holds
> across large samples of the Web and also for sub-graphs and over
> different magnitudes of web graph.
>
> I have been working with sub-graphs of the Web that I know are related
> to each other and I have data for the in-degree and out-degree of the
> sub-graphs. I want to calculate the power law exponent for the in-degree
> and the out-degree of the sub-graphs.
>
> Assuming lin is a vector containing the in-degree of each page within
> the collection (the collection is between 4000 and 5000 resources), I
> have tried firstly:
>
>
>>barplot(rev(sort(table(lin))))
>
>
> which gives me a Pareto chart which I think is related to the power law
> distribution.
>
> However, I specifically want a log-log chart of the in-degree against
> frequency with a fitted line whose slope is the exponent.
>
> Thus, I devised the following:
>
>
>>linf <- as.data.frame.table((table(lin)),mode="numeric")
>>linx = as.vector(linf$lin, mode="numeric")
>>liny = as.vector(linf$Freq, mode="numeric")
>>plot(linx, liny, pch=3, log="xy",main="Log-log",
xlab="Indegree",
>
> ylab="Frequency - Indegree")
>
>>abline(lm (log10(vouty) ~ log10(voutx)))
>
>
> This gives me the semblance of the plot I want but the exponent is wrong
> and I have severe doubts about its correctness.
>
> As I am neither a mathematician or statistician, I would be very
> grateful for comments or guidance or correction.
> Best Regards
> Martin
>