##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")Run the code above in your browser using DataLab