Description Usage Arguments Value Author(s) References Examples

View source: R/help_functions.R

Builds the covariance matrix of *y* (p. 6, Dambon et al. (2021)
doi: 10.1016/j.spasta.2020.100470) for a given set of covariance
parameters and other, pre-defined objects (like the outer-products,
covariance function, and, possibly, a taper matrix).

1 |

`x` |
( |

`cov_func` |
( |

`outer.W` |
( |

`taper` |
( |

Returns a positive-definite covariance matrix y, which is needed in the MLE. Specifically, a Cholesky Decomposition is applied on the covariance matrix.

Jakob Dambon

Dambon, J. A., Sigrist, F., Furrer, R. (2021)
*Maximum likelihood estimation of spatially varying coefficient
models for large data with an application to real estate price prediction*,
Spatial Statistics doi: 10.1016/j.spasta.2020.100470

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ```
# locations
locs <- 1:6
# random effects covariates
W <- cbind(rep(1, 6), 5:10)
# distance matrix with and without tapering
d <- as.matrix(dist(locs))
# distance matrix with and without tapering
tap_dist <- 2
d_tap <- spam::nearest.dist(locs, delta = tap_dist)
# call without tapering
(Sy <- varycoef:::Sigma_y(
x = rep(0.5, 5),
cov_func = function(x) spam::cov.exp(d, x),
outer.W = lapply(1:ncol(W), function(k) W[, k] %o% W[, k])
))
str(Sy)
# call with tapering
(Sy_tap <- varycoef:::Sigma_y(
x = rep(0.5, 5),
cov_func = function(x) spam::cov.exp(d_tap, x),
outer.W = lapply(1:ncol(W), function(k)
spam::as.spam((W[, k] %o% W[, k]) * (d_tap<=tap_dist))
),
taper = spam::cov.wend1(d_tap, c(tap_dist, 1, 0))
))
str(Sy_tap)
# difference between tapered and untapered covariance matrices
Sy-Sy_tap
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.