biometry / bipartite

repository for the bipartite R-package for network analysis
36 stars 17 forks source link

null.t.test with "cluster coefficient" #9

Closed pgourdongeo closed 4 years ago

pgourdongeo commented 4 years ago

Hi,

Sorry I'm new to network analysis, so maybe there's something I missed. I've try the null.t.test() function with some basic networklevel indicators on a matrix. I've got this error when I add the "cluster coefficient" in the index list :

Nulltestem2nw <-null.t.test(em2nw, index=c("generality", "vulnerability", "connectance","links per species","cluster coefficient"), nrep=4, N=20)

"Error in t.test.default(unlist(res[i, ]), mu = obs[[i]], na.action = na.omit) : 
  data are essentially constant
Erreur : $ operator is invalid for atomic vectors"

When I tried to get the resulst for cluster coefficient only, it seems to be working. But even if I specify the level, the observed value remains the cluster coefficient of the whole network :

  1. without specifying the level
    NulltestCC <-null.t.test(em2nw, index=c("cluster coefficient"), nrep=4, N=20)
    NulltestCC
                           obs  null mean   lower CI  upper CI       t            P
    cluster coefficient 0.03389831 0.09463569 0.07921827 0.1100531 7.88298 8.632008e-11
  2. specifying for higher level (observed result should be 0.09279116)
    NulltestHCC <-null.t.test(em2nw, index=c("cluster coefficient"),level = "higher", nrep=4, N=20)
    NulltestHCC
                           obs  null mean   lower CI  upper CI        t            P
    cluster coefficient 0.03389831 0.05452801 0.04784492 0.0612111 6.243745 2.375485e-07

3 Networklevel indicators of my "em2nw" matrix

        connectance                  web asymmetry              links per species            cluster coefficient                      
                0.05458834                     0.92643392                     3.10224439                     0.03389831                     
                               cluster.coefficient.HL         cluster.coefficient.LL 
                                                0.09279116                     0.23278832 

Thank you for all the work.

cdormann commented 4 years ago

Dear Paul, could you please provide a minimum working example for the error-causing network? I tried it with various networks in the package and had no problem. You can also, confidentially, post the em2nw data itself off-list to my work email (as given in the package). Thanks, Carsten