Boston Bike Share Ridership: A short story of weather, Covid, and MBTA

hyponeutremia
16 min readDec 29, 2023

--

Blue Bikes (formerly “Hubway”), the bike share system we have here in the Boston area shares its ride data, and many people have done some very cool analysis on it. As a bike and a software person I wanted to play with the data a bit myself. In this post, we will see that some of our intuitions about how weather affects bike share ridership are borne out in the data, examine interactions between the subway system and the bike share system, as well as the effects of COVID-19 epidemic on bike share ridership.

First Steps

Before doing any kind of analysis, it seemed worth the effort to verify that the data looks reasonable. I wanted to look at daily ridership numbers, so I planned to look at the number of trip per day; however, the system has not stayed static over the years and even over months: stations are added, removed, and changed on both permanent and temporary (often seasonal) basis. Here is an animation of the stations in the system over time:

In order to figure out if certain day’s ridership numbers are more or less than expected it was important to establish a baseline that is (mostly) independent of station deployments, weather, and other factors. I ended up computing a moving average (over 7 days) of the number of trips to account for these variations. Intuitively, and also based on other data I’ve seen, there is also a variation in ridership numbers across different days of the week. Plotting daily increase/decrease over the 7-day moving average yielded the following chart:

This lines up exactly with what Nikhil Tekwani has found: Sunday is the day with the lowest ridership, and Wednesday as the most, at least as far as BlueBikes are concerned.

The lower ridership numbers on Saturday and Sunday suggest that a lot of the bike share trips are commuting trips: folks riding to/from work, school etc. To check, we can plot rides by the hour they start:

Here we see a bimodal distribution, consistent with a commuting pattern: one peak centered around 8am and one peak centered around 5pm. From this we might think that weekends and weekdays may see different hourly usage patterns: commuting-style bimodal distribution on weekdays and some other distribution on weekends. This is indeed what we see if we separate the weekends from weekdays:

The weekdays have a bimodal distribution we have seen in the combined chart above, while the weekends have a peak around 3pm. Note that the percentages in the graph above are not directly comparable to each other: the y axis reflects the percentage of rides for each hour within each domain (weekend or weekday).

Weather and Other Factors

I originally attempted to use weather forecasts as a proxy for actual weather, but then found out that there is a great source of historical weather for every airport called “METAR” — this is the link for downloading the data for Boston area airports; I used the data from the Boston Logan airport for this analysis. Note that some data may be misaligned or missing: in those cases I just threw away the data and didn’t have a data point for that hour. This didn’t matter so much because most of the analysis here was done on daily aggregate data.

To figure out what parameters were relevant to predicting BlueBikes/Hubway ridership I ran a linear regression with a number of independent variables to predict the daily trip counts. The final product had an R-squared value of 0.872, so a decent match for the actual data. The actual versus predicted ridership looked like this:

Let’s set aside some of the mismatches between the predicted and the actual data (we will return to some of them below) and note that if we scale all the input data to fit between 0 and 1 and then look at the fitted model coefficients we can figure out what the most important factors are to predicting the number of daily rides. Note that the best fitted model includes square and cubic terms terms, but for figuring out which factors were the most important in predicting the bike share ridership I used a model with only linear terms. This model has an r-value of 0.817, so less good than the “real” model, but it makes it easier to reason about which parameters are the most important.

Precipitation, Temperature, and MBTA Ridership

I added MBTA (subway only) ridership data fairly late in the game, but it changed the model significantly. I computed the daily MBTA subway ridership as simply the raw number of turnstyle entry scans for that day. Before adding the number of MBTA passengers to the model, the list of most important parameters for predicting the bike share ridership looked as follows:

  1. Precipitation, with a negative coefficient, meaning that more precipitation equaled less ridership.
  2. Wind, also with a negative coefficient. This parameter was less than half as important as the precipitation.
  3. Everything else mentioned here and below: temperature, holidays, and days of the week. These factors had roughly about equal importance, and about half the importance of the wind.

