| computeAD | R Documentation |
Computes the Nearest-Neighbor Gaussian Process (NNGP)
factorization components for each location:
the regression coefficients (A) and conditional variances (D)
following the algorithms described by Finley et al. (2019)
computeAD(edist, nid.dist, neighbors.id, rho, sigma2, k)
edist |
Numeric matrix ( |
nid.dist |
Numeric matrix ( |
neighbors.id |
Integer matrix ( |
rho |
Positive numeric scalar. Length-scale parameter |
sigma2 |
Positive numeric scalar. Marginal variance |
k |
Positive integer. Maximum number of neighbors. |
This function computes the parameters of the NNGP factorization by expressing the joint distribution as a product of conditional Gaussian 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.
For each location i, the conditional distribution is:
x_i \mid x_{N(i)} \sim \mathcal{N}\left( A_i x_{N(i)}, \; D_i \right)
where:
A_i is a vector of regression coefficients
D_i is the conditional variance
These quantities are obtained from the covariance structure:
A_i = C_{i,N(i)} C_{N(i),N(i)}^{-1}
D_i = C_{i,i} - C_{i,N(i)} C_{N(i),N(i)}^{-1} C_{N(i),i}
where:
C_{N(i),N(i)} is the covariance matrix among neighbors
C_{i,N(i)} is the covariance between location i and its neighbors
The covariance structure is defined using an exponential covariance function.
These parameters are used to efficiently evaluate the NNGP likelihood and simulate from the process.
A numeric matrix (M \times (k+1)) where:
First k columns: regression coefficients (A matrix)
Last column: conditional variances (D diagonal entries)
Fabian Ketwaroo
Finley, A. O., Datta, A., Cook, B. D., Morton, D. C., Andersen, H. E., & Banerjee, S. (2019). Efficient algorithms for Bayesian nearest neighbor Gaussian processes. *Journal of Computational and Graphical Statistics*, 28(2), 401–414. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/10618600.2018.1537924")}
coords <- matrix(runif(40), ncol = 2)
Nk = 5
res <- computeNeighbors(coords, k = Nk)
AD <- computeAD(edist = res$edist_sorted,
nid.dist = res$neighbors_dist,
neighbors.id = res$neighbor_idx,
rho = 0.1,
sigma2 = 0.3,
k = Nk)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.