*Peter Norvig, Oct 2017*

pandas Aug 2020

Data updated monthly

pandas Aug 2020

Data updated monthly

# Bicycling Statistics

This notebook investigates various measures and statistics about riding bicycles.

# Speed versus Grade

Like most people, I bike slower when I'm going up a steep hill than on a flat road. But how much slower?
To answer that, I downloaded a bunch of my recorded Strava rides longer than 25 miles as `bikerides25.tsv`

. The columns are: the date; a title; the elapsed time of the ride in hours; the length of the ride in miles; and the total climbing in feet. I parse the file into the pandas dataframe `rides`

:

We can get a feel for the data with the `describe`

method, and with a scatter plot of the number of feet climbed per hour on the x-axis, versus the number of miles per hour on the y-axis:

# Making it Prettier

As expected, there is a lot of variance, but overall speeds get slower as the grade gets steeper. I'll attempt to summarize the data by plotting three best-fit curves to the data: a straight line (degree 1 polynomial), a quadratic (degree 2) and a cubic (degree 3). I'll also make the plot prettier and bigger:

So, I average a little under 14 mph when the overall route is fairly flat, with a lot of variability from 12 to 16 mph, depending more on my level of effort (and maybe the wind) than on the grade of the road. But when the grade is steeper than 50 ft/mile, the speed falls off quickly: down to 12mph at 80 ft/mile; 11 mph at 100 ft/mile; and around 10 mph at 120 ft/mile. Note that 120 ft/mile is only 2.3% grade, but if you figure a typical route is 1/3 up, 1/3 down, and 1/3 flat, then that's 6.9% average grade on the up part.

# Estimating Time of a Ride

This data can help me predict how long will it take to ride a route with a given distance and elevation. For example, to get to Pescadero from La Honda, I could take the flatter coast route (15.7 miles, 344 ft climb), or the shorter creek route (13.5 miles, 735 ft climb); which is faster?

This predicts the shorter creek route would be 10% faster. Good to know, but other factors (like the scenery) are probably more important in making the choice.

# Segments

The data I have so far helps me estimate the duration for a long ride over varying up-and-down terrain. But what if I just want to know how long it will take to climb the next hill? To answer that I'll go back to Strava and retrieve data from individual **segments**, some only a fraction of a mile long, some several miles long, but most with a relatively constant grade. I picked some representative climbing segments (`bikesegments.csv`

) with the segment length in miles and climb in feet, along with several of my times on the segment. (Strava shows my times for up to 10 rides on each segment; I picked the fastest, middle, and slowest of the rides shown.)

For this plot I will list grade in percent rather than climbing feet per mile (a 1% grade is 52.8 feet per mile):

So I can cruise at 15 to 17 mph on a 1% grade, but only about 8 mph at 5% grade, and around 5 mph on 8% grades.

# VAM

The average number of vertical feet (or meters) climbed per hour (regardless of horizontal distance travelled) is known as VAM, which stands for *velocità ascensionale media* (for native Campagnolo speakers) or *mean ascent velocity* (for SRAM) or 平均上昇率 (for Shimano). The theory is that for medium-steepish climbs, most of your power is going into lifting against gravity, so your VAM should be about constant no matter what the grade in that range. (For flatish rides power is spent on wind and rolling resistance, and for super-steep rides power goes largely to cursing *sotto voce*, as they say in Italian.) Here's a plot of my VAM versus grade (in percent):

I don't see the flattening effect; I see a wide spread of VAM numbers; at about 8% I range from 1500 to 3000 VAM. Champions can do 6000.

# Hill-Index

Inspired by the h-index for scientific publications, I invented a new metric, the hill-index:

Yourhill-indexis the maximum numberhfor which you can regularly climb anhpercent grade athmiles per hour.

I think **my hill-index is 6**. (I know that Old La Honda is a 7% grade, and I only achieved 7.0 mph on it once out of many tries). But let's draw a plot to confirm:

The red dotted line is where grade = speed. All three best-fit curves are above the diamond at 6% and below the diamond for 7%, so my guess is confirmed: my hill-index is 6.

# Eddington Number

Speaking of h-numbers, the physicist Sir Arthur Eddington (1882-1944), a contemporary of Einstein, was a pre-Strava bicyclist who favored this metric:

Your Eddington Number is the largest integeresuch that you have bicycled at leastemiles on at leastedays.

Let's calculate mine:

My **Eddington Number is 61**: I've done at least 61 miles on at least 61 days. This is a bit above the mean for Strava users, but not as good as Eddington himself: he had a number of **84** when he died at age 62, and his roads, bicycles, and navigation aids were not nearly as nice as mine, so bravo for him.

Here are some properties of Eddington numbers:

- Your Eddington number is monotonic: it can never decrease over time. (This is also true of the academic h-index, but not my hill-index.)
- To improve from an Eddington number of
*n*to*n*+ 1 can take as few as 1 ride, or as many as*n*+ 1 rides. (Suppose I have done 49 rides, each of exactly 50 miles. Then my Eddington number is 49, and with one more 50-mile ride, my number becomes 50, but then I would need 51 rides of 51 miles each to achieve an Eddington number of 51.) - You could also compute a metric Eddington number, using kilometers rather than miles.
- Your metric Eddington number will always be greater than or equal to your imperial Eddington number.
- Your metric Eddington number will never be more than 1.609344 times your imperial Eddington number.
- Of two riders, it is possible that one has a higher metric number and the other a higher imperial number.

The following chart tells me how many rides I have to go—what I call the **Eddington Gap**—to reach various Eddington numbers:

An easy way to get bigger Eddington numbers is to use kilometers rather than miles:

My **metric Eddington Number is 85**.

Here is my Eddington number progress over the years, in miles and kms, from when I first started tracking rides:

*Note:* the definition of Eddington Number seems to be mathematically precise, but there is one big ambiguity: what exactly does the word ** day** mean? The New Oxford dictionary mentions (a) "a period of 24 hours"; (b) "a unit of time, reckoned from one midnight to the next"; and (c) "the part of a day when it is light". I originally assumed

**meant "one midnight to the next," but I wanted to make an exception for bikepacking trips where I rode to a camping site in the afternoon, spent the night there, and rode back home the next morning; what bikepackers call a sub-24-hour overnight (S24O). I thought that should count as a valid Eddington trip as long as it was completed in 24 hours. And then COVID struck, the camping sites closed, and in response I further relaxed the definition to allow an S24O ride where I sleep in my own home, as long as all the riding is within "a period of 24 hours." I realize Eddington had a lot more hardships than we have (the 1918 pandemic, World War I, and World War II), but I hope he would approve of this accomodation on my part.**

*day*# Wandering

The website `wandrer.earth`

tracks the number of miles of distinct roads you have travelled on (taken from your Strava data). I realize I often repeat the same routes, so this gives me a chance to try something new. Below I plot the percentage of roads I've travelled in various places, across different months.