Description Usage Arguments Details Value See Also Examples

View source: R/spatial_bisquare.R

Spatial bisquare basis on point data.

1 | ```
spatial_bisquare(dom, knots, w)
``` |

`dom` |
Points |

`knots` |
Knots |

`w` |
Radius for the basis. |

Notes about arguments:

Both

`dom`

and`knots`

may be provided as either`sf`

or`sfc`

objects, or as matrices of points.If an

`sf`

or`sfc`

object is provided for`dom`

,*n*two-dimensional`POINT`

entries are expected in`st_geometry(dom)`

. Otherwise,`dom`

will be interpreted as an*n \times 2*numeric matrix.If an

`sf`

or`sfc`

object is provided for`knots`

,*r*two-dimensional`POINT`

entries are expected in`st_geometry(knots)`

. Otherwise,`knots`

will be interpreted as an*r \times 2*numeric matrix.If both

`dom`

and`knots`

are given as`sf`

or`sfc`

objects, they will be checked to ensure a common coordinate system.

For each *\bm{u}_i*, compute the basis functions

*
\varphi_j(\bm{u}) =
≤ft[ 1 - \frac{\Vert\bm{u} - \bm{c}_j \Vert^2}{w^2} \right]^2 \cdot
I(\Vert \bm{u} - \bm{c}_j \Vert ≤q w)
*

for *j = 1, …, r*.

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

A sparse *n \times r* matrix whose *i*th row
is
*
\bm{s}_i^\top =
\Big(
\varphi_1(\bm{u}_i), …, \varphi_r(\bm{u}_i)
\Big).
*

Other bisquare:
`areal_spacetime_bisquare()`

,
`areal_spatial_bisquare()`

,
`spacetime_bisquare()`

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 | ```
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")
# Points to evaluate
x = runif(50)
y = runif(50)
pts = data.frame(x = x, y = y)
dom = st_as_sf(pts, coords = c("x","y"), crs = NA, agr = "constant")
rad = 0.5
spatial_bisquare(cbind(x,y), knots, rad)
spatial_bisquare(dom, knots, 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")
points(x, y, cex = 0.5)
# 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")
``` |

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.