This function computes the permutation p-value of the association between a species vector and a vector of memberships to a site-group. Four different tests of hypotheses arise from considering either presence/absence or quantitative species data, and from using a non-equalized or group-equalized approach.
Usage
signassoc(
X,
U = NULL,
cluster = NULL,
mode = 1,
alternative = "greater",
control = how(),
permutations = NULL,
print.perm = FALSE
)
Arguments
- X
Community data table (rows are sites, columns are species).
- U
A matrix of group memberships. Each column corresponds to one site-group. Membership values can be crisp or fuzzy. If this matrix is not provided, vector gmv will be used.
- cluster
A vector of numeric group labels for sites.
- mode
Association mode, 0 (site-based) or 1 (group-based).
- alternative
Alternative statistical hypothesis: "greater" (positive association), "less" (negative association), "two.sided" (either positive or negative).
- control
A list of control values describing properties of the permutation design, as returned by a call to
how
.- permutations
A custom matrix of permutations, to be used if
control = NULL
, with permutations in rows and site indices in columns.- print.perm
If TRUE, prints permutation numbers after each set of 100 permutations.
Value
Returns a matrix of p-values, where species are in rows and groups are in columns. Two additional columns indicate the group with lowest p-value and the p-value for this group after Sidak's correction for multiple testing.
Details
Input data for this function is the species matrix X and either a matrix of group memberships (U) or a vector of numeric group labels (cluster). This R function works for both presence/absence and quantitative species data, depending on the values of the input matrix X.
If mode = 0
, the null ecological hypothesis is that the frequency (or abundance) of the species of interest in sites belonging to the site group is not higher than the frequency (or abundance) in sites not belonging to it. If mode = 1
, the null ecological hypothesis is that the relative frequency (average abundance) of the species of interest is not higher in the target site group than in other groups. See De Cáceres and Legendre for more details.
Complex permutation designs are allowed through the function how
from package "permute". If those are not enough, the user can set control = NULL
and specify a custom matrix of permutations to test with parameter permutations
.
Note
Users should be aware that the significance test in signassoc
is not exactly the same as the one in indval
from labdsv
package. The signassoc
function is using the preference for the target group (either non-equalized or group-equalized) as test statistic. After every permutation the preference for the target group is recalculated. The function is therefore testing the null hypothesis stating that the preference of the species for a given site group is due to chance only (as in Bakker 2008). The test is repeated for every group, and this is the reason why there are as many p-values as groups. In contrast, the indval
function from labdsv
package uses the maximum preference value as test statistic, and the maximum preference value is recalculated after each permutation. The maximum preference may correspond to other groups than the one chosen for the unpermuted data. indval
function from labdsv
package is therefore testing the null hypothesis saying that the group with observed maximum preference is not such, because the maximum preference was in that group due to chance only. In order to get the consistent results compared to the indval
function, users should use the function multipatt
, along with the option duleg=TRUE
.
References
Bakker, J. 2008. Increasing the utility of Indicator Species Analysis. Journal of Applied Ecology 45: 1829-1835.
De Cáceres, M. and Legendre, P. 2009. Associations between species and groups of sites: indices and statistical inference. Ecology 90(12): 3566-3574.
Examples
library(stats)
data(wetland) ## Load species data
wetkm <- kmeans(wetland, centers=3)## Create three clusters using
## Look for species whose abundance is significantly higher in one of the three groups
signassoc(wetland, cluster=wetkm$cluster, mode=1, control = how(nperm=999))
#> 1 2 3 best psidak
#> Abefic 1.000 0.226 1.000 2 0.536315176
#> Merhed 1.000 0.021 1.000 2 0.061686261
#> Alyvag 0.027 1.000 1.000 1 0.078832683
#> Pancam 0.821 0.002 0.999 2 0.005988008
#> Abemos 0.564 0.447 1.000 2 0.830887623
#> Melcor 0.551 0.001 1.000 2 0.002997001
#> Ludoct 1.000 0.233 1.000 2 0.548782337
#> Eupvac 0.880 0.002 0.995 2 0.005988008
#> Echpas 0.460 0.342 0.864 2 0.715109688
#> Passcr 1.000 0.252 1.000 2 0.581491008
#> Poa2 0.354 1.000 1.000 1 0.730413864
#> Carhal 0.085 1.000 0.553 1 0.233939125
#> Dendio 1.000 1.000 0.443 3 0.827191307
#> Casobt 1.000 1.000 0.405 3 0.789355125
#> Aesind 0.008 0.849 1.000 1 0.023808512
#> Cyprot 0.507 0.052 1.000 2 0.148028608
#> Ipocop 0.729 0.158 1.000 2 0.403052312
#> Cynarc 0.965 0.001 1.000 2 0.002997001
#> Walind 0.530 0.431 0.497 2 0.815779991
#> Sessp. 0.829 0.235 0.421 2 0.552302875
#> Phynod 0.001 0.992 1.000 1 0.002997001
#> Echell 0.211 0.329 0.955 1 0.508830931
#> Helind 0.001 1.000 0.406 1 0.002997001
#> Ipoaqu 0.426 0.694 0.395 3 0.778554875
#> Orysp. 0.933 1.000 0.001 3 0.002997001
#> Elesp. 0.132 1.000 0.035 3 0.101367875
#> Psespi 0.902 1.000 0.006 3 0.017892216
#> Ludads 1.000 1.000 0.001 3 0.002997001
#> Polatt 1.000 1.000 0.054 3 0.153409464
#> Poa1 0.338 1.000 1.000 1 0.709882472
#> Helcri 0.338 1.000 1.000 1 0.709882472
#> Physp. 1.000 1.000 0.414 3 0.798769944
#> Goopur 1.000 1.000 0.414 3 0.798769944
## Look for species whose abundance is significantly higher in sites belonging
## to one group as opposed to sites not belonging to it.
signassoc(wetland, cluster=wetkm$cluster, mode=0, control = how(nperm=999))
#> 1 2 3 best psidak
#> Abefic 1.000 0.243 1.000 2 0.566201907
#> Merhed 1.000 0.016 1.000 2 0.047236096
#> Alyvag 0.040 1.000 1.000 1 0.115264000
#> Pancam 0.792 0.002 1.000 2 0.005988008
#> Abemos 0.584 0.428 1.000 2 0.812850752
#> Melcor 0.371 0.001 1.000 2 0.002997001
#> Ludoct 1.000 0.225 1.000 2 0.534515625
#> Eupvac 0.873 0.002 0.991 2 0.005988008
#> Echpas 0.495 0.381 0.894 2 0.762823341
#> Passcr 1.000 0.268 1.000 2 0.607776832
#> Poa2 0.353 1.000 1.000 1 0.729159977
#> Carhal 0.130 1.000 0.702 1 0.341497000
#> Dendio 1.000 1.000 0.417 3 0.801844713
#> Casobt 1.000 1.000 0.404 3 0.788291264
#> Aesind 0.009 0.824 1.000 1 0.026757729
#> Cyprot 0.415 0.054 1.000 2 0.153409464
#> Ipocop 0.709 0.156 1.000 2 0.398788416
#> Cynarc 0.963 0.001 1.000 2 0.002997001
#> Walind 0.571 0.486 0.566 2 0.864203256
#> Sessp. 0.878 0.330 0.438 2 0.699237000
#> Phynod 0.001 0.988 1.000 1 0.002997001
#> Echell 0.211 0.312 0.974 1 0.508830931
#> Helind 0.018 1.000 0.578 1 0.053033832
#> Ipoaqu 0.549 0.808 0.523 3 0.891468667
#> Orysp. 0.975 1.000 0.001 3 0.002997001
#> Elesp. 0.297 1.000 0.091 3 0.248910571
#> Psespi 0.947 1.000 0.004 3 0.011952064
#> Ludads 1.000 1.000 0.001 3 0.002997001
#> Polatt 1.000 1.000 0.061 3 0.172063981
#> Poa1 0.349 1.000 1.000 1 0.724105549
#> Helcri 0.349 1.000 1.000 1 0.724105549
#> Physp. 1.000 1.000 0.438 3 0.822495672
#> Goopur 1.000 1.000 0.438 3 0.822495672