You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
When I have a probabilistic network where species cannot interact with themselves, I've got a negative modularity value. I thought modularity should be between [0;1], right?
Here a small reprex.
using Random, EcologicalNetworks, LinearAlgebra
Random.seed!(42);
net = rand(10, 10);
net_diag = copy(net);
net_diag[diagind(net_diag)] .= 0;
net = UnipartiteProbabilisticNetwork(net);
net_diag = UnipartiteProbabilisticNetwork(net_diag);
Q(net, each_species_its_module(net)[2])
Q(net_diag, each_species_its_module(net)[2])
I'm using Julia v1.2.0 and EcologicalNetworks v0.2.2
The text was updated successfully, but these errors were encountered:
Modularity as measured here is the number of links within modules compared to how many there would be under the null assumption (it's in Newman's paper). So when there are fewer such links than expected, the modularity can be negative. If you want to try something, look at a very small network (4 species) with two "perfect" modules, the value of Q should be about 1/2.
You can use Qr (realized modularity) if you want something strictly between 0 and 1.
I'll mark this one as solved as this is not a bug (simply normal behavior of the measure, although a rare one).
Thanks for you quick answer, I 've just look at your paper about Qr() and that exactly what I was looking for. However, I still have negative value with Qr() with both simulated data like above and real one. I think I'm missing something...
Here is the updated reprex.
using Random, EcologicalNetworks, LinearAlgebra
Random.seed!(42);
net = rand(10, 10);
net_diag = copy(net);
net_diag[diagind(net_diag)] .= 0;
net = UnipartiteProbabilisticNetwork(net);
net_diag = UnipartiteProbabilisticNetwork(net_diag);
Qr(net, each_species_its_module(net)[2])
Qr(net_diag, each_species_its_module(net_diag)[2])
Should I reopen this issue or open a new one (or is it the normal behavior)?
Also normal behavior - the network you have here is anti-modular, so this is not unexpected to find negative values (there's a discussion of this in the Qr paper, I think)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi! Thanks for your package!
When I have a probabilistic network where species cannot interact with themselves, I've got a negative modularity value. I thought modularity should be between [0;1], right?
Here a small reprex.
I'm using
Julia v1.2.0
andEcologicalNetworks v0.2.2
The text was updated successfully, but these errors were encountered: