correlated.matrix {synchrony} | R Documentation |
correlated.matrix
Description
Create an ntimes
x nspecies
matrix with correlation rho,
standard deviation sigma, and mean mu
Usage
correlated.matrix (rho = 0, sigma = 1, mu = 0, ntimes = 200, nspecies = 10)
Arguments
rho |
Correlation between the columns of the matrix. This can be a single number describing
the correlation between all columns, or the upper triangular portion of a correlation
matrix describing the correlation between all pairs of columns. Default is |
sigma |
Standard deviation of the columns. Default is 1 |
mu |
Mean of the columns. Default is 0 |
ntimes |
Number of rows in the matrix. Default is 200 |
nspecies |
Number of columns in the matrix. Default is 10 |
Details
This function is based on the Cholesky factorization method described by Legendre (2000).
Value
Returns a named list containing the following:
rho |
Correlation(s) between the columns |
sigma |
Standard deviation of the columns |
mu |
Mean of the columns |
community |
|
Author(s)
Tarik C. Gouhier (tarik.gouhier@gmail.com)
References
Gouhier, T. C., F. Guichard, and A. Gonzalez. 2010. Synchrony and stability of food webs in metacommunities. The American Naturalist 175:E16-E34.
Legendre, P. 2000. Comparison of permutation methods for the partial correlation and partial mantel tests. Journal of Statistical Computation and Simulation 67:37-73.
Examples
mat=correlated.matrix(rho=0.85, sigma=30, mu=10, nspecies=10)
# Check sd of each column
apply(mat$community, 2, sd)
# Check mean of each column
apply(mat$community, 2, mean)
# Check correlation of matrix
community.sync(mat$community)