mkSpCov {spBayes} | R Documentation |
Function for calculating univariate and multivariate covariance matrices
Description
The function mkSpCov
calculates a spatial covariance matrix
given spatial locations and spatial covariance parameters.
Usage
mkSpCov(coords, K, Psi, theta, cov.model)
Arguments
coords |
an |
K |
the |
Psi |
the |
theta |
a vector of |
cov.model |
a quoted keyword that specifies the covariance
function used to model the spatial dependence structure among the
observations. Supported covariance model key words are:
|
Details
Covariance functions return the covariance
between a pair locations separated by distance
. The covariance function can be written as a product of a variance parameter
and a positive definite correlation function
:
, see, e.g.,
Banerjee et al. (2004) p. 27 for more details. The expressions of the correlations functions available in spBayes are given below. More will be added upon request.
For all correlations functions, is the spatial decay parameter.
Some of the correlation functions will have an extra parameter
, the smoothness parameter.
denotes the modified Bessel
function of the third kind of order
. See
documentation of the function
besselK
for further details.
The following functions are valid for and
, unless stated otherwise.
gaussian
exponential
matern
spherical
\rho(h) = \left\{ \begin{array}{ll}
1 - 1.5\phi h + 0.5(\phi h)^3
\mbox{ , if $h$ < $\frac{1}{\phi}$} \cr
0 \mbox{ , otherwise}
\end{array} \right.
Value
C |
the |
Author(s)
Andrew O. Finley finleya@msu.edu,
Sudipto Banerjee baner009@umn.edu
Examples
## Not run:
##A bivariate spatial covariance matrix
n <- 2 ##number of locations
q <- 2 ##number of responses at each location
nltr <- q*(q+1)/2 ##number of triangular elements in the cross-covariance matrix
coords <- cbind(runif(n,0,1), runif(n,0,1))
##spatial decay parameters
theta <- rep(6,q)
A <- matrix(0,q,q)
A[lower.tri(A,TRUE)] <- rnorm(nltr, 5, 1)
K <- A%*%t(A)
Psi <- diag(1,q)
C <- mkSpCov(coords, K, Psi, theta, cov.model="exponential")
## End(Not run)