interpolate_spline: Splines on the sphere

Description Usage Arguments Details Value Author(s) References Examples

View source: R/smooth_sphere.R

Description

Spline interpolation and smoothing on the sphere.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
interpolate_spline(
  observations,
  targets,
  value,
  lon_obs = lon,
  lat_obs = lat,
  lon_targets = lon,
  lat_targets = lat,
  k = 50
)

Arguments

observations

data.frame of observations.

targets

data.frame of locations to calculate the interpolated and smoothed values for (target points).

value

Column with values in observations.

lon_obs

Column in observations with longitude (lon is default).

lat_obs

Column in observations with latitude (lat is default).

lon_targets

Column in targets with longitude (lon is default).

lat_targets

Column in targets with latitude (lat is default).

k

(default 50) is the basis dimension. For small data sets reduce k manually rather than using default.

Details

observations should include at least columns for longitude and latitude.

targets should include at least columns for longitude, latitude and value of interest to interpolate and smooth.

A smooth of the general type discussed in Duchon (1977) is used: the sphere is embedded in a 3D Euclidean space, but smoothing employs a penalty based on second derivatives (so that locally as the smoothing parameter tends to zero we recover a "normal" thin plate spline on the tangent space). This is an unpublished suggestion of Jean Duchon.

See ordinary kriging for interpolation and smoothing on the sphere by means of kriging.

Value

Object equal to object targets including an extra column with predicted values.

Author(s)

Martin Haringa

References

Splines on the sphere

Examples

1
2
3
4
5
6
7
8
## Not run: 
target <- sf::st_drop_geometry(nl_postcode3)
obs <- dplyr::sample_n(insurance, 1000)
pop_df <- interpolate_spline(obs, target, population_pc4, k = 20)
pop_sf <- left_join(nl_postcode3, pop_df)
choropleth(pop_sf, value = "population_pc4_pred", n = 13)

## End(Not run)

spatialrisk documentation built on Nov. 10, 2021, 5:09 p.m.