Lecture 8
Mobility models for
urban behavior

Esteban Moro

Network Science Institute | Northeastern University

NETS 7983 Computational Urban Science

2025-03-31

Welcome!

This week:

Mobility models for urban behavior

You are here

Data -> Methods -> Models -> Applications.

Aims

  • Understand the main properties of human mobility in urban areas.
  • Introduce the main models to describe human mobility in urban areas at individual and aggregated levels.
  • Understand how to fit and compare the models.
  • Discuss the main strengths and limitations of the models.

Contents

  • Introduction
  • Population-level models
  • Individual-level models
  • Conclusions
  • Further reading

Introduction

Introduction

Mobility models are used to describe the movement of individuals in a city.

  • They are essential for urban planning, traffic management, and public transportation planning.

  • They are used to predict the spread of diseases, the distribution of resources, and the impact of new policies.

  • They are used to understand the behavior of individuals and their relationship with the structure of cities.

  • They serve as null models to investigate the impact of different factors on the movement of individuals.

Introduction

There are two main types of mobility models:

  1. Population-level models: describe the behavior of a large number of individuals in a population and are used to describe typically flows, i.e. the origin-destination matrix of trips in a city.
  2. Individual-level models: describe the movement of individuals in a city and incorporate more detailed information about the behavior of individuals.

Population-level models

Population-level models

Population-level models are used to describe the behavior of many individuals in a population.

Aggregating over a large number of individuals has several consequences:

  • We average out potential individual differences.
  • We can focus on the most important aspects of the mobility behavior.
  • We can make better predictions because we have more statistical significance in the observations.
  • We reduce the potential privacy concerns of individual-level models.

Population-level models

At aggregated level, human mobility is affected by:

  • The population of the areas.
  • The opportunities in the areas.
  • The distance between the areas.
  • And other temporal factors like the time of the day, the day of the week, or the season.

Population-level models

Population level models typically describe the origin-destination (OD) matrix of trips in a city.

The OD matrix is a square matrix that describes the number of trips or people \(T_{ij}\) between each pair of zones or places.

Population-level models

These matrices are used in many applications, such as (see [1])

  • Urban planning. [2]
  • Traffic management. [3]
  • Public transportation planning. [4]
  • Emergency response planning.
  • Retail location planning.
  • Economic development [5]
  • Epidemic spreading [6]

Population-level models

There are many sources of OD matrices:

Gravity models

Gravity models are a class of population-level models that describe the number of trips between two zones as a function of the characteristics of the zones and the distance between them.

They are inspired by Newton’s law of gravitation and by the idea that distance impedes movement and opportunities create them. Although they can be derived from the principle of maximum entropy [7], they are typically phenomenological. The simplest form of a gravity model is:

\[ T_{ij} = k \frac{P_i O_j}{f(d_{ij})} \]

where \(T_{ij}\) is the number of trips between zones \(i\) and \(j\), \(P_i\) is the population of the zone \(i\), \(O_j\) is the number of opportunities in the area \(j\), \(d_{ij}\) is the distance between the zones and \(f(d_{ij})\) is a (increasing) function of the distance.

Gravity models

The function \(f(d_{ij})\) is typically a power-law function of the distance:

\[ f(d_{ij}) = d_{ij}^\beta \]

where \(\beta\) is a parameter that describes how the number of trips decreases with distance. Other functions can be used, such as

  • exponential functions \(f(d_{ij}) = e^{\alpha d_{ij}}\).
  • cut-off functions like \(f(d_{ij}) = d_0 + d_{ij}\).

Also, the distance can be the travel time between the zones, or include any other type of demographic or economic distance between areas \(i\) and \(j\).

Gravity models

Generalization: Gravity models can be generalized to include more complex dependencies with the population and opportunities of the zones. Also assuming that \(O_j \sim P_j\) we get

\[ T_{ij} = k \frac{P_i^{\alpha_i} P_j^{\alpha_j}}{f(d_{ij})} \]

Fitting the gravity model: As we will see in our practical, there are many ways to get the exponents defining the gravity models. Typically we use a log-linear regression to fit the model:

\[ \log T_{ij} \sim \log k + \alpha_i \log P_i + \alpha_j \log P_j - \beta \log d_{ij} \]

