
Compute Diffusion Matrix Based on Gravity Model
Source:R/calc_diffusion_matrix_pi.R
calc_diffusion_matrix_pi.RdComputes a connectivity matrix \(\pi_{ij}\) between locations using a normalized gravity model.
Details
The normalized gravity model has the following form:
$$\pi_{ij} = \frac{N_j^\omega \, d_{ij}^{-\gamma}}{\sum_{j \ne i} N_j^\omega \, d_{ij}^{-\gamma}}, \quad \forall \; i,\, j$$
where \(d_{ij}\) is the distance between locations \(i\) and \(j\), and \(N_j\) is the population
or weight of location \(j\). The diagonal of the output matrix is set to NA, as \(\pi_{ij}\) is intended
to be used conditionally alongside the departure probability \(\tau_i\).