Slide 1

Slide 1 text

Alex Singleton Department of Geography and Planning ! www.alex-singleton.com Using R for Research: A Gallery of Applications Pt 1 http://www.flickr.com/photos/epsos/5591761716/sizes/o/in/ photostream/ Ritsumeikan University: 18th June 201 R

Slide 2

Slide 2 text

Projects • CO2 and the School Commute • 2011 Census Open Atlas

Slide 3

Slide 3 text

Overview • Rates of active transport (e.g. cycling or walking) to school are in decline • Pupil-school commute is estimated to contribute around 658k tonnes of CO2 / year • Transport adopted for the pupil-school commute has obvious implications for CO2 emissions

Slide 4

Slide 4 text

Traditional Estimation Technique • Euclidean Distance • Euclidean distance • Average emissions values for mode of transport 183.2 vehicle CO2 g/km (DEFRA 2011) ! SL – trip – 1.2km ! 1.2 * 183.2 = 219.84 CO2 g / journey ! Daily commute - 219.84 * 2 = 439.68 OpenStreetMap

Slide 5

Slide 5 text

Problems • No account for real world geography – Straight lines will typically underestimate true distances • No sensitivity to different vehicle types – What about train / bus etc? • Geocomputation provides a solution…

Slide 6

Slide 6 text

Challenges • Estimate transport network level routes for pupil journeys • Account for variable CO2 emissions between different vehicle types • Individual level for a national population?

Slide 7

Slide 7 text

Model • d distance • p pupil • i pupil home postcode • j school postcode • e CO2 g/km • t transport mode • g location k p = 2 d i p j p t p ( )e t p g p ( )w t p ( ) ( ) Distance CO2g/km Weight

Slide 8

Slide 8 text

Pupil Data • Department for Education – Pupil Level Annual School Census (PLASC) • Postcode level • 2007 – 2012 – “usual” travel mode • 7,373,505 pupil records after exclusions (e.g. no postcode etc) – multiple years • Mostly state school pupils

Slide 9

Slide 9 text

Vehicle Data • Department for Transport – LSOA average CO 2 g/km for those vehicles registered within these zones – Driver Vehicle Licensing Agency (DVLA) • European legislation directive 91/441/EC – Cars registered after March 2001 • Caveat – Possible underestimation? » 162.9 CO 2 g/km differs from the DEFRA national estimate of 183.2 CO 2 g/km (DEFRA 2011). » Might be specific car types for school run?

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Other CO2 g/km Values (Coley 2002, DEFRA 2011, Tranter 2012)

Slide 13

Slide 13 text

Routino (OSM) Google (OSM) Bing Straight Line

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Data Processing OpenStreetMap railway=light_rail railway=subway PostGIS Road / Path Light Rail / Tube Routino .osm XML files Meridian2 Railway Lots of Cleaning! 1) Single lines 2) Nodes join 3) Nodes at stations Postcode Directory

Slide 16

Slide 16 text

Software Infrastructure PostGIS PgRouting Iterative process for each pupil Routino 1) Query pupil (origin, destination, mode) Rail / Light Rail 2) Mode Choice? Road Pupil (distance, mode) 3) Car based? Yes Return LSOA Avg. CO2 g/km No Use type averages Pupil (distance, mode, CO2 g/km) 4) Implement the model

Slide 17

Slide 17 text

Distance and Mode Choice

Slide 18

Slide 18 text

0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 0.00 0.25 0.50 0.75 1 2 3 4 5 6 7 8 9 10 11 12 13 0−0.5km 0.5−1km 1−1.5km 1.5−2km 2−2.5km 2.5−3km 3−3.5km 3.5−4km 4−4.5km 4.5−5km 5−5.5km 5.5−6km 6−6.5km 6.5−7km 7−7.5km 7.5−8km 8−8.5km 8.5−9km 9−9.5km 9.5−10km Distance Percentage Mode BUS CAR NON School Year • Over time increase in distance of non • Year 6-7 – large jump in distance non – Bus more prevalent

Slide 19

Slide 19 text

Model Output • Versus a simple model (straight line, vehicle national averages)

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Next Steps • Estimating Bus Routes – Walk to bus stop – route to school? • Multimodal journeys • Data issues – E.g. confusion in London (tube, rail, light rail) • Scaling issues – This all takes a very long time! • Temporal changes – Policy evaluation

Slide 24

Slide 24 text

Census Open Atlas Project

Slide 25

Slide 25 text

Time and Money Saving • In each report there are ~391 pages, each with a map. That means, for the 354 local authorities in England & Wales ~138,414 maps • Say 10 minutes a map: 23,069 hours • Working 24hr shifts for 961 days! • Salary £18 / hour • Total cost £415,242 • Working weeks (35 hrs) – 659 weeks (~11 years)

Slide 26

Slide 26 text

http://www.thegeekstuff.com/2010/03/30-things-to-do-when-you-are-bored-and-have-a-computer/

Slide 27

Slide 27 text

Census Open Atlas Project http://www.alex-singleton.com

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

R in Action • 2 lists – – A) All local authorities – B) All census variables – prepared for mapping • Start Loop 1 – for local authority X in A – Start Loop 2 – for census variable Y in B – Make a map for variable Y in local authority X – Close Loop 2 when all Y in B are mapped • Close Loop 1, and move onto next X in A • End code when all X in A have been mapped

Slide 37

Slide 37 text

http://www.guardian.co.uk/news/datablog/2013/feb/08/census-data-mapped

Slide 38

Slide 38 text

R in Action http://rpubs.com/alexsingleton/

Slide 39

Slide 39 text

James Reid @ Northern Ireland http://ukbdev.edina.ac.uk/Census2011/ http://ukbdev.edina.ac.uk/Census2011/ OpenCensusAtlas-Northern_Ireland.R