computeQF: Compute quadratic form for NNGP log-likelihood

computeQFR Documentation

Compute quadratic form for NNGP log-likelihood

Description

Evaluates the quadratic form appearing in the Gaussian log-likelihood under the Nearest-Neighbor Gaussian Process (NNGP).

Usage

computeQF(u, v, AD, neighbors.id)

Arguments

u

Numeric vector (length M). Typically centered data (x - \mu).

v

Numeric vector (length M). Typically identical to u in symmetric cases.

AD

Numeric matrix (M \times (k+1)). Output from computeAD, where:

  • Columns 1:k contain regression coefficients A_i

  • Column k+1 contains conditional variances D_i

neighbors.id

Integer matrix (M \times k). Neighbor indices for each location.

Details

This function computes the quadratic form associated with the NNGP precision matrix without explicitly constructing the full covariance or precision matrix.

The expression is obtained by decomposing the joint Gaussian density into a product of conditional densities:

p(\mathbf{x}) = \prod_{i=1}^M p(x_i \mid x_{N(i)})

where N(i) denotes the set of neighbors of location i.

Each term corresponds to a squared, standardized conditional residual:

r_i = u_i - A_i u_{N(i)}

and the quadratic form is:

\sum_i \frac{r_i^2}{D_i}

This provides an efficient way to evaluate the Gaussian log-likelihood under the NNGP approximation.

Value

A scalar value representing the quadratic form:

\sum_{i=1}^M \frac{\left(u_i - A_i u_{N(i)}\right) \left(v_i - A_i v_{N(i)}\right)}{D_i}

Author(s)

Fabian Ketwaroo

See Also

computeAD


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