Hubway Bike Share: Ridership Patterns

[This article was first published on R – NYC Data Science Academy Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Contributed by Thomas Kassel. He is currently enrolled in the NYC Data Science Academy 17-week remote bootcamp program taking place from January-April 2017. This post is based on his first class project, Exploratory Data Analysis with R (due on the 3rd week of the program).



Boston’s bike share program, Hubway, has quickly become a convenient, affordable and fun way to navigate the city. Publicly owned by municipalities in Greater Boston and operated by national bike organization Motivate, Hubway’s increasing popularity is consistent with national trends of greater attention to sustainable transport in metro areas.

Environmental, monetary and convenience benefits aside, bike share programs have embraced the influx of big data collected by their bike/station technology, using the rich datasets for their own business insights as well as posting many of them to the public for any aspiring data scientist to enjoy.



Hubway – the Hubway Trip History dataset contains information on over 1M bike trips spanning from the program’s inception in 2011 to mid-2013. Due to long processing times, this dataset was subsetted to only the summer of 2012 (Jun-Sept), which was still inclusive of ~300,000 entries. Information about the variables collected (trip duration, start/end station, rider information) can be found at the site link above.

Zipcodes – since Hubway includes registered zipcodes for each rider in the trips dataset mentioned above, a comprehensive table of regional zipcodes and their corresponding neighborhood/towns was compiled using the following public sources:,, R package zipcode.

Weather – public daily weather data for Greater Boston was accessed and tabularized from Weather Underground.



1) Exploration of General Ridership Patterns

Basic variables provided in the Trip History dataset include the timestamp (minute-level granularity) of departure and arrival for each Hubway trip taken. This allows for analysis of ridership activity from the perspective of our normal temporal routines – commuting, socializing, weekend excursions, etc.

Density plots help to visualize hourly ridership throughout the course of an average weekday or weekend. Here we see an obvious “M” shape on the weekday density curve, very likely due to commuting activity (roughly including weekday hours from 7-9AM and 4-7PM). Further analysis reveals that these commuting rides accounted for 33% of total trips (including weekends) during the summer of 2012. Average weekend profiles exhibit an opposite daily profile with peak ridership occurring in the afternoons. A small, but noticeable amount of weekend rides occur from 12AM-3AM catering to more ‘adventurous’ biker-bar-goers.


We can further solidify weekday-vs-weekend behavior using density plots as a function of total trips and average trip duration. In the right-hand panel we observe a noticeable difference in the distributions of daily rides – on a given weekday, there are 500-750 more rides than a given weekend. In the left-hand panel we see that the distribution of weekend trips has a mean trip duration of approximately 10 minutes longer than that of weekday trips, with an average trip time of ~25 mins. Hubway rides max out at 30 minutes, so weekend riders tend to make the most of their riding time. Together, these two observations suggest that Hubway lends itself well to both higher-frequency and faster weekday schedules (commuting) and slower-paced weekend routines (recreational rides and sightseeing).


2) Exploration of Rider Demographics

The inclusion of rider information (which is gathered at registration for annual membership) provides interesting potential for analysis of Hubway’s demographics. Namely, for each ride in the Trip History dataset, the rider’s zipcode, age and gender is also included. Using the compiled zipcode table previously described, rider zipcodes were matched with boston neighborhoods or surrounding suburbs. The plot below shows the top ten demographic cohorts (i.e. groups of gender-age-neighborhood combinations), by total rides in summer 2012. It is worth noting:

There were no female cohorts in the top ten ridership groups for either Greater Boston or the Suburbs; all cohorts depicted below are male.

Because of the low number of riders from the suburbs, the y-axis for suburban cohorts has been scaled up; however on absolute terms, these rides constitute a significantly lower proportion than Greater Boston residents.


Males, of all ages, from the South End and Back Bay neighborhoods play a very significant role in Hubway’s membership base – in combination they made up 17% of all registered Hubway rides during the summer of 2012. Trips are also quite popular among male millenials in other densely populated parts of Boston.

Although substantially smaller by trip volume, Hubway appears to have maintained a loyal member base from the suburbs. This segment is dominated by middle-aged males from nearby Boston towns, making heavy use of Hubway stations located at MBTA hubs (commuter rail or ferry), most notably North Station, South Station and Rowes Wharf Ferry Landing (not shown on graph).



Hubway has solidified its place as a viable transportation option in Greater Boston, as evidenced by incorporation of bike trips into our daily routines and high adoption among particular demographic groups.

Integration of external datasets could provide further insights into the drivers for increased ridership. To examine the impact of short-term, localized events, use of publicly available subway data could attempt to draw correlations between daily MBTA maintenance/recorded downtime and increased Hubway rides. Schedules of large city-wide events encouraging travel and sight-seeing (Red Sox games, Boston Marathon, 4th of July Fireworks) could also point to ridership spikes. With an eye to longer-term Hubway growth, study of urban planning initiatives (public spaces, increased transit coverage) and commercial/residential development of new neighborhoods could indicate good candidates for new bike stations.

The post Hubway Bike Share: Ridership Patterns appeared first on NYC Data Science Academy Blog.

To leave a comment for the author, please follow the link and comment on their blog: R – NYC Data Science Academy Blog. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)