Computes Covariance Matrix and Related Results
This function builds the covariance matrix for a set of spatial locations, given the covariance parameters. According to the input options other results related to the covariance matrix (such as decompositions, determinants, inverse. etc) can also be returned.
varcov.spatial(coords = NULL, dists.lowertri = NULL, cov.model = "matern", kappa = 0.5, nugget = 0, cov.pars = stop("no cov.pars argument"), inv = FALSE, det = FALSE, func.inv = c("cholesky", "eigen", "svd", "solve"), scaled = FALSE, only.decomposition = FALSE, sqrt.inv = FALSE, try.another.decomposition = TRUE, only.inv.lower.diag = FALSE, …)
an \(n \times 2\) matrix with the coordinates of the data locations. If not provided the argument
dists.lowertrishould be provided instead.
a vector with the lower triangle of the matrix of distances between pairs of data points. If not provided the argument
coordsshould be provided instead.
a string indicating the type of the correlation function. More details in the documentation for
cov.spatial. Defaults are equivalent to the exponential model.
values of the additional smoothness parameter, only required by the following correlation functions:
the value of the nugget parameter \(\tau^2\).
a vector with 2 elements or an \(ns \times 2\) matrix with the covariance parameters. The first element (if a vector) or first column (if a matrix) corresponds to the variance parameter \(\sigma^2\). second element or column corresponds to the correlation function parameter \(\phi\). If a matrix is provided each row corresponds to the parameters of one spatial structure. Models with several structures are also called nested models in the geostatistical literature.
TRUEthe inverse of covariance matrix is returned. Defaults to
TRUEthe logarithmic of the square root of the determinant of the covariance matrix is returned. Defaults to
algorithm used for the decomposition and inversion of the covariance matrix. Options are
"chol"for Cholesky decomposition,
"svd"for singular value decomposition and
"eigen"for eigenvalues/eigenvectors decomposition. Defaults to
logical indicating whether the covariance matrix should be scaled. If
TRUEthe partial sill parameter \(\sigma^2\) is set to 1. Defaults to
TRUEonly the square root of the covariance matrix is returned. Defaults to
TRUEthe square root of the inverse of covariance matrix is returned. Defaults to
TRUEand the argument
func.invis one of
"solve", the matrix decomposition or inversion is tested and, if it fails, the argument
func.invis re-set to
TRUEonly the lower triangle and the diagonal of the inverse of the covariance matrix are returned. Defaults to
for naw, only for internal usage.
The elements of the covariance matrix are computed by the function
cov.spatial. Typically this is an auxiliary function called by other
functions in the geoR package.
The result is always list. The components will vary according to the input options. The possible components are:
the covariance matrix.
a square root of the covariance matrix.
the lower triangle of the inverse of covariance matrix.
the diagonal of the inverse of covariance matrix.
the inverse of covariance matrix.
a square root of the inverse of covariance matrix.
the logarithmic of the square root of the determinant of the covariance matrix.
Further information on the package geoR can be found at: http://www.leg.ufpr.br/geoR.