mSynch: The mean (cross-)correlation (with bootstrapp CI) for a panel...

View source: R/mSynch.R

mSynchR Documentation

The mean (cross-)correlation (with bootstrapp CI) for a panel of spatiotemporal data

Description

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.

Usage

mSynch(x, y = NULL, resamp = 999, na.rm = FALSE, circ = FALSE, quiet = FALSE)

Arguments

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 suppressed during execution.

Details

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).

Value

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.

Author(s)

Ottar N. Bjornstad onb1@psu.edu

References

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. <doi:10.1016/S0169-5347(99)01677-8>

See Also

print.mSynch

Examples

# 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 = 500)
print(fit1)

bjornsta/ncf documentation built on June 3, 2022, 11:43 a.m.