Learn R Programming

ncf (version 1.1-2)

spline.correlog: 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 idenitical 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 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.
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.
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 supressed during execution.

Value

  • An object of class "spline.correlog" is returned, consisting of the following components:
  • realThe list of estimates from the data.
  • $x.interceptthe lowest value at which the function is = 0. If correlation is initially negative, the distance is given as negative.
  • $e.interceptthe lowest value at which the function 1/e.
  • $y.interceptthe extrapolated value at x=0 (nugget).
  • $predicted$xthe x-axes for the fitted covariance function.
  • $predcited$ythe values for the covariance function.
  • bootA list with the analogous output from the bootstrap or null distribution.
  • $summarygives the full vector of output for the x.intercept, y.intercept, e.intercept, and a quantile summary for the resampling distribution.
  • $bootif save=TRUE the full raw matrices from the resampling is saved.
  • max.distancethe maximum spatial distance considered.

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 differes from the spatial correlogram (and Mantel correlogram) in that it estimated spatial dependence as a continous 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 regionwide 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.

References

Bjornstad, O.N. & Falck, W. (2001) Nonparametric spatial covariance functions: estimation and testing. Environmental and Ecological Statistics, 8:53-70.

See Also

summary.spline.correlog plot.spline.correlog Sncf spline.correlog.2D correlog

Examples

Run this code
#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 = 5)
    plot.spline.correlog(fit1)
    summary.spline.correlog(fit1)

#multivariate spline correlogram
    fit2 <- spline.correlog(x=x, y=y, z=z, resamp = 5)
    plot.spline.correlog(fit2)
    summary.spline.correlog(fit2)

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

Run the code above in your browser using DataLab