Spatial Interaction Modelling is a method for calibrating parameters for components within a system of flows, such as migration or trade, and then using those parameters to estimate new flows. Despite their popularity, a unified Python framework to employ them does not exist. In response, pySI was created as a coherent tool for calibrating models and simulating flows for a variety of models.
Functions from libraries such as scipy.optimize, scipy.spatial, statsmodels, and numdifftools comprise the core of the pySI.calibrate routines, which are automatically constructed depending upon the specified model inputs. As a result, the user can focus on identifying different flow systems and understanding the associated spatial processes, rather than the algorithmic divergences which emerge between different models. After calibration is completed, the estimated parameters and their diagnostic statistics can be reported in a uniform fashion. Using functions within pySI.simulate, the parameter estimates can act as inputs in order to predict new flows. More recently developed models, which do not require input parameters, are also made available, allowing comparisons amongst results from differing conceptual formulations. Finally, results may be visualized with plots and networks via matplotlib, igraph, and networkx. Overall, the pySI framework will increase the accessibility of spatial interaction modelling while also serving as a tool which can help new users understand the associated methodological intricacies.
Within this presentation, the concept of spatial interaction and a few key modelling terms will first be introduced, along with several example applications. Next, two traditional techniques for calibrating spatial interaction models, Poisson generalized linear regression and direct maximum likelihood estimation will be contrasted. It will then be demonstrated how this new framework will allow users to execute either form of calibration using identical input variables, which are based upon a pandas DataFrame specification, without any significant mathematical or statistical training. Results from two different conceptual models will be compared to illustrate how pySI can be used to explore different methods and models of spatial interaction.