Sncf: Nonparametric (cross-)correlation function for...

View source: R/Sncf.R

SncfR Documentation

Nonparametric (cross-)correlation function for spatio-temporal data

Description

Sncf is the function to estimate the nonparametric (cross-)correlation function using a smoothing spline as an equivalent kernel. The function requires multiple observations at each location (use spline.correlog otherwise).

Usage

Sncf(
  x,
  y,
  z,
  w = NULL,
  df = NULL,
  type = "boot",
  resamp = 1000,
  npoints = 300,
  save = FALSE,
  filter = FALSE,
  fw = 0,
  max.it = 25,
  xmax = FALSE,
  na.rm = FALSE,
  latlon = FALSE,
  circ = FALSE,
  quiet = FALSE
)

Arguments

x

vector of length n representing the x coordinates (or longitude; see latlon).

y

vector of length n representing the y coordinates (or latitude).

z

matrix of dimension n x p representing p observation at each location.

w

an optional second matrix of dimension n x p for species 2 (to estimate the spatial cross-correlation function).

df

degrees of freedom for the spline. Default is sqrt(n).

type

takes the value "boot" (default) to generate a bootstrap distribution or "perm" to generate a null distribution for the estimator

resamp

the number of resamples for the bootstrap or the null distribution.

npoints

the number of points at which to save the value for the spline function (and confidence envelope / null distribution).

save

If TRUE, the whole matrix of output from the resampling is saved (a resamp x npoints dimensional matrix).

filter

If TRUE, the Fourier filter method of Hall and coworkers is applied to ensure positive semi-definiteness of the estimator. (more work may be needed on this.)

fw

If filter is TRUE, it may be useful to truncate the function at some distance w sets the truncation distance. when set to zero no truncation is done.

max.it

the maximum iteration for the Newton method used to estimate the intercepts.

xmax

If FALSE, the max observed in the data is used. Otherwise all distances greater than xmax is omitted.

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.

latlon

If TRUE, coordinates are latitude and longitude.

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). This option is to calculate the 'nonparametric phase coherence function' (Grenfell et al. 2001)

Value

An object of class "Sncf" is returned, consisting of the following components:

real

the list of estimates from the data.

$cbar

the regional average correlation.

$x.intercept

the lowest value at which the function is = 0. If correlation is initially negative, the distance is given as negative.

$e.intercept

the lowest value at which the function 1/e.

$y.intercept

the extrapolated value at x=0 (nugget).

$cbar.intercept

distance at which regional average correlation is reach.

$predicted$x

the x-axes for the fitted covariance function.

$predcited$y

the values for the covariance function.

boot

a list with the analogous output from the bootstrap or null distribution.

$summary

gives the full vector of output for the x.intercept, y.intercept, e.intercept, cbar.intercept, cbar and a quantile summary for the resampling distribution.

$boot

If save=TRUE, the full raw matrices from the resampling is saved.

max.distance

the maximum spatial distance considered.

Author(s)

Ottar N. Bjornstad onb1@psu.edu

References

Hall, P. and Patil, P. (1994) Properties of nonparametric estimators of autocovariance for stationary random fields. Probability Theory and Related Fields, 99:399-424. <doi:10.1007/BF01199899>

Hall, P., Fisher, N.I. and Hoffmann, B. (1994) On the nonparametric estimation of covariance functions. Annals of Statistics, 22:2115-2134 <doi:10.1214/aos/1176325774>.

Bjornstad, O.N. and Falck, W. (2001) Nonparametric spatial covariance functions: estimation and testing. Environmental and Ecological Statistics, 8:53-70 <doi:10.1023/A:1009601932481>.

Bjornstad, O.N., Ims, R.A. and 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>.

Bjornstad, O. N., and J. Bascompte. (2001) Synchrony and second order spatial correlation in host-parasitoid systems. Journal of Animal Ecology 70:924-933 <doi:10.1046/j.0021-8790.2001.00560.x>.

Grenfell, B.T., Bjornstad, O.N., & Kappey, J. (2001) Travelling waves and spatial hierarchies in measles epidemics. Nature 414:716-723. <doi:10.1038/414716a>

See Also

Sncf2D, Sncf.srf

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")
  )
# w data from a gaussian random field
w <- cbind(
  rmvn.spa(x = x, y = y, p = 2, method = "gaus"), 
  rmvn.spa(x = x, y = y, p = 2, method = "gaus")
  )
# multivariate nonparametric covariance function
fit1 <- Sncf(x = x, y = y, z = z, resamp = 0)
## Not run: plot.Sncf(fit1)
summary(fit1)

# multivariate nonparametric cross-covariance function
fit2 <- Sncf(x = x, y = y, z = z, w = w, resamp = 0)
## Not run: plot(fit2)
summary(fit2)

ncf documentation built on May 7, 2022, 5:05 p.m.

Related to Sncf in ncf...