Learn R Programming

TDLM

Systematic comparison of trip distribution laws and models



1 Short description

The main purpose of these packages is to provide a rigorous framework for fairly comparing trip distribution laws and models, as described in Lenormand et al. (2016). This general framework relies on a two-step approach to generate mobility flows, separating the trip distribution law, gravity or intervening opportunities, from the modeling approach used to derive flows from this law.

To make this framework more accessible, we developed both an R package and a Python package, which replace the original Java scripts and extend their functionality.

This implementation provides the framework directly in R, making it easy to integrate with existing workflows and statistical tools commonly used by the R community.

2 Install

The TDLM package can be installed with the following command in an R session:

From the CRAN

install.packages("TDLM")

or from GitHub

# install.packages("devtools")
devtools::install_github("RTDLM/TDLM", build_vignettes = TRUE)

3 Tutorial

A tutorial vignette is available here.

4 Dependencies

TDLM depends on the following packages: Ecume, mathjaxr, Rdpack, readr, rmarkdown, and sf.

Additionally, TDLM requires Java to function properly. Please ensure that Java is installed and correctly configured on your system.

5 Citation

Lenormand M (2023) TDLM: An R package for a systematic comparison of trip distribution laws and models. Journal of Open Source Software 8, 5434.

Please feel free to open an issue if you encounter a problem with the package.

Copy Link

Version

Install

install.packages('TDLM')

Monthly Downloads

605

Version

1.1.3

License

GPL-3

Maintainer

Maxime Lenormand

Last Published

October 3rd, 2025

Functions in TDLM (1.1.3)

coords

Geographical coordinates of Kansas counties' centroids (Longitude/Latitude, 2000)
calib_param

Automatic calibration of trip distribution laws' parameter
extract_opportunities

Compute the number of opportunities between pairs of locations
check_format_names

Check format of TDLM's inputs
extract_spatial_information

Extract distances and surface areas from a spatial object
extract_distances

Compute the distance between pairs of locations
run_model

Estimate mobility flows based on different trip distribution models
gof

Compute goodness-of-fit measures between observed and simulated OD matrices
run_law

Estimate mobility flows based on different trip distribution laws
run_law_model

Estimate mobility flows based on different trip distribution laws and models
distance_mtp

Great-circle distances between Hérault municipalities, France
mass

Population and number of out- and in-commuters in Kansas counties, USA (2000)
od_mtp

Origin-Destination commuting matrix for Hérault municipalities, France (2020)
od

Origin-Destination commuting matrix for Kansas counties, USA (2000)
distance

Great-circle distances between Kansas counties, USA
county

Spatial distribution of Kansas counties, USA (2000)
mtp

Spatial distribution of Hérault municipalities, France (2020)
coords_xy

Geographical coordinates of Kansas counties' centroids (X/Y, Web Mercator, 2000)
mass_mtp

Population and number of out- and in-commuters in Hérault municipalities, France (2020)