# nsCrossdist: Calculate coordinate-specific cross-distance matrices In BayesNSGP: Bayesian Analysis of Non-Stationary Gaussian Process Models

## Description

`nsCrossdist` calculates coordinate-specific cross distances in x, y, and x-y for use in the nonstationary cross-correlation calculation. This function is useful for calculating posterior predictions.

## Usage

 `1` ```nsCrossdist(coords, Pcoords, scale_factor = NULL, isotropic = FALSE) ```

## Arguments

 `coords` N x 2 matrix; contains x-y coordinates of station (observed) locations. `Pcoords` M x 2 matrix; contains x-y coordinates of prediction locations. `scale_factor` Scalar; optional argument for re-scaling the distances. `isotropic` Logical; indicates whether distances should be calculated using Euclidean distance (`isotropic = TRUE`) or using the anisotropic formulation (`isotropic = FALSE`).

## Value

A list of distances matrices, with the following components:

 `dist1_sq` M x N matrix; contains values of pairwise squared cross- distances in the x-coordinate. `dist2_sq` M x N matrix; contains values of pairwise squared cross- distances in the y-coordinate. `dist12` M x N matrix; contains values of pairwise signed cross- distances between the x- and y-coordinates. `scale_factor` Value of the scale factor used to rescale distances.

## Examples

 ```1 2 3 4 5``` ```# Generate some coordinates coords <- cbind(runif(100),runif(100)) Pcoords <- cbind(runif(200),runif(200)) # Calculate distances Xdist_list <- nsCrossdist(coords, Pcoords) ```

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