Learn R Programming

spamtree (version 0.2.2)

CrossCovarianceAG10: Multivariate non-separable cross-covariance function on latent domain of variables.

Description

This function implements the cross-covariance function used in Peruzzi and Dunson (2021), which is derived from eq. 7 in Apanasovich and Genton (2010).

Usage

CrossCovarianceAG10(coords1, mv1, coords2, mv2, 
                    ai1, ai2, phi_i, thetamv, Dmat)

Arguments

coords1

matrix with spatial coordinates

mv1

integer vector with variable IDs. The length must match the number of rows in coords1

coords2

matrix with spatial coordinates

mv2

integer vector with variable IDs. The length must match the number of rows in coords2

ai1

\(q\)-dimensional vector

ai2

\(q\)-dimensional vector

phi_i

\(q\)-dimensional vector

thetamv

for bivariate data (\(q=2\)), this is a scalar. For \(q>2\), this is a vector with elements \(\alpha, \beta, \phi\).

Dmat

symmetric matrix of dimension \((q, q)\) with zeroes on the diagonal and whose \((i,j)\) element is \(\delta_{i,j}\).

Value

The cross-covariance matrix for all pairwise locations.

Details

Suppose we have \(q\) variables. For \(h>0\) and \(\Delta > 0\) define: $$C(h, \Delta) = \frac{ \exp \{ -\phi \|h \| / \exp \{\beta \log(1+\alpha \Delta)/2 \} \} }{ \exp \{ \beta \log(1 + \alpha \Delta) \} } $$ and for \(j=1, \dots, q\), define \(C_j(h) = \exp \{ -\phi_j \|h \| \}\).

Then the cross-covariance between the \(i\)th margin of a \(q\)-variate process \(w(\cdot)\) at spatial location \(s\) and the \(j\)th margin at location \(s'\) is built as follows. For \(i = j\) as $$Cov(w(s, \xi_i), w(s', \xi_j)) = \sigma_{i1}^2 C(h, 0) + \sigma_{i2}^2 C_i(h) ,$$ whereas if \(i \neq j\) it is defined as $$Cov(w(s, \xi_i), w(s', \xi_j)) = \sigma_{i1} \sigma_{i2} C(h, \delta_{ij}),$$ where \(\xi_i\) and \(\xi_j\) are the latent locations of margin \(i\) and \(j\) in the domain of variables and \(\delta_{ij} = \| \xi_i - \xi_j \|\) is their distance in such domain.

References

Apanasovich, T. V. and Genton, M. G. (2010) Cross-covariance functions for multivariate random fields based on latent dimensions. Biometrika, 97:15-30. 10.1093/biomet/asp078

Peruzzi, M. and Dunson, D. B. (2021) Spatial Multivariate Trees for Big Data Bayesian Regression. https://arxiv.org/abs/2012.00943

Examples

Run this code
# NOT RUN {
library(magrittr)
library(dplyr)
library(spamtree)

SS <- 10
xlocs <- seq(0.0, 1, length.out=SS)
coords <- expand.grid(xlocs, xlocs)
c1 <- coords %>% mutate(mv_id=1)
c2 <- coords %>% mutate(mv_id=2)

coords <- bind_rows(c1, c2)
coords_q <- coords %>% dplyr::select(-mv_id)
cx <- coords_q %>% as.matrix()
mv_id <- coords$mv_id

ai1 <- c(1, 1.5)
ai2 <- c(.1, .51)
phi_i <- c(1, 2)
thetamv <- 5

q <- 2
Dmat <- matrix(0, q, q)
Dmat[2,1] <- 1
Dmat[upper.tri(Dmat)] <- Dmat[lower.tri(Dmat)]

CC <- CrossCovarianceAG10(cx, mv_id, cx, mv_id, ai1, ai2, phi_i, thetamv, Dmat)


# }

Run the code above in your browser using DataLab