+ - 0:00:00
Notes for current slide
Notes for next slide

From writing code to infoRming policy

🚀
a case study of reproducible research in transport planning

Robin Lovelace, University of Leeds, Institute for Transport Studies

eRum, 2020-06-18 (updated: 2020-06-18) Slides. Code: github.com/Robinlovelace/codeForPolicy

1 / 14

How to inform policy?

The role of data analysis is to make people change their mind, based on the data

2 / 14

Abstract

R provides unparalleled support for reproducible research. Its command-line interface and scriptable nature is revolutionary for people who previously relied on explaining a long series of steps in a graphical user interface to enable others to reproduce their work. Furthermore, R has many tools to enable the efficient replication of results in everything ranging from minimal examples (e.g. via the function dput() and the package reprex) to large projects (e.g. via Makefiles and workflow management packages such as drake).

It has been well-known that reproducibility (and its corollary falsifiability) are cornerstones of science since the time of Karl Popper, but few have considered the implications for policy. This presentation will outline ways in which research design decisions can maximise the chances of informing evidence-based policies. This includes choice of software and the way in which code underlying research is written, maintained and disseminated. Case studies from my work on the Propensity to Cycle Tool (the results of which are freely available at www.pct.bike), which has informed government transport policies, and the package for accessing road traffic casualty data stats19 will illustrate these points. The talk will conclude with concrete steps that everyone can take to maximise the reproducibility of not only their code but also the key results of research to encourage scientific debate and evidence-based decisions.

3 / 14

whoami

system("whoami")
4 / 14

whoami

system("whoami")
  • Environmental geographer
  • Learned R for PhD on energy and transport
  • Now work at the University of Leeds (ITS and LIDA)
  • Focus: Applied geocomputation
  • Strong interest in technology + reproducibility, e.g.:
devtools::install_github("r-rust/gifski")
system("youtube-dl https://youtu.be/CzxeJlgePV4 -o v.mp4")
system("ffmpeg -i v.mp4 -t 00:00:03 -c copy out.mp4")
system("ffmpeg -i out.mp4 frame%04d.png ")
f = list.files(pattern = "frame")
gifski::gifski(f, gif_file = "g.gif", width = 200, height = 200)
4 / 14

whoami

system("whoami")
  • Environmental geographer
  • Learned R for PhD on energy and transport
  • Now work at the University of Leeds (ITS and LIDA)
  • Focus: Applied geocomputation
  • Strong interest in technology + reproducibility, e.g.:
devtools::install_github("r-rust/gifski")
system("youtube-dl https://youtu.be/CzxeJlgePV4 -o v.mp4")
system("ffmpeg -i v.mp4 -t 00:00:03 -c copy out.mp4")
system("ffmpeg -i out.mp4 frame%04d.png ")
f = list.files(pattern = "frame")
gifski::gifski(f, gif_file = "g.gif", width = 200, height = 200)

Image credit: Jeroen Ooms + others

knitr::include_graphics("https://user-images.githubusercontent.com/1825120/39661313-534efd66-5047-11e8-8d99-a5597fe160ff.gif")

4 / 14
5 / 14

Informing policy: the Rapid Cycleway Prioritisation Tool

5 / 14

Communication is vital

6 / 14

Importance of communication: PCT

Source: the Propensity to Cycle Tool (PCT) project, demo at www.pct.bike

7 / 14

Importance of communication: PCT

Source: the Propensity to Cycle Tool (PCT) project, demo at www.pct.bike

Source - https://github.com/npct which hosts national web tool PCT www.pct.bike

7 / 14

Importance of code: stats19

Used by the Parliamentary library to provide evidence for Members of Parliament (MPs): https://commonslibrary.parliament.uk/economy-business/transport/roads/constituency-data-traffic-accidents/

8 / 14

Maximising code impact

Reproducibility

Generalisability

Teamwork

Stability

Visualisation

Packaging

Promotion

Feedback

Adaptability

library(pct)
rnet = get_pct_rnet("west-yorkshire")
mapview::mapview(rnet[rnet$dutch_slc > 500, "dutch_slc"])
rnet[rnet$dutch_slc > 500, "dutch_slc"]
1,0001,5002,0002,500

5 km
5 mi
Leaflet | © OpenStreetMap contributors © CARTO
9 / 14

Example of high (potential) impact: sfnetworks

10 / 14

R for transport planning

Sustainable transport advocates need your help!

Get started:

install.packages("sf")
install.packages("stplanr")
install.packages("osmdata")
11 / 14
12 / 14

Key references/links

Kruschke, J., 2010. Doing Bayesian Data Analysis: A Tutorial Introduction with R. Academic Press.

Lovelace, R., Nowosad, J., Muenchow, J., 2019. Geocomputation with R. CRC Press.

Lovelace, R., Morgan, M., Talbot, J., Lucas-Smith, M., 2020. Methods to prioritise pop-up active transport infrastructure (preprint). Open Science Framework. https://doi.org/10.31219/osf.io/7wjb6

Vicente-Saez, R., Martinez-Fuentes, C., 2018. Open Science now: A systematic literature review for an integrated definition. Journal of Business Research 88, 428–436. https://doi.org/10.1016/j.jbusres.2017.12.043

13 / 14

Key references/links

Kruschke, J., 2010. Doing Bayesian Data Analysis: A Tutorial Introduction with R. Academic Press.

Lovelace, R., Nowosad, J., Muenchow, J., 2019. Geocomputation with R. CRC Press.

Lovelace, R., Morgan, M., Talbot, J., Lucas-Smith, M., 2020. Methods to prioritise pop-up active transport infrastructure (preprint). Open Science Framework. https://doi.org/10.31219/osf.io/7wjb6

Vicente-Saez, R., Martinez-Fuentes, C., 2018. Open Science now: A systematic literature review for an integrated definition. Journal of Business Research 88, 428–436. https://doi.org/10.1016/j.jbusres.2017.12.043

Even better than reading academic papers...

Contact local civil society / advocacy / campaigning groups offering your skills

13 / 14

Thanks

Contact me at r. lovelace at leeds ac dot uk (email), @robinlovelace

14 / 14

Thanks

Contact me at r. lovelace at leeds ac dot uk (email), @robinlovelace

Check-out links to my work at robinlovelace.net

14 / 14

Thanks

Contact me at r. lovelace at leeds ac dot uk (email), @robinlovelace

Check-out links to my work at robinlovelace.net

Thanks to everyone for building a open and collaborative communities

Thanks to the University of Leeds and the Institute for Transport Studies

14 / 14

How to inform policy?

The role of data analysis is to make people change their mind, based on the data

2 / 14
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow