mSynch {ncf} | R Documentation |
mSynch is the function to estimate the mean (cross-)correlation in a spatiotemporal dataset as discussed in Bjornstad et al. (1999). The function requires multiple observations at each location.
mSynch(x, y = NULL, resamp = 1000, na.rm = FALSE, circ = FALSE, quiet = FALSE)
x |
matrix of dimension n x p representing p observation at each location (i.e. each row is a time series). |
y |
optional matrix of dimension m x p representing p observation at each location (i.e. each row is a time series). If provided, the mean cross- correlation between the two panels is computed. |
resamp |
the number of resamples for the bootstrap or the null distribution. |
na.rm |
if TRUE, NA's will be dealt with through pairwise deletion of missing values for each pair of time series – it will dump if any one pair has less than two (temporally) overlapping observations. |
circ |
if TRUE, the observations are assumed to be angular (in radians), and circular correlation is used. |
quiet |
if TRUE the counter is supressed during execution. |
Missing values are allowed – values are assumed missing at random.
The circ argument computes a circular version of the Pearson's product
moment correlation (see cor2
).
An object of class "mSynch" is returned, consisting of a list with two components:
real |
the regional average correlation. |
boot |
A vector of bootstrap resamples. |
Ottar N. Bjornstad onb1@psu.edu
Bjornstad, O.N., Ims, R.A. & Lambin, X. (1999) Spatial population dynamics: Analysing patterns and processes of population synchrony. Trends in Ecology and Evolution, 11:427-431.
#first generate some sample data x <- expand.grid(1:20, 1:5)[,1] y <- expand.grid(1:20, 1:5)[,2] #z data from an exponential random field z <- cbind( rmvn.spa(x=x, y=y, p=2, method="exp"), rmvn.spa(x=x, y=y, p=2, method="exp") ) #mean correlation analysis fit1 <- mSynch(x=z, resamp=10) print(fit1)