Learn R Programming

SpatialTools (version 0.3.2)

cov.sp: 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, 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 part
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$.

Value

  • Returns a list with the following elements:
  • VThe covariance matrix for the observed responses. Will be of size $n \times n$.
  • VpThe covariance matrix for the predicted responses. Only returned if pcoords is supplied. Will be of size $np \times np$.
  • VpThe covariance matrix between the observed responses and the predicted responses. Only returned if pcoords is supplied. Will 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 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.

See Also

simple.cov.sp

Examples

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

Run the code above in your browser using DataLab