Learn R Programming

VeccTMVN (version 1.3.1)

get_sp_inv_chol: Get the inverse upper Cholesky factor under the Vecchia approximation

Description

Get the inverse upper Cholesky factor under the Vecchia approximation

Usage

get_sp_inv_chol(covMat, NNarray)

Value

upper Cholesky of the inverse of `covMat`

Arguments

covMat

the covariance matrix

NNarray

n X (m + 1) matrix representing the nearest neighbor indices among previous observations. This is typically the return of GpGp::find_ordered_nn

Examples

Run this code
library(GpGp)
n1 <- 10
n2 <- 10
n <- n1 * n2
locs <- as.matrix(expand.grid((1:n1) / n1, (1:n2) / n2))
covparms <- c(2, 0.3, 0)
cov_mat <- GpGp::matern15_isotropic(covparms, locs)
m <- 30
NNarray <- GpGp::find_ordered_nn(locs, m = m)
# Vecchia approx --------------------------------
U_Vecc <- get_sp_inv_chol(cov_mat, NNarray)
U <- solve(chol(cov_mat))
cat("Frobenius norm of the difference is", sqrt(sum((U - U_Vecc)^2)))

Run the code above in your browser using DataLab