areal_spatial_bisquare {stcos}R Documentation

Areal Spatial Bisquare Basis

Description

Spatial bisquare basis on areal data.

Usage

areal_spatial_bisquare(dom, knots, w, control = NULL)

Arguments

dom

An sf or sfc object with areas A_1, \ldots, A_n to evaluate.

knots

Knots \bm{c}_1, \ldots, \bm{c}_r for the basis. See "Details".

w

Radius for the basis.

control

A list of control arguments. See "Details".

Details

Notes about arguments:

For each area A in the given domain, compute an the basis functions

\bar{\varphi}_j(A) = \frac{1}{|A|} \int_A \varphi_j(\bm{u}) d\bm{u}

for j = 1, \ldots, r. Here, \varphi_j(\bm{u}) represent spatial_bisquare basis functions defined at the point level using \bm{c}_j and w.

The basis requires an integration which may be computed using one of two methods. The mc method uses

\bar{\varphi}_j(A) \approx \frac{1}{Q} \sum_{q=1}^Q \varphi_j(\bm{u}_q),

based on a random sample of locations \bm{u}_1, \ldots, \bm{u}_Q from a uniform distribution on area A. The rect method uses a simple quadrature approximation

\bar{\varphi}_j(A) \approx \frac{1}{|A|} \sum_{a=1}^{n_x} \sum_{b=1}^{n_y} \varphi_j(\bm{u}_{ab}) I(\bm{u}_{ab} \in A) \Delta_x \Delta_y.

Here, the bounding box st_bbox(A) is divided evenly into a grid of n_x \times n_y rectangles, each of size \Delta_x \times \Delta_y. Each \bm{u}_{ab} = (u_a, u_b) is a point from the (a,b)th rectangle, for a = 1, \ldots, n_x and b = 1, \ldots, n_y.

Due to the treatment of A_i and \bm{c}_j as objects in a Euclidean space, this basis is more suitable for coordinates from a map projection than coordinates based on a globe representation.

The control argument is a list which may provide any of the following:

Value

A sparse n \times r matrix whose ith row is \bm{s}_i^\top = \Big( \bar{\varphi}_1(A_i), \ldots, \bar{\varphi}_r(A_i) \Big).

See Also

Other bisquare: areal_spacetime_bisquare(), spacetime_bisquare(), spatial_bisquare()

Examples

set.seed(1234)

# Create knot points
seq_x = seq(0, 1, length.out = 3)
seq_y = seq(0, 1, length.out = 3)
knots = expand.grid(x = seq_x, y = seq_y)
knots_sf = st_as_sf(knots, coords = c("x","y"), crs = NA, agr = "constant")

# Create a simple domain (of rectangles) to evaluate
shape1 = matrix(c(0.0,0.0, 0.5,0.0, 0.5,0.5, 0.0,0.5, 0.0,0.0), ncol=2, byrow=TRUE)
shape2 = shape1 + cbind(rep(0.5,5), rep(0.0,5))
shape3 = shape1 + cbind(rep(0.0,5), rep(0.5,5))
shape4 = shape1 + cbind(rep(0.5,5), rep(0.5,5))
sfc = st_sfc(
   st_polygon(list(shape1)),
   st_polygon(list(shape2)),
   st_polygon(list(shape3)),
   st_polygon(list(shape4))
)
dom = st_sf(data.frame(geoid = 1:length(sfc), geom = sfc))

rad = 0.5
areal_spatial_bisquare(dom, knots, rad)
areal_spatial_bisquare(dom, knots_sf, rad)

# Plot the knots and the points at which we evaluated the basis
plot(knots[,1], knots[,2], pch = 4, cex = 1.5, col = "red")
plot(dom[,1], col = NA, add = TRUE)

# Draw a circle representing the basis' radius around one of the knot points
tseq = seq(0, 2*pi, length=100) 
coords = cbind(rad * cos(tseq) + seq_x[2], rad * sin(tseq) + seq_y[2])
lines(coords, col = "red")


[Package stcos version 0.3.1 Index]