areal_spacetime_bisquare {stcos}R Documentation

Areal Space-Time Bisquare Basis

Description

Space-Time bisquare basis on areal data.

Usage

areal_spacetime_bisquare(dom, period, knots, w_s, w_t, control = NULL)

Arguments

dom

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

period

A numeric vector of time periods v1,,vmv_1, \ldots, v_m to evaluate for each area.

knots

Spatio-temporal knots (c1,g1),,(cr,gr)(\bm{c}_1,g_1), \ldots, (\bm{c}_r,g_r) for the basis. See "Details".

w_s

Spatial radius for the basis.

w_t

Temporal radius for the basis.

control

A list of control arguments. See "Details".

Details

Notes about arguments:

For each area AA in the given domain, and time period v=(v1,,vm)\bm{v} = (v_1, \ldots, v_m) compute the basis functions

ψj(m)(A,v)=1mk=1m1AAψj(u,vk)du, \psi_j^{(m)}(A, \bm{v}) = \frac{1}{m} \sum_{k=1}^m \frac{1}{|A|} \int_A \psi_j(\bm{u},v_k) d\bm{u},

for j=1,,rj = 1, \ldots, r. Here, φj(u,v)\varphi_j{(\bm{u},v)} represent spacetime_bisquare basis functions defined at the point level using cj\bm{c}_j, gjg_j, wsw_s, and wtw_t.

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

ψj(m)(A,v)1mk=1m1Qq=1Qψj(uq,vk), \psi_j^{(m)}(A, \bm{v}) \approx \frac{1}{m} \sum_{k=1}^m \frac{1}{Q} \sum_{q=1}^Q \psi_j(\bm{u}_q, v_k),

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

ψj(m)(A,v)1mk=1m1Aa=1nxb=1nyψj(uab,vk)I(uabA)ΔxΔy. \psi_j^{(m)}(A, \bm{v}) \approx \frac{1}{m} \sum_{k=1}^m \frac{1}{|A|} \sum_{a=1}^{n_x} \sum_{b=1}^{n_y} \psi_j(\bm{u}_{ab}, v_k) I(\bm{u}_{ab} \in A) \Delta_x \Delta_y.

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

Due to the treatment of AiA_i and cj\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×rn \times r matrix whose iith row is si=(ψ1(m)(Ai),,ψr(m)(Ai)). \bm{s}_i^\top = \Big( \psi_1^{(m)}(A_i), \ldots, \psi_r^{(m)}(A_i) \Big).

See Also

Other bisquare: areal_spatial_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)
seq_t = seq(0, 1, length.out = 3)
knots = expand.grid(x = seq_x, y = seq_y, t = seq_t)
knots_sf = st_as_sf(knots, coords = c("x","y","t"), crs = NA, dim = "XYM", 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
period = c(0.4, 0.7)
areal_spacetime_bisquare(dom, period, knots, w = rad, w_t = 1)
areal_spacetime_bisquare(dom, period, knots_sf, w_s = rad, w_t = 1)

# Plot the (spatial) knots and the (spatial) domain 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]