pycnophy | R Documentation |
Given a SpatVector
of polygons and population data for each polygon, compute a population density estimate based on Tobler's pycnophylactic interpolation algorithm.
pycnophy(x, v, pop, r = 0.2, converge = 3, verbose=FALSE)
x |
SpatRaster to interpolate to |
v |
SpatVector of polygons |
pop |
Either a character (name in |
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 |
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.
SpatRaster
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.
Chris Brunsdon (adapted for terra objects by Robert Hijmans)
Tobler, W.R. (1979) Smooth Pycnophylactic Interpolation for Geographical Regions. Journal of the American Statistical Association, v74(367) pp. 519-530.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.