meancorr: Compute mean column-wise correlation and determine its...

Description Usage Arguments Value Author(s) References Examples

Description

Compute mean column-wise correlation and determine its significance via Monte Carlo randomizations. The Monte Carlo randomizations are performed by shuffling the columns of the community matrix independently.

Usage

1
2
3
meancorr (data, nrands = 0, alternative = c("two.tailed", "greater", "less"), 
                            method = c("pearson", "kendall", "spearman"), 
                            type = 1, quiet = FALSE, ...)

Arguments

data

community matrix in wide format where each row contains the abundance at each time step and each column corresponds to a different species.

nrands

number of randomizations to perform (default is 0)

alternative

Alternative hypothesis. Options include greater and less for the one-tailed test and two.tailed. Default is two.tailed.

method

Method to compute correlation? Options include pearson, kendall, and spearman. Default is pearson

type

Randomization method. The type=1 method randomly shuffles each column of the data matrix, thus destroying both the autocorrelation structure of each column and the cross-correlation between columns. The type=2 method shifts each column of the data matrix by a random amount, thus preserving the autocorrelation structure of each column but destroying the cross-correlation between columns (Purves and Law 2002). Default is type=1

quiet

Suppress progress bar when set to TRUE. Default is FALSE

...

Other parameters to cor function.

Value

Returns a named list containing:

obs

the observed mean correlation

rands

the mean correlation for each randomization. This variable is only returned if nrands > 0.

pval

p-value of observed mean correlation. This variable is only returned if nrands > 0.

alternative

Alternative hypothesis. This variable is only returned if nrands > 0.

method

Method used to compute the mean correlation.

Author(s)

Tarik C. Gouhier (tarik.gouhier@gmail.com)

References

Purves, D. W., and R. Law. 2002. Fine-scale spatial structure in a grassland community: quantifying the plant's eye view. Journal of Ecology 90:121-129.

Examples

1
2
3
4
5
6
7
8
9
# Community matrix for 20 species undergoing random fluctuations 
comm.rand=matrix(runif(100), nrow=5, ncol=20)
meancorr(comm.rand, nrands=20)$pval
# Community matrix for 20 species undergoing synchronized fluctuations 
comm.corr=matrix(rep(comm.rand[,1], 20), nrow=5, ncol=20)
meancorr(comm.corr, nrands=20)$pval
# On "real" data
data(bird.traits)
meancorr(bird.traits, nrands=20)$pval

synchrony documentation built on March 26, 2020, 7:14 p.m.