it works! Thank you for your update!

best,

Marton

]]>Hi Marton: An updated version has been created, and a new version of tnet (3.0.14) has been uploaded to CRAN. If you run, update.packages(), you should see tnet being updated. It might take some time before tnet gets updated on all the mirrors. Good luck! Tore

]]>Hi Marton,

Thanks for spotting an error! It seems that igraph has been updated and the tnet code that connected to it has broken. I will look into this and upload a new version of tnet to Cran when I’ve fixed it.

Best,

Tore

Now I have some problem with the “rg_reshuffling_w” function. So far I have used this function with the link reshuffling method and it workd properly. But now I can’t used this; when I run the command I get the error message: “Error in igraph::rewire(net.i, niter = (ecount(net.i) * 10)) : unused argument (niter = (ecount(net.i) * 10))”. After this I run those scripts that I used with this function before and I got the same error message again (they had worked properly back then I had worked with them). I tried the links option with the example given in the offical tnet package description but it doesn’t work either. Do you have any idea what happened with this function? Was there any change with it? Or maybe am I doing something wrong?

Thanks,

Marton

]]>No worries, Marton. There are many who have the same question, so here is an example.

**Research question:** Are closed triplets composed of stronger ties than we would expect by chance in the c.elegans neural network?

**Method:** Compare the global clustering coefficient of the c.elegans network to the one found in comparable network where the weights have been reshuffled.

**Code:**

# Load tnet

library(tnet)

# Load tnet datasets

data(tnet)

# Pick the celegans as the network of interest

netObs <- celegans.n306.net

# Clean up

rm(list=ls()[ls() != "netObs"])

# Compute the global clustering coefficient

valueObs <- clustering_w(netObs, measure="am")

valueObs

# 0.2364436

# Let’s generate random networks!

# Output vector

valueRdm <- rep(NaN, 1000)

# Loop

for(i in 1:length(valueRdm)) {

# Use weight reshuffling to generate comparable networks with seed so results are reproducable

netRdm <- rg_reshuffling_w(netObs, option="weights", seed=i)

# Calculate metric on random network

valueRdm[i] <- clustering_w(netRdm, measure="am")

}

# Plot results (or do other tests)

xaxisRange <- c(min(c(valueRdm, valueObs-.01)), max(c(valueRdm, valueObs+.01)))

hist(valueRdm, xlim=xaxisRange)

# Add vertical line for observed value

abline(v=valueObs, col="red", lwd=3)

**Results:**

As you can see, the observed value (vertical red line) is much higher than the comparable random values. You could also compute the standard deviations of valueRdm to determine the statistical significance of this.

Thanks Tore, but what does it mean “loop” here? I suppose it’s something that makes me 1000 random networks, but how can I implement it? Can you give me an example command to implement this comparision? Sorry again for my ignorance!

]]>Hi Marton,

It’s great that you are thinking along these lines. I would recommend the following:

– calculate the metric of interest for the actual network (“observed”)

– in a loop of at least 1,000

{

– create a random network

– calculate the metric on the random network

}

– compare the observed value to the ones found using random networks

If the observed value is in the far tails of the distribution of values from random networks, then you can make a claim about it being different from random.

I would recommend using the reshuffling procedures for generating random network to ensure the network are comparable.

Good luck,

Tore

Many thanks for your site, I find it very helpful!

I have a question regarding the random network. How should I compare the metrics in the observed network with those in random network? I suppose I should use a kind of significance test (like in the weighted rich-club effect), but how can I implement that in R? Or doesn’t it need significance test? When can I say my outcome is high or low?

Sorry for the trivial question, but I’m just a beginner in the network analysis

Thanks,

Marton ]]>

Hi Jim,

Glad you are finding it useful!

The link reshuffling is not very efficient as it relies on igraph. I used to have a much more efficient script for sparse graphs, but had to provide loads of support for people using it on dense graphs. If you send me an email, we can see if this might be more appropriate for you.

Best,

Tore

I wondered how well the algorithm scaled to larger networks? I have a network of over 10k nodes and about 80k edges, I have been running your program for a while so far, but wondered if you had any idea on how long it might take to calculate?

Many thanks, and again, great site.

]]>