pycnophy: Pycnophylactic interpolation.

View source: R/pycno.R

pycnophyR Documentation

Pycnophylactic interpolation.

Description

Given a SpatVector of polygons and population data for each polygon, compute a population density estimate based on Tobler's pycnophylactic interpolation algorithm.

Usage

pycnophy(x, v, pop, r = 0.2, converge = 3, verbose=FALSE)

Arguments

x

SpatRaster to interpolate to

v

SpatVector of polygons

pop

Either a character (name in v) or a numeric vector of length nrow(v)

r

A relaxation parameter for the iterative step in the pycnophylactic algorithm. Prevents over-compensation in the smoothing step. In practice the default value works well

converge

A convergence parameter, informing the decision on when iterative improvements on the smooth surface have converged sufficiently - see details

verbose

If TRUE the function report the maximum change in any grid cell value for each iterative step

Details

This method uses an iterative approach, and for each iteration notes the maximum change in a pixel. When this value falls below a certain level (10^(-converge) times the largest initial grid cell value) the iteration stops.

Value

SpatRaster

Note

Pycnophylatic interpolation has the property that the sum of the estimated values associated with all of the pixels in any polygon equals the supplied population for that polygon. A further property is that all pixel values are greater than or equal to zero. The method is generally used to obtain pixel-based population estimates when total populations for a set of irregular polygons (eg. counties) are known.

Author(s)

Chris Brunsdon (adapted for terra objects by Robert Hijmans)

References

Tobler, W.R. (1979) Smooth Pycnophylactic Interpolation for Geographical Regions. Journal of the American Statistical Association, v74(367) pp. 519-530.

Examples

f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
r <- rast(v, resolution = 0.01)
p <- pycnophy(r, v, "POP", converge=3, verbose=FALSE)
plot(p); lines(v)

predicts documentation built on Oct. 7, 2024, 9:06 a.m.