Sncf.srf: Nonparametric (Cross-)Covariance Function from stationary...

View source: R/Sncf.R

Sncf.srfR Documentation

Nonparametric (Cross-)Covariance Function from stationary random fields

Description

Sncf.srf is the function to estimate the nonparametric for spatio-temporal data from fully stationary random fields (i.e. marginal expectation and variance identical for all locations; use Sncf otherwise).

Usage

Sncf.srf(
  x,
  y,
  z,
  w = NULL,
  avg = NULL,
  avg2 = NULL,
  corr = TRUE,
  df = NULL,
  type = "boot",
  resamp = 0,
  npoints = 300,
  save = FALSE,
  filter = FALSE,
  fw = 0,
  max.it = 25,
  xmax = FALSE,
  jitter = 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 variable 2 (to estimate the spatial cross-correlation function).

avg

supplies the marginal expectation of the Markov random field; if TRUE, the sample mean (across the markovian field) is used.

avg2

optionally supplies the marginal expectation of the Markov random field for optional variable 2; if TRUE, the sample mean is used.

corr

If TRUE, the covariance function is standardized by the marginal variance (across the Markovian field) to return a correlation function (alternatively the covariance function is returned).

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 (an resamp x npoints dimensional matrix).

filter

If TRUE, the Fourier filter method of Hall and coworkers is applied to ensure positive semidefiniteness 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.

jitter

If TRUE, jitters the distance matrix, to avoid problems associated with fitting the function to data on regular grids.

quiet

If TRUE, the counter is suppressed during execution.

Details

If corr = F, an object of class "Sncf.cov" is returned. Otherwise the class is "Sncf".

Sncf.srf is a function to estimate the nonparametric (cross-)covariance function (as discussed in Bjornstad and Bascompte 2001) for data from a fully stationary random fields. I have found it useful to estimate the (cross-)covariance functions in synthetic data.

Value

An object of class "Sncf" (or "Sncf.cov") is returned. See Sncf for details.

Author(s)

Ottar N. Bjornstad onb1@psu.edu

References

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>

See Also

Sncf, summary.Sncf, plot.Sncf, plot.Sncf.cov

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.srf(x = x, y = y, z = z, avg = NULL, corr = TRUE, resamp = 0) 
## Not run: plot(fit1) 
summary(fit1)

# multivariate nonparametric cross-covariance function (with known
# marginal expectation of zero for both z and w
fit2 <- Sncf.srf(x = x, y = y, z = z, w = w, avg = 0, avg2 = 0, corr = FALSE, 
                 resamp = 0)
## Not run: plot(fit2) 
summary(fit2)

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