computeC: Construct local covariance matrix for NNGP conditional...

computeCR Documentation

Construct local covariance matrix for NNGP conditional distributions

Description

Constructs the local covariance matrix associated with a focal location and its neighbor set under the Nearest-Neighbor Gaussian Process (NNGP).

Usage

computeC(fdist, ndist, rho, sigma2)

Arguments

fdist

Numeric matrix (k \times k) containing pairwise Euclidean distances among the neighbors of the focal location.

ndist

Numeric vector (length k+1) containing distances between the focal location and its neighbors, followed by the self-distance (0) of the focal location.

rho

Positive numeric scalar. Length-scale parameter \rho controlling the decay of spatial correlation.

sigma2

Positive numeric scalar. Marginal variance parameter \sigma^2.

Details

This function constructs the local covariance matrix used in the NNGP approximation for conditional Gaussian distributions. The covariance structure is defined using an exponential covariance function.

The structure of the matrix is:

  • Top-left block: covariance among neighbors

  • Last row/column: covariance between focal location and neighbors

  • Bottom-right: marginal variance of the focal location

A small nugget term (1e-6) is added to the diagonal for numerical stability.

Value

A numeric matrix of dimension (k+1) \times (k+1) representing the local covariance matrix for the focal location and its neighbors.

Author(s)

Fabian Ketwaroo


BayesNSGP documentation built on Sept. 10, 2026, 5:08 p.m.