taddallas / metacom

R package for the analysis of metacommunity structure
GNU General Public License v3.0
10 stars 9 forks source link

Negative z-score for coherence #18

Closed dornellesd closed 3 years ago

dornellesd commented 3 years ago

Hello, I'm getting a lot of negative Coherence z-scores in my data, so I decided to try the example from "Coherence and Turnover different from previous versions" issue and I'm getting different results. I'm using the 1.5.3 version.

Input

data("varespec")
Coe_r0_1.5.1 <- Coherence(varespec, method = "r0", order = T, binary = T, sims = 1000, seed = 1)
Coe_r0_1.5.1

His output

         name       stat
1      embAbs 251.000000
2           z  57.471647
3           p   0.000000
4     simMean 437.076000
5 simVariance   3.237701
6 method = r0         NA

My output

        name      stat
1      embAbs 251.00000
2           z -54.58247
3           p   0.00000
4     simMean 436.83200
5 simVariance   3.40461
6 method = r0        NA

Do you know what's happening? Which one is correct? Thanks!

taddallas commented 3 years ago

Thanks for catching this!

I think this was an old issue with how I was calculating the z-score, where I believe I calculate it the same way as Leibold and Mikkelson now. I mean, both of those results are the same, right? Compare the number of embedded absences, the simulated mean and variance, and p values. The only difference is the sign of the z-score, but either way the interpretation is that the data have fewer embedded absences than expected under the r0 null model.

I think based on a quick search of some other published research (e.g., https://onlinelibrary.wiley.com/doi/10.1111/fwb.12556) the negative z-value should be the right one.