mcpotential {potential} | R Documentation |
Compute the Potential Model using Parallelization
Description
This function computes the potential model with a cutoff distance and parallel computation.
Usage
mcpotential(x, y, var, fun, span, beta, limit = 3 * span, ncl, size = 500)
Arguments
x |
an sf object (POINT), the set of known observations to estimate the potentials from. |
y |
an sf object (POINT), the set of unknown units for which the function computes the estimates. |
var |
names of the variables in |
fun |
spatial interaction function. Options are "p"
(pareto, power law) or "e" (exponential).
For pareto the interaction is defined as: (1 + alpha * mDistance) ^ (-beta).
For "exponential" the interaction is defined as:
exp(- alpha * mDistance ^ beta).
The alpha parameter is computed from parameters given by the user
( |
span |
distance where the density of probability of the spatial interaction function equals 0.5. |
beta |
impedance factor for the spatial interaction function. |
limit |
maximum distance used to retrieve |
ncl |
number of clusters. |
size |
|
Value
If only one variable is computed a vector is returned, if more than one variable is computed a matrix is returned.
Examples
library(sf)
g <- create_grid(x = n3_poly, res = 20000)
pot <- mcpotential(
x = n3_pt, y = g, var = "POP19",
fun = "e", span = 75000, beta = 2,
limit = 300000,
ncl = 2
)
g$OUTPUT <- pot
equipot <- equipotential(g, var = "OUTPUT", mask = n3_poly)
plot(equipot["center"], pal = hcl.colors(nrow(equipot), "cividis"))