Although there are many ways to fit the model, including:

  • A non-linear least square regression directly to \(T_{ij} \sim k P_i^{\alpha_i} P_j^{\alpha_j} / f(d_{ij})\)
  • Since \(T_{ij}\) is typically an integer number, we can use a Poisson regression to fit the model.

Constrained Gravity models

The model obtained might fit correctly individual pairs of flows \(T_{ij}\). However, it might not be able to reproduce the total number of trips originating from an area exactly. To solve this problem, we can use a constrained gravity model to keep \(T_i\) the total number of trips from an area \(i\) to all other areas fixed:

\[ T_{ij} = T_i \frac{P_j / f(d_{ij})}{\sum_k P_k / f(d_{ik})} \]

  • These models are typically fitted using optimization techniques using the log-likelihood function.
  • The model can be generalized to have double-constrained flows, origin \(T_i\) and destination. \(T_j\).

Huff model

The Huff model is a particular example of the gravity model that is used to describe the distribution of trips to retail locations. The model calculates the probability that we have a visit to a store \(j\) given that we are in a zone \(i\):

The model is:

\[ P_{ij} = \frac{A_j^\alpha/f(d_{ij})}{\sum_{k} A_k^\alpha/f(d_{ik})} \]

where \(A_i\) is the attractiveness of the zone \(i\), and the sum runs over all stores in the city

  • The Huff model is a widely used tool in location intelligence.
  • The model can be fitted using the same techniques as the gravity model.
  • The attractiveness of \(i\) is typically proxied through the size of the venue, the number of visitors, or the number of products in the store.

Gravity models

Strengths:

  • Simple
  • Interpretable
  • Widely used in transportation models

Limitations:

  • Ignores network effects, i.e., that flow \(T_{ij}\) might depend on the flows of other pairs of zones.
  • Ignores the heterogeneity of individuals, i.e. that the number of trips might depend on the characteristics of the individuals.
  • In general, they are static models, but flows might depend on the time of the day, the day of the week, or the season.

Radiation model

In gravity models, we assume a direct relationship between distance and mobility. Mobility happens less to far away places. However, in many cases, mobility is determined not only by distance but also by opportunities between the origin and destination zones.

This is the famous model of intervening opportunities [8], where the probability of going from \(i\) to \(j\) is proportional to the opportunities in \(j\) and inversely proportional to the number of opportunities between them.

  • For example, think about deciding to go to a grocery store. The one you choose is probably a combination of how good it is for you but also inversely proportional to the number of stores in between that you have not selected.

  • In some sense, the intervening opportunities idea redefines the distance between places \(i\) and \(j\) as the number of opportunities in between them.

Radiation model

The radiation model [9] is a gravity model that uses the idea of intervening opportunities to explain the flows between areas \(i\) and \(j\)

  • Suppose that opportunities in area \(i\) are proportional to population \(P_i\).
  • The idea is that trips emanate from area \(i\) and radiate from it until they reach area \(j\). The probability that they end up in \(j\) is then given by the radiation law:

\[ p_{ij} = \frac{P_i P_j}{(P_i + s_{ij})(P_i + P_j + s_{ij})} \]

where \(s_{ij}\) is the population of the areas within radius \(d_{ij}\) from \(i\) to \(j\).

Radiation model, from [9]

Radiation model

If we multiply by the total number of flows from \(i\) to all other areas, we get the number of trips from \(i\) to \(j\):

\[ T_{ij} = T_i \frac{P_i P_j}{(P_i + s_{ij})(P_i + P_j + s_{ij})} \]

Note that:

  • There is no parameter to fit in the model.
  • The right-hand side of the equation is a function of the population of the areas \(i\) and \(j\) and the population (or intervening opportunities) of the areas in between them.
  • Thus, the model incorporates the population’s heterogeneity and the city’s opportunities.
  • This is the main difference with gravity models, which assume homogeneity in the distance between areas.

Deep learning methods

Of course, we can use deep learning methods to predict the flows between areas and the properties of those areas. The recent Deep Gravity Model is an example of that [10]. Apart from population and distances, using land use, road networks, type of POIs, and many other features of areas, the Deep Gravity model, expectedly, shows more performance than simple gravity models:

Architecture of the Deep Gravity model, from [10]

Other models

In a recent paper, we used data and Bayesian symbolic regression to find the best model to describe commuting flows in the US [11]. We found still flows can be accurately described by simple closed analytical gravity-like models

Examples of gravity-like models found in [11]

Comparison between models

To compare the models, we have to define their error. We typically use

  • The mean squared error (MSE) between the predicted and the observed flows.
  • The mean absolute error (MAE) between the predicted and the observed flows.
  • The \(R^2\) or correlation between the predicted and the observed flows.
  • The most common metric used to evaluate the performance of flow generation models is the Common Part of Commuters (CPC) index:

\[ CPC = \frac{2 \sum_{ij} \text{min}(T_{it},\hat T_{ij})}{\sum_{ij} T_{ij} + \sum_{ij} \hat T_{ij}} \]

where \(T_{ij}\) is the observed flow and \(\hat T_{ij}\) is the predicted flow.

Comparison between models

For example, in [12], they found that the gravity law performs better than the radiation model in predicting commuting flows.

Comparison between models to describe commuting flows, from [12]

Comparison between models

In [10], the Deep Gravity model was better than gravity models at describing the commuting and daily flows between areas in the UK, US, and Italy.

Deep Gravity performance, from [10]

Comparison between models

However, using Bayesian symbolic regression [11], we found that simple gravity models are better than deep learning models to describe the commuting flows in the US.

Comparison between models to describe commuting flows, from [11]

Individual-level models

Individual-level models

Individual-level models describe the movement of individuals in a city and incorporate more detailed information about the behavior of individuals.

  • They are based on the idea of simulating agents that move around the city according to their preferences and constraints, leading to a degree of stochasticity in the trip patterns

  • Minimal models thus borrow the concept of random walks or probabilistic methods in the city, where individuals move from one place to another according to probability distributions and are subject to some constraints like home, work, etc.

  • However, as we will see, several studies have shown that the movement of individuals is not random, but instead follows some patterns that can be described by simple rules and can be exploited to predict the movement of individuals.

Individual-level models

The initial studies of large-scale mobility data show precisely that:

  1. The area covered by an individual \(R(t)\) and the number of different places \(S(t)\) as a function of time does not scale like \(R(t) \sim t^{1/2}\) and \(S(t) \sim t\) as in random walks and, but rather like \(R(t) \sim t^{\alpha}\) and \(S(t)\sim t^\mu\), where \(\alpha\) is smaller than \(1/2\) (subdiffusive) and \(\mu < 1\). [13]

  2. Humans tend to return to the same places over and over again, a phenomenon known as returners, something that random walks do not capture. [14]

  3. As opposed to random walks, the trajectories of individuals are highly predictable. Around 80-90% of our movements are predictable [14].

  4. Individuals spend most of their time in few places. Actually probability of visiting a place decays like. \(P(n) \sim 1/n^\xi\) [15], as oppose to the uniform distribution obtained in random walks.

Exploration and Preferential Return model

All those phenomena show us that models based on Continuous Time Random Walks (CTRW) [13] cannot reproduce the returning and predictability and submissive character of human movement.

A more realistic model is the Exploration and Preferential Return model [14], where individuals explore new places and return to the places they have visited before.

  • The model is based on the idea that individuals have a memory of the places they have visited before, and the probability of visiting a place is proportional to the number of times they have visited it before.

  • The model can reproduce the subdiffusive character of human movement, the returning behavior, and the predictability of human trajectories.

Exploration and Preferential Return model

The EPR model has two processes. If \(S_T\) is the number of places visited at time \(T\) and \(f_i\) is the frequency of visits to place \(i\) by the user, at time \(T+1\) the user decides

  • With probability \(P_{new} = \rho/S_T^\gamma\) the user explores a new place not visited before.
  • With probability \(1-P_{new}\) the user returns to a place \(i\) visited before with probability \(\Pi_i \sim f_i\).

Exploration and Preferential Return model

The model can be solved analytically and the number of places visited by the user at time \(T\) after \(N\) movements is given by:

\[ S_T = [1+ \rho (1+\gamma)N]^{1/(1+\gamma)} \] In the asymptotic regime, we also get the probability that the user visit a place \(n\) times is given by:

\[ P(n) \sim \frac{1}{n^{(2+\gamma)/(1+\gamma)}} \]

The predictability of the EPR model is, of course, inverse proportional to \(\rho\).

As we can see, the model reproduces the subdiffusive character of human movement, the frequency of visitation of places and the predictability of human trajectories with only two parameters \(\rho\) and \(\alpha\).

Exploration and Preferential Return model

Different papers have found that real data matches the microscopic details of the EPR model and the macro descriptions of human mobility. For example, in [14], using CDR data, they found that \(P_{new} \sim \rho/S_T^\gamma\) with \(\gamma = 0.21 \pm 0.02\) and that \(\rho\) is distributed as a normal distribution with mean \(\rho \simeq 0.6\)

Comparison between the EPR model and real data, from [14]

Exploration and Preferential Return model

The same results were found by Moro et al. [16] using mobile phone data. Remarkably, using a different dataset they found that \(\gamma = 0.23 \pm 0.01\).

Comparison between the EPR model and real data, from [16]

Exploration and Preferential Return model

The EPR model has been extended to incorporate more complex human behaviors, like

  • Distance gravity-like constraints to next place visits [17]

  • The effect of recency, i.e. the probability of returning to a place is more likely to recently visited places [18]

  • Place relevance, i.e,. the fact that exploration and depends on the relevance of the place [19]

Exploration and Preferential Return model

  • Social preferences (segregation) in the exploration phase [16]

The social-EPR model from [16]

Exploration and Preferential Return model

  • Or different types of exploration and preferential return depending on the present place (TimeGeo model) [20]

The TimeGeo framework from [20]

Container model

The EPR models are based on places. However, the model does not take into account the fact that places are not isolated. For example, we might decide to go to a mall, shop in a store within it, and have dinner in another place. That is, places have hierarchies. The Container model [21] incorporates that hierarchy in which places are part of a container, and the distance in the hierarchy gives the distance between containers.

The model reproduces the area covered by users, the number of places visited, and the predictability of human trajectories much better. Furthermore, it gives an intuition as to why humans seem to have power-law distributions in their traveled distance.

The container model [21]

Deep learning models

The models we have seen are based on simple rules and can reproduce the main features of human mobility. However, they are not able to capture the complexity of human behavior. In particular

  • They do not include the complex sequential transition regularities. For example, transition from home to office is more likely in workday mornings than weekday mornings.

  • As we mentioned before, there is often multi-level periodicity (daily, weekly, monthly) in human mobility that simple models do not capture.

  • Finally, mobility data is often noisy and incomplete, and is difficult to train algorithms to predict the movement of individuals.

Deep learning models

For these reasons, in the last years, there has been an increasing use of deep learning models to model and predict human mobility, due to their ability to capture complex patterns in the data. Methods like LSTM, RNN, GAN, and more recently, LLMs, with their attention mechanisms, can easily incorporate the exploration and returning behavior of individuals, the periodicity of human mobility, and tackle the noise in the data.

Some methods:

  • GANs: use Generative Adversarial Networks to generate synthetic trajectories, e.g. trajGAN by [22].
  • LSTM: use Long Short Term Memory and GANs to generate synthetic trajectories, e.g. [23]
  • GTPs or LLM: leverage Generative Pre-trained Transformers or Large Language Models to generate synthetic trajectories, e.g. mobilityGPT by [24] and GPT-2 in [25].
  • A review about deep learning models in human mobility can be found in [26]

Those methods have been shown to be able to generate synthetic trajectories that are more similar to real data but lack the interpretability of simple models.

Conclusions

Understanding human mobility in urban areas is critical for understanding urban behavior and designing better cities.

  • Human mobility is very complex and depends on many factors, such as the area’s population, the area’s opportunities, the distance between the areas, the time of the day, the day of the week, and the season.

  • But most of our mobility is very repetitive and can be described by simple rules, such as the Exploration and Preferential Return model.

  • At aggregated levels, gravity models are widely used to describe the origin-destination matrix of trips in a city.

  • Mobility Models can predict the spread of diseases, the distribution of resources, and the impact of new policies.

  • However, they could also be null models to investigate the impact of different factors on the movement of individuals.

Conclusions

The aggregated and individual models considered have several limitations.

  • The most fundamental is that they do not incorporate interaction between trajectories.
    • For example, in the EPR model, the decision to visit a place might be influenced by who and how other people visit that place
    • In the gravity models, the flow of people \(T_{ij}\) might be correlated with \(T_{ik}\) or depend on large network subgraphs.
  • Most fitted models in one area have problems reproducing the behavior in other areas.
    • For example, we recently found that the EPR model might not work for low-income and high-dense areas, as we found in [27].
    • Or the gravity model might not work in cities where people have large access to public transportation or work, creating large flows between distant areas.

Further reading

  • Human mobility: Models and Applications by Barbosa et al. [7]
  • Modeling the scaling properties of human mobility by Song et al [28]
  • The scales of human mobility by Alessandretti et al [21]
  • The universal visitation law of human mobility by Simini et al [9]
  • Urban-EPR: a universal model for simulating individual and population mobility by Jin et al [29]
  • Review about deep learning models in human mobility can be found in [26]

References

[1]
C. Rong, J. Ding, and Y. Li, “An Interdisciplinary Survey on Origin-destination Flows Modeling: Theory and Techniques,” ACM Comput. Surv., vol. 57, no. 1, pp. 4:1–4:49, Oct. 2024, doi: 10.1145/3682058.
[2]
T. Yang, “Understanding commuting patterns and changes: Counterfactual analysis in a planning support framework,” Environment and planning b: urban analytics and city science, vol. 47, no. 8, pp. 1440–1455, 2020.
[3]
J. L. Toole, S. Colak, B. Sturt, L. P. Alexander, A. Evsukoff, and M. C. González, “The path most traveled: Travel demand estimation using big data resources,” Transportation Research Part C: Emerging Technologies, vol. 58, pp. 162–177, Sep. 2015, doi: 10.1016/j.trc.2015.04.022.
[4]
X. Zhan, S. Hasan, S. V. Ukkusuri, and C. Kamga, “Urban link travel time estimation using large-scale taxi data with partial information,” Transportation Research Part C: Emerging Technologies, vol. 33, pp. 37–49, 2013.
[5]
J. P. LeSage and M. M. Fischer, “Spatial econometric methods for modeling origin-destination flows,” in Handbook of applied spatial analysis: Software tools, methods and applications, Springer, 2009, pp. 409–433.
[6]
D. Balcan, V. Colizza, B. Gonçalves, H. Hu, J. J. Ramasco, and A. Vespignani, “Multiscale mobility networks and the spatial spreading of infectious diseases,” Proceedings of the national academy of sciences, vol. 106, no. 51, pp. 21484–21489, 2009.
[7]
H. Barbosa et al., “Human mobility: Models and applications,” Physics Reports, vol. 734, pp. 1–74, Mar. 2018, doi: 10.1016/j.physrep.2018.01.001.
[8]
S. A. Stouffer, “Intervening Opportunities: A Theory Relating Mobility and Distance,” American Sociological Review, vol. 5, no. 6, pp. 845–867, 1940, doi: 10.2307/2084520.
[9]
F. Simini, M. C. González, A. Maritan, and A.-L. Barabási, “A universal model for mobility and migration patterns,” Nature, vol. 484, no. 7392, pp. 96–100, Apr. 2012, doi: 10.1038/nature10856.
[10]
F. Simini, G. Barlacchi, M. Luca, and L. Pappalardo, “A Deep Gravity model for mobility flows generation,” Nature Communications, vol. 12, no. 1, p. 6576, Nov. 2021, doi: 10.1038/s41467-021-26752-4.
[11]
O. Cabanas-Tirapu, L. Danús, E. Moro, M. Sales-Pardo, and R. Guimerà, “Human mobility is well described by closed-form gravity-like models learned automatically from data,” Nature Communications, vol. 16, no. 1, p. 1336, Feb. 2025, doi: 10.1038/s41467-025-56495-5.
[12]
M. Lenormand, A. Bassolas, and J. J. Ramasco, “Systematic comparison of trip distribution laws and models,” Journal of Transport Geography, vol. 51, pp. 158–169, Feb. 2016, doi: 10.1016/j.jtrangeo.2015.12.008.
[13]
D. Brockmann, L. Hufnagel, and T. Geisel, “The scaling laws of human travel,” Nature, vol. 439, no. 7075, pp. 462–465, Jan. 2006, doi: 10.1038/nature04292.
[14]
C. Song, Z. Qu, N. Blumm, and A.-L. Barabási, “Limits of Predictability in Human Mobility,” Science, vol. 327, no. 5968, pp. 1018–1021, Feb. 2010, doi: 10.1126/science.1177170.
[15]
M. C. González, C. A. Hidalgo, and A.-L. Barabási, “Understanding individual human mobility patterns,” Nature, vol. 453, no. 7196, pp. 779–782, Jun. 2008, doi: 10.1038/nature06958.
[16]
E. Moro, D. Calacci, X. Dong, and A. Pentland, “Mobility patterns are associated with experienced income segregation in large US cities,” Nature Communications, vol. 12, no. 1, pp. 1–10, Jul. 2021, doi: 10.1038/s41467-021-24899-8.
[17]
L. Pappalardo, S. Rinzivillo, and F. Simini, “Human Mobility Modelling: Exploration and Preferential Return Meet the Gravity Model,” Procedia Computer Science, vol. 83, pp. 934–939, Jan. 2016, doi: 10.1016/j.procs.2016.04.188.
[18]
H. Barbosa, F. B. de Lima-Neto, A. Evsukoff, and R. Menezes, “The effect of recency to human mobility,” EPJ Data Science, vol. 4, no. 1, pp. 1–14, Dec. 2015, doi: 10.1140/epjds/s13688-015-0059-8.
[19]
L. Pappalardo, F. Simini, S. Rinzivillo, D. Pedreschi, F. Giannotti, and A.-L. Barabási, “Returners and explorers dichotomy in human mobility,” Nature Communications, vol. 6, no. 1, pp. 1–8, Sep. 2015, doi: 10.1038/ncomms9166.
[20]
S. Jiang, Y. Yang, S. Gupta, D. Veneziano, S. Athavale, and M. C. González, “The TimeGeo modeling framework for urban mobility without travel surveys,” Proceedings of the National Academy of Sciences, vol. 113, no. 37, pp. E5370–E5378, Sep. 2016, doi: 10.1073/pnas.1524261113.
[21]
L. Alessandretti, U. Aslak, and S. Lehmann, “The scales of human mobility,” Nature, vol. 587, no. 7834, pp. 402–407, Nov. 2020, doi: 10.1038/s41586-020-2909-1.
[22]
X. Liu, H. Chen, and C. Andris, “trajGANs: Using generative adversarial networks for geo-privacy protection of trajectory data (vision paper),” in Location privacy and security workshop, 2018, pp. 1–7.
[23]
X. Wang, X. Liu, Z. Lu, and H. Yang, “Large scale GPS trajectory generation using map based on two stage GAN,” Journal of Data Science, vol. 19, no. 1, pp. 126–141, 2021.
[24]
A. Haydari, D. Chen, Z. Lai, M. Zhang, and C.-N. Chuah, “Mobilitygpt: Enhanced human mobility modeling with a gpt model,” arXiv preprint arXiv:2402.03264, 2024.
[25]
T. Mizuno, S. Fujimoto, and A. Ishikawa, “Generation of individual daily trajectories by GPT-2,” Frontiers in Physics, vol. 10, Nov. 2022, doi: 10.3389/fphy.2022.1021176.
[26]
M. Luca, G. Barlacchi, B. Lepri, and L. Pappalardo, “A Survey on Deep Learning for Human Mobility.” arXiv, Jun. 2021. doi: 10.48550/arXiv.2012.02825.
[27]
L. Napoli, M. Karsai, and E. Moro, “One rule does not fit all: Deviations from universality in human mobility modeling.” arXiv, Oct. 2024. doi: 10.48550/arXiv.2410.23502.
[28]
C. Song, T. Koren, P. Wang, and A.-L. Barabási, “Modelling the scaling properties of human mobility,” Nature Physics, vol. 6, no. 10, pp. 818–823, Oct. 2010, doi: 10.1038/nphys1760.
[29]
X. Jin, K. Liu, Z. Cao, L. Yin, Y. Luo, and X. Zhao, “Urban-EPR: A universal model for simulating individual human mobility within intra-urban areas,” International Journal of Geographical Information Science, vol. 0, no. 0, pp. 1–34, doi: 10.1080/13658816.2025.2456558.