Imagine I have a network, and in this network I have $n$ nodes of interest.

I calculated the average shortest path (asp) between these nodes.

I want to see if they are statistically significantly close to each other.

Therefore I select $n$ nodes from the network randomly, and work out the average shortest path length. I repeat this 1000 times, so I have my asp for my nodes of interest a vector of 1000 asps for randomly selected nodes

Question: How can I compare the two? Just count how many times the asp of my nodes interest < randomly selected nodes? And then divide by 1000 to get a p.value?

Or should I compare the asp of the nodes of interest with the vector of 1000 random asps using e.g. t.test or Wilcoxon rank sum?


1 Answer 1


I think you should make a bootstrapped confidence interval. Rank your 1000 randomly sampled asp distances. Your CI is from the 25th smallest to the 25th largest interval. If the asp for your n nodes of interest lies outside of the interval, then the asp for your n nodes is significantly different from that expected from a random selection of n nodes.

Alternatively, if you want a rough p-value, rank your asp of interest among the 1000 randomly sampled asps. If it is above the median, divide it's rank by 500. If it's below the median, subtract it's rank from 500, and divide the result by 500. The resulting number is your p-value.

  • $\begingroup$ Glad to help. I just noticed that the process for finding the p-value was ambiguous. If it's below the median, subtract its rank from 500, not the value itself. $\endgroup$ Commented Mar 20, 2012 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.