Learn R Programming

predicts (version 0.1-17)

pycnophy: 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)

Value

SpatRaster

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

Author

Chris Brunsdon (adapted for terra objects by Robert Hijmans)

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.

References

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

Examples

Run this code
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)

Run the code above in your browser using DataLab