mra_wendland_2d {BayesMRA}R Documentation

Code to construct the mutli-resolution sparse basis function representation for fitting spatial processes

Description

Code to construct the mutli-resolution sparse basis function representation for fitting spatial processes

Usage

mra_wendland_2d(
  locs,
  M = 4,
  n_coarse_grid = 10,
  n_padding = 5L,
  n_neighbors = 68,
  use_spam = TRUE
)

Arguments

locs

The location variables in 2 dimensions over which to construct the basis function representation

M

The number of resolutions.

n_coarse_grid

The number of basis functions in one direction (e.g. n_coarse_grid = 10 results in a 10x10 course grid which is further extended by the number of additional padding basis functions given by n_padding.

n_padding

The number of additional boundary points to add on each boundary. For example, n_padding = 5 will add 5 boundary knots to the both the left and right side of the grid).

n_neighbors

The expected number of neighbors for each interior basis function. This determines the basis radius parameter.

use_spam

is a boolean flag to determine whether the output is a list of spam::spam matrix objects (use_spam = TRUE) or a an n x n sparse Matrix of class Matrix::dgCMatrix use_spam = FALSE (see spam and Matrix packages for details).

Value

A list of objects including the MRA knots locations locs_grid, the Wendland basis representation matrix W at the observed locations, the basis radius radius, the numbers of resolutions M, the number of expected neighbors in the interior of each grid n_neighbors, the number of interior basis functions in one direction n_coarse_grid, the number of additional padding basis functions given by n_padding, and the setting use_spam which determines whether the MRA output uses the spam format.

Examples

set.seed(111)
locs <- matrix(runif(20), 10, 2)
MRA <- mra_wendland_2d(locs, M = 2, n_coarse_grid = 4)
## plot the MRA grid at different resolutions
layout(matrix(1:2, 1, 2))
plot(MRA$locs_grid[[1]])
plot(MRA$locs_grid[[2]])


[Package BayesMRA version 1.0.0 Index]