mra_wendland_2d: Code to construct the mutli-resolution sparse basis function...

View source: R/mra-wendland-2d.R

mra_wendland_2dR 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,
  max_points = NULL,
  basis_type = "wendland",
  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 10 \times 10 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.

max_points

The expected number of pairs less than or equal to the radius. Default is nrow(locs) * num_neighbors.

basis_type

A string of which basis function type to use. Currently available basis function types are at make_basis()

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 \times n sparse Matrix of class Matrix::dgCMatrix use_spam = FALSE (see spam and Matrix packages for details).

Value

A list of objects including the observation locations locs, 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 basis function dimensions n_dims, the basis function resolution indices dims_idx, 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
plot_MRA_grid(MRA)


jtipton25/BayesMRA documentation built on Feb. 28, 2024, 1:27 p.m.