Sncf2D {ncf}R Documentation

Anisotropic nonparametric (cross-)correlation function for spatio-temporal data

Description

Sncf2D is the function to estimate the anisotropic nonparametric correlation function in 8 (or arbitrary) directions (North - Southeast). Correlation functions are calculated for each different bearing. The function requires multiple observations at each location. (use spline.correlog2D otherwise).

Usage

Sncf2D(
  x,
  y,
  z,
  w = NULL,
  df = NULL,
  type = "boot",
  resamp = 1000,
  npoints = 300,
  save = FALSE,
  max.it = 25,
  xmax = FALSE,
  na.rm = FALSE,
  jitter = FALSE,
  quiet = FALSE,
  angle = c(0, 22.5, 45, 67.5, 90, 112.5, 135, 157.5)
)

Arguments

x

vector of length n representing the x coordinates.

y

vector of length n representing the y coordinates.

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 spatial or lagged cross-correlation functions).

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

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.

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.

angle

specifies number of cardinal directions and angles for which to calculate correlation functions. Default are 8 directions between 0 and 180.

Details

Correlation functions are calculated on projected distances onto the different bearings so ALL data are used for each direction. The (obsolete?) oldncf2D used the alternative of slicing up the data like pieces of a pie.

Latitude-longitude coordinates can NOT be used.

Missing values are allowed - values are assumed missing at random.

I have implemented an optional argument: jitter if TRUE this jitters the distance matrix, to avoid some problems I've had with spline-smoothing data from regular grid-data.

Value

An object of class "Sncf2D" is returned, consisting of a list of estimates for each cardinal direction :

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, and the cbar and a quantile summary for the resampling distribution.

$boot

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

angle

a vector with the cardinal directions.

max.distance

the maximum spatial distance.

Note

The function to estimate the anisotropic nonparametric (cross-)correlation function in arbitrary directions. In particular it was developed to calculate the lagged cross-correlation function (Bjornstad et al. 2002).

Author(s)

Ottar N. Bjornstad onb1@psu.edu

References

Bjornstad, O. N., M. Peltonen, A. M. Liebhold, and W. Baltensweiler. 2002. Waves of larch budmoth outbreaks in the European Alps. Science 298:1020-1023. <doi:10.1126/science.1075182>

See Also

summary.Sncf2D, plot.Sncf2D, cc.offset , Sncf, spline.correlog2D

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")
  )
# anisotorpic nonparametric covariance function at 30 and 60 degrees
fit1 <- Sncf2D(x = x, y = y, z = z, resamp = 0, angle = c(30, 60))
## Not run: plot(fit1)
summary(fit1)

# What distance is the peak in correlation
cc.offset(fit1)

[Package ncf version 1.3-2 Index]