spline.correlog: Uni- and multivariate spline correlograms

View source: R/spline-correlog.r

spline.correlogR Documentation

Uni- and multivariate spline correlograms

Description

spline.correlog is the function to estimate the spline (cross-)correlogram from spatial data. Either univariate or multivariate (time seres) for each site can be used.

Usage

spline.correlog(
  x,
  y,
  z,
  w = NULL,
  df = NULL,
  type = "boot",
  resamp = 1000,
  npoints = 300,
  save = FALSE,
  filter = FALSE,
  fw = 0,
  max.it = 25,
  xmax = FALSE,
  latlon = FALSE,
  na.rm = 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

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

w

an optional second variable with identical dimension to z (to estimate cross-correlograms).

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

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 semidefiniteness of the estimator.

fw

If filter is TRUE, it may be useful to truncate the function at some distance fw 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.

latlon

If TRUE, coordinates are latitude and longitude.

na.rm

If TRUE, NA's will be dealt with through pairwise deletion of missing values.

quiet

If TRUE, the counter is suppressed during execution.

Details

If observations are univariate the spline (cross-)correlogram represents the generalization of the spatial (cross-)correlogram; if observations are multivariate the spline (cross-)correlogram represents the generalization of the Mantel (cross-)correlogram.

The spline (cross-)correlogram differs from the spatial correlogram (and Mantel correlogram) in that it estimated spatial dependence as a continuous functions of distance (rather than binning into distance classes). The spline correlogram differs from the nonparametric (cross-)correlation function in that the zero-correlation reference line in the former corresponds to the region-wide correlation reference line in the latter. The x-intercept in the spline correlogram is the distance at which object are no more similar than that expected by-chance-alone across the region.

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

Value

An object of class "spline.correlog" is returned, consisting of the following components:

real

the list of estimates from the data.

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

$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, 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

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

See Also

summary.spline.correlog, plot.spline.correlog, Sncf, spline.correlog2D, correlog

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

# univariate spline correlogram
fit1 <- spline.correlog(x = x, y = y, z = z[, 1], resamp = 100)
## Not run: plot.spline.correlog(fit1)
summary(fit1)

# multivariate spline correlogram
fit2 <- spline.correlog(x = x, y = y, z = z, resamp = 100)
## Not run: plot.spline.correlog(fit2)
summary(fit2)

# multivariate spline cross-correlogram
fit3 <- spline.correlog(x = x, y = y, z = z, w = w, resamp = 100)
## Not run: plot.spline.correlog(fit3)
summary(fit3)

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