[R] Power Law Exponents

Martin H. Robinson mrobin at eircom.net
Fri Jun 20 15:21:08 CEST 2003


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

-- 
Martin H. Robinson <mrobin at eircom.net>




More information about the R-help mailing list