cov.sp: Calculates spatial covariance

View source: R/cov.R

cov.spR Documentation

Calculates spatial covariance

Description

Calculates spatial covariance matrix of the observed responses, and possibly, the responses to be predicted. If pcoords is not provided, then only V, the covariance matrix of the observed responses will be returned. If pcoords is provided, then Vp and Vop (the covariance matrix for predicted responses and between observed and predicted responses, respectively) will also be returned.

Usage

	cov.sp(coords, sp.type = "exponential", 
		sp.par = stop("specify sp.par argument"), 
		error.var = 0, smoothness = 0.5, finescale.var = 0, 
		pcoords = NULL, D = NULL, Dp = NULL, Dop = NULL)

Arguments

coords

A numeric matrix of size n \times d containing the observed data locations.

sp.type

A character vector specifying the spatial covariance type. Valid types are currently exponential, gaussian, matern, matern2, and spherical.

sp.par

A vector of length 2 specifying the scale and strength of dependence of the covariance function. The first element is the variance of the underlying spatial process (also known as the hidden or latent spatial process). This value is also called the partial sill. The second element is the strength of dependence between responses.

error.var

A non-negative number indicating the variance of the error term.

smoothness

A positive number indicating the variance of the error term.

finescale.var

A non-negative positive number indicating the finescale variability. The is also called the microscale variance

pcoords

A numeric matrix of size np \times d containing the locations of the responses to be predicted.

D

The Euclidean distance matrix for the coords matrix. Must be of size n \times n.

Dp

The Eucliean distance matrix for the pcoords matrix. Must be of size np \times np.

Dop

The Euclidean intersite distance matrix between the locations in coords and the locations in pcoords. Must be of size n \times np.

Details

The spatial covariance functions are parameterized in a manner consistent with the cov.spatial function in the geoR package. The matern2 covariance function is an alternative covariance function suggested by Handcock and Wallis (1994). The benefit of this parameterization is that the range parameter is that it allows the effective range to be less dependent on the smoothness parameter.

The D, Dp, and Dop arguments are supplied to decrease the number of necessary computations needed when performing repetitive analysis or simulations. It is probably in the user's interest to not supply these arguments unless the duration of analysis is an important consideration. Note that these arguments override the information given in coords and pcoords, i.e., if dist1(coords) != D, then D is used in subsequent calculations, etc. This could create problems.

Value

Returns a list with the following elements:

V

The covariance matrix for the observed responses. Will be of size n \times n.

Vp

The covariance matrix for the predicted responses. Only returned if pcoords is supplied. Will be of size np \times np.

Vp

The covariance matrix between the observed responses and the predicted responses. Only returned if pcoords is supplied. Will be of size n \times np.

Author(s)

Joshua French

References

M.S. Handcock, J.R. Wallis. An approach to statistical spatial-temporal modeling of meteorological fields (with discussion). Journal of the American Statistical Association, 89 (1994), pp. 368–390.

See Also

simple.cov.sp

Examples

    coords <- matrix(rnorm(30), ncol = 3)
    cov.sp(coords = coords, sp.type = "exponential", sp.par = c(2, 1),
        error.var = 1)

SpatialTools documentation built on July 26, 2023, 5:16 p.m.