However, if we add MBTA ridership to the mix, we have a much better model fit (the R-squared number went from 0.830 to 0.870) and the importance of parameters changes too:

  1. Temperature
  2. Precipitation and MBTA ridership, which are only a bit less important than the temperature.
  3. Wind (about 1/3 as important as the factors in #2 above)
  4. Everything else

This is interesting and it might be this way at least in part because MBTA ridership itself might be sensitive to precipitation (as well as other weather phenomena, such as wind and temperature): in a quick and dirty attempt to model MBTA ridership, the precipitation, along with temperature turned out to be one of the important parameters to predicting subway usage, though, to be fair, not as important as weekend/weekday distinction.

If we remove subway ridership from the model, the amount of daily precipitation is very predictive of the number of trips taken. It is odd that it is the highest absolute value coefficient (the correlation with precipitation is negative), and this value is more important than the number of bike share stations.

The coefficient between MBTA subway and Boston bike share ridership is positive: more MBTA ridership means more bike share trips. One might think that this would not be the case: sometimes bike share is used to mitigate subway shutdowns; however, at least according to this model, these systems complement each other rather than compete. It could also be the case that MBTA ridership serves as a proxy for the population of the Greater Boston area (seasonal or otherwise), and the larger population should mean more bike share trips, in theory. Alternatively, it might be the case that the subway and bike share usage increases do not have a causal relationship with each other, but rather are are influenced by other factors: some days there is more demand for transportation, and the bike share system and subway get more heavily utilized as a result.

Temperature also affects ridership (more so if we add the subway data): there is a positive correlation there. Adding a square temperature term did not improve the fit much, but higher-order polynomials of temperature did, at least up to the fifth degree. This is not entirely surprising not only because higher-order functions can express more complex curves, but also because we might intuitively think that while in most of the temperature range we experience in Boston, warmer temperatures are more conducive to riding, when it gets really hot it might be the case that some people would not want to go out? It turns out that relative humidity or dew point are not good predictors of bike share ridership. This might be because this metric correlates with precipitation, and it should only affect ridership when the temperatures are high. In any case, the model predicts that each additional degree (F) of temperature generates up to 500 additional daily riders, but, again it is hard to disentangle the temperature factor from system size: during warmer months there are more bike share stations.

Wind

This value is less than half as important as the other parameters, but is the next most important factor. Adding higher-order versions of this data didn’t improve the model, which is interesting because the wind force actually experienced by a (flat) object is a square of the wind speed.

Station count, Holidays, and Days of the Week

These are the next four most important factors, roughly equal in importance. Of these, the station count is the only difficult one: there is no actual “station count” in the data, so I inferred the number of stations by the number of different station ids that show up in the ride data for some period. The smaller the period the better the model fit, but at really small periods this “station count” just ends up coding the dependent variable we are trying to predict, i.e., the number of rides: when there only a few daily rides, less-used stations are less likely to be origins and destinations, so at short periods (such as two days, for example), they tend to drop out of the data. I ended up settling for (roughly) weekly station counts.

As noted above, the number of stations can be a proxy for the average temperature: stations close for the winter months and reopen for the summer months.

Adding additional degrees (square, cube, etc) of station counts results in a better fit. The best degree is 6th, but in the end I settled for 3 degrees, having a cubic, quadratic, and a linear term in the input data. In most models, regardless of degree of station count parameter, each additional station at the current system size (423 stations) is predicted to generate on the order of 40 daily rides, which equals to nearly 15 thousand more rides per year.

Holidays, and to a lesser extent, proximity to holidays ends up being a good predictor of ridership as well. In addition to coding a binary holiday/non-holiday, I also added “days till next holiday” and “days from last holiday” columns to the data. Both are roughly equally predictive, and only a bit less predictive than just holiday/non-holiday coding.

As could be guessed from the first graph, different weekdays also experience different ridership. Interestingly, at least according to the model, if other factors are taken into account, the relationship between different days of the week is not what it was shown to be above: for instance Monday generates less ridership than Saturday, and Friday, not Wednesday is the is the day with the most ridership, all other factors being equal.

Unimportant and Missing Factors

Besides humidity, coding the bike share system’s age did not improve the fit very much, possibly due to the fact that the system seems to grow nearly linearly (in the number of stations) just like system age does.

There are a few factors I would have loved to add, had it been easy. One is “miles of bike lanes” (ideally with a metric for each kind). At the same time, my gut feeling is that this might have also been growing linearly, just like the size of the bike share system, but without any data to look at this is hard to tell.

Adding school calendars with school vacations and holidays would have been nice as well as well as T closures, though the latter are reflected in the number of daily gated entries into the T system.

Orange Line Shutdown

On the graphs of the actual versus predicted bike share trips there there is an area where the prediction doesn’t match the actual ridership around late August / early September of 2022:

As an aside, it is interesting to see in the graphic above that the model also predicts the sharp drop on Labor day, driven by rainy weather as well as the holiday/post-holiday slowdown, though the predicted drop in ridership is not nearly as dramatic as the actual drop.

With regards to the overall ridership increase the August/September 2022, the difference between predicted and the actual ridership is not insignificant: the model predicts 12–15K daily rides, but instead the system experienced a peak of 27K daily rides, almost twice the predicted amount. We can see how atypical the bike share usage for this period is by plotting the rides between August 19 and September 18 by year: 2022 really stands out. While 2021 and 2023 saw 409K and 434K rides, respectively, 2022 saw 629K rides, or a 50% increase (207K “excess” rides) over what we might expect by averaging 2021 and 2023 numbers.

Comparing the daily usage with other years, we can see that while other years were a bit rainier in the relevant period (the effects of rain can be seen in the graph below), 2022 experienced an unusual surge in bike share ridership for this period.

Blue line is the ridership (left y-axis), and orange bars are precipitation (right y-axis). The red line represents the running 90 day average ridership. Graphs are centered on Labor Day and the x-axis represents distance from Labor Day. This is done so that effects of weekends and holidays (in grey background) can be compared across years. I excluded year 2020 because the ridership nimbers could be effected by COVID-19 pandemic, though see more on that below.

The source of this increased ridership is the Orange line shutdown that took place between August 19 and September 18 of 2022. If we plot the number of Orange line passengers (which was zero during the shutdown) versus bike share rides, the relationship becomes is apparent:

There were a number of mitigation measures put in place during the Orange line shutdown, most relevant to this analysis is the free bike share memberships: the casual (non-member) rides did not become free, but free monthly memberships were available for the duration of the shutdown.

Was bike share mitigation a success? One one hand, the Boston bike share system has not seen higher utilization since the Orange line shutdown, so from that perspective it was. On the other hand we can estimate (by looking at Orange Line ridership 15 days before and 15 days after the shutdown) that the subway system lost about 1.8 million trips during the 30 day shutdown. Using our earlier estimate of 207K “excess” rides or even 221K rides suggested by our model, we still see only 12% of the lost subway rides to have been replaced by bike share, and that is assuming that the entire increase in bike share ridership went into the replacement of the lost Orange line trips. But then again, given that likely less than 12% of Boston residents commute by bicycle, this probably should be seen as a great success.

Another way to measure success would be to look at the effect of the increased bike share ridership due to the Orange line shutdown on the rest of the bike share system. We might expect that increased “Orange line substitution” rides would depress other rides, due to system-wide constraints on number of bikes, rebalancing capabilities, and other factors. To look at whether other rides were depressed and see how much of the increased bike share ridership was “Orange line substitution,” I computed the number of rides originating at each dock station and compared the total number of rides during the shutdown period versus the period of two weeks before and two weeks after the shutdown. We can then plot the distance of each station from the nearest Orange line stop and the change in its ride origination count while separating stations that have other subway lines nearby from those that do not.

What we find is that the biggest increases in ride origination were seen at the stations that were not necessarily affected by the Orange line shutdown; the top four stations (all having more than 2000 “extra” rides over the 4 weeks) were at MIT, Northeastern, Harvard Square, and corner of Mass Ave and Beacon Street. Of these, the Northeastern bike share station was probably the most affected by the Orange line shutdown, being only 0.2 miles away. To see the data better, we can plot the increase in ridership for each bike share station in comparison to a baseline dataset, in this case, to the same dates in 2023:

Number of increased trips during the Orange line shutdown per bike share station. Comparison period is the same dates in 2023. Color indicates ridership increase (in absolute terms) and the size of the circle indicates general station ridership during the baseline (comparison) period.

The map above suggests that there were some ridership increases at stations adjacent to the Orange line, but it appears that the most popular stations, and specifically those located near colleges, saw most of the biggest ridership increases. This suggests that additional ridership during the Orange line shutdown might be a phenomenon of people (especially students) taking advantage of free bike share memberships. There is some support for this idea if we look at number of rides by whether the rides was a member or not before, during, and after shutdown:

A priori, we might have expected the increased ridership to increase both member and non-member rides proportionally; however, as we can see in the chart above, all of the ridership increase during the Orange line shutdown came from the bike share members. This was the intended effect of the free bikeshare membership, and it worked in that sense: the ridership increased dramatically. On the other hand, based on the station data, it seems that the additional rides were not necessarily coming from or going to locations most impacted by the shutdown. We can therefore tentatively conclude that most of the bike share ridership increase did not come from replacing Orange line subway trips, and the percentage of the lost subway trips that became bike share trips is much less than the 12% computed previously.

On the other hand, we see little evidence of other rides in the system being cannibalized by the increased ridership. This makes sense if most of the ridership increase was not for the purposes of replacing Orange line trips. It also suggests that the bike share system, at least with the extra valet services and extra rebalancing during the shutdown, could handle more riders than it does now. Finally, the data also seems to suggest that the demand for ride share is price-elastic, and making the system cheaper (or free) will increase utilization.

COVID

We can see a few different effects of COVID-19 pandemic on the bike share ridership in Boston, as shown below

Versus MBTA subway

The graph below shows Boston bike share and MBTA subway daily ridership fro 2015 through end of 2023. Bike rides and subway entrances are shown on on different scales: the subway utilization dwarfs the bike share rides.

As you can see the subway ridership cratered in early 2020. Zooming in on just the period from 2019 through the end of 2022 (below) we can see that bike share ridership, after dropping dramatically in March and April 2020, rebounded to its pre-COVID levels in the summer, while MBTA subway is still not what it used to be before the pandemic, as the graph above shows.

COVID and Weather

While Boston bike share ridership rebounded much better than the MBTA subway utilization, it is not the case that COVID has not affected Boston bike share utilization. If we look closely on the actual versus predicted ridership graph, we can see that there are valleys are much deeper than predicted in 2023:

From the standpoint of having a workable model of bike share ridership, it is encouraging to see that most of the actual peaks and valleys in the ridership are also predicted: it is just the case that the predicted magnitude of these drops is less than what it is in reality. If we plot ridership for most of 2023 versus the same period in 2018 and add precipitation to the chart, something interesting emerges:

Boston Bike Share Ridership May through October in 2018 and 2023: actual versus predicted. The orange bars show the amount of precipitation. Grey background indicates weekends and holidays

We see that the model predictions for 2018 are a lot more accurate than for 2023, and more specifically, if anything, the model under-predicts the ridership for 2018 and over-predicts it for 2023. This is particularly true for days with precipitation. From this we can hypothesize that the ubiquity of work-from-home arrangements in 2023 makes bike share riders more ombrophobic than the riders were in 2018: in 2023 more people have an option of working from home on a rainy day than in 2018. Our model has seen more pre-COVID data (I was using data that starts in 2015) than post-COVID data, and as a result, the coefficients are a better match for the pre-COVID population than the post-COVID one.

Footnotes

The Boston bike share data is available from here, and you can build a simple script or download it all by hand. Pandas Dataframe offers an easy way to load CSV files, though I ended up re-saving them in pickle format to speed up loading. If you want to process all of the bike share data at once, you’ll have to take care of:

  1. The system changed names in May 2018, so the names of the files changed
  2. There have been a few data format changes.
  3. Station identifiers are not unique across the whole dataset. On April 1st, 2023, the station identifiers changed formats, but (as I discovered a bit late) the numeric station identifiers do not always refer to the same location across years of data. What I ended up doing is inferring stations from geo-coordinates of ride starts/ends in the data by grouping nearby geo coordinates into a station. It took a bit of work, but I was pleased with the results. The image below shows a result of such grouping at 50 meters: all of the locations within 50 meters of each other are treated as one bike share station. Locations that are construed to be the same station are the same color.

If there is something I am missing or should add to the analysis, please do let me know: I’d love to get your thoughts or comments. Happy riding!

Acknowledgements

Thanks to Sam Gerstein and Stacey Moisuk for comments and suggestions on earlier drafts of this analysis.

--

--