nsCrosscorr: Calculate a nonstationary Matern cross-correlation matrix In BayesNSGP: Bayesian Analysis of Non-Stationary Gaussian Process Models

Description

nsCrosscorr calculates a nonstationary cross-correlation matrix between two fixed sets of locations (a prediction set with M locations, and the observed set with N locations), based on vectors of the unique anisotropy parameters for each station. Since the correlation function uses a spatially-varying Mahalanobis distance, this function requires coordinate- specific distance matrices (see below). The function is coded as a nimbleFunction (see the nimble package) but can also be used as a regular R function.

Usage

 1 2 3 4 5 6 7 8 9 10 11 12 13 nsCrosscorr( Xdist1_sq, Xdist2_sq, Xdist12, Sigma11, Sigma22, Sigma12, PSigma11, PSigma22, PSigma12, nu, d )

Arguments

 Xdist1_sq M x N matrix; contains values of pairwise squared cross-distances in the x-coordinate. Xdist2_sq M x N matrix; contains values of pairwise squared cross-distances in the y-coordinate. Xdist12 M x N matrix; contains values of pairwise signed cross/cross- distances between the x- and y-coordinates. The sign of each element is important; see nsDist function for the details of this calculation. in the x-coordinate. Sigma11 Vector of length N; contains the 1-1 element of the anisotropy process for each observed location. Sigma22 Vector of length N; contains the 2-2 element of the anisotropy process for each observed location. Sigma12 Vector of length N; contains the 1-2 element of the anisotropy process for each observed location. PSigma11 Vector of length N; contains the 1-1 element of the anisotropy process for each prediction location. PSigma22 Vector of length N; contains the 2-2 element of the anisotropy process for each prediction location. PSigma12 Vector of length N; contains the 1-2 element of the anisotropy process for each prediction location. nu Scalar; Matern smoothness parameter. nu = 0.5 corresponds to the Exponential correlation; nu = Inf corresponds to the Gaussian correlation function. d Scalar; dimension of the spatial domain.

Value

A M x N cross-correlation matrix for two fixed sets of stations and fixed parameter values.

Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # Generate some coordinates and parameters coords <- cbind(runif(100),runif(100)) Sigma11 <- rep(1, 100) # Identity anisotropy process Sigma22 <- rep(1, 100) Sigma12 <- rep(0, 100) Pcoords <- cbind(runif(200),runif(200)) PSigma11 <- rep(1, 200) # Identity anisotropy process PSigma22 <- rep(1, 200) PSigma12 <- rep(0, 200) nu <- 2 # Calculate distances Xdist_list <- nsCrossdist(coords, Pcoords) # Calculate the correlation matrix XcorMat <- nsCrosscorr(Xdist_list\$dist1_sq, Xdist_list\$dist2_sq, Xdist_list\$dist12, Sigma11, Sigma22, Sigma12, PSigma11, PSigma22, PSigma12, nu, ncol(coords))

BayesNSGP documentation built on Jan. 9, 2022, 9:07 a.m.