New Statistics Plots

In the version 1.20, I added to the main statistics page small preview graphs embedded in the table. I also rationalised somewhat the plots shown on individual fields.

Main Statistics Table

The statistics page start looking like this

EmbeddedPlots

For selected fields, you now see a small preview of a relevant graphs.

Here in distance it shows you the cumulative distance of the previous years, one of my favorite graph to track how you are doing on a given year compare to the previous ones.

Note that you can disable the embedded graphs with an option in settings in case you don’t like it.

For the Average Heart Rate and other non summable fields, it will show you the monthly average over the last 6 months.

Pressing the All button on the right will continue to rotate between the weekly, monthly and annual summary. The Sigma icon means it displays the total or average across all activity. If you press it, it will display the stats restricted to either the last week or last month. This enables you to see all details of the last month or week.

WeeklyStats

Here you can see that the Max Heart Rate over last week was 194, average moving pace 5:21 min/km. This enables you to see any statistics over that period easily. The weekly summary of the previous versions was limited to only a few key measures. Note that in this view the embedded plot becomes a weekly plot to compare this week’s statistics to the previous.

Field Statistics Details

If you press any field of the main statistics table, it will take you a more detail information on that fields, as for example here

StatsMonthly

This shows you two graphs and some basics stats. The first graph is a scatter plot against another variable. If you tap on that plot it will let you configure it and choose the second variable.

The bottom plot will rotate when you tap on it between a monthly summary, the performance analysis graph and an histogram of the different values as here. This post describes the performance analysis in more details.

StatsHistogram

Pressing the all button on the top right as before shows you weekly or monthly statistics.

MonthlyStatsDetails

Improved Statistics Page

Version 1.19 includes an improved and better organised statistics page.

The statistics page is quite simple to find on the iPhone. A few users on iPad sometimes miss it as it’s a bit less obvious, you need to press the stats icon pointed by the blue arrow below.

IpadStatsIcon

The New Fields Stats Page

The new stats page now have the fields pre-organised rather than trying to dynamically work out the ordering based on all the fields found on garmin connect data. This is both so that it works better with other services than garmin and due to the fact that the data include now a lot of new fields that confuses the old logic resulting in quite a messy page. Note that any fields not known by the app will still appear systematically at the very end of the list under the category Other.

NewStatsPage

One new feature is that you can now have a quick filter to see the summary stats for either the week or the month of the most recent activity. For that press the Sum Icon, which will then turn into a week or month icon as pointed by the arrow below.

Screen Shot 2014 04 12 at 11 38 58

Weekly or Monthly Summary

As before if you press the All button on the right it rotates through weekly, monthly or yearly summary. There is now also a quick filter for these pages. If you press the All button pointed by the arrow below you’ll enter to filtered page for the last 3m, 6m or year.

WeeklySummaryAll2TimeFilter

Note that if you want to get more detail on an activity you can now tap on the line for the period you are interested in and it will bring up the page with that full stats on the activities. Below you will see all the statistics for the week starting on the 23rd of march.

WeeklySummaryFor3m

It achieves that with the search feature, the activity list will also contains only the relevant activities. You can from the activity clear the search to see the full list of activities again. When the stats are about the current search it then replace the activity type icon. Note that you can this way get stats on any subset of activity you can define with a search in the activity list screen.

WeeklySummaryTapToDetail

Data relationships in a single activity

Here we’ll explore different ways to look at two different attribute together in connectstats.

Let’s say we want to look at how the speed and heart rate relate to each other. The first approach is simply to plot the two series together on the same graph as below.

2fieldsplots 12

The arrows 1 and 2 shows that on the two short interval when the running speed increased, the heart rate increased as well.

One approach to relate the information a bit better is to use a color overlay to show the one information on the a single plot

2fieldsasline

The arrow 1, shows where the line becomes darker and red as the heart rate increased with the speed, the arrow 2 shows the heart rate slowing down as the color goes back to the green

The last and, in my opinion, most interesting way to relate the two series of data is the scatter plot.

Scatterplot 17

Here you can see the points (arrow 1) where the speed/heart rate increased together. Array 2 is the beginning of the run with lower heart rate until it stabilised in the region of arrow 3 for most of the run. The regression line shows how the main relationship between the 2 data goes, here slightly to the downward slopping as expected.

It is also interesting in the lap view to see where in the larger scatter plot a given lap appear as below

Scatterlap 9

The green points show for this mile lap that the beginning was quite fast/high heart rate (arrow 1) and then slow down of both speed and heart rate (arrow 2), and clearly at the lower end of the overall speed of the run.

Data and smoothing used in connectstats

ConnectStats let us apply basics statistics technics to analyse our fitness data. We use these techniques to answer questions about the activities. How well did I do on this run? Is my stamina improving? Did I push myself more today that last week?

Raw Data

Before doing any analyses, let’s review the raw data we have access to. ConnectStats relies on the collection of the data is done with a garmin device and a collection of sensors.

The raw data varies by activity type and device.
For outdoor activities, the raw data will be gps coordinates, a timestamp, speed and values from different sensors: Heart Rate beat per minutes, cadence (legs or pedal), Power delivered on the bike, and sometimes more advance running dynamics like Vertical Oscillation, ground contact time. For swimming the data collected will be the time for each length and the number of stroke.

Here is an example of what the raw data looks like Blog txt

Depending on the activity or the device the raw data will be collected at fixed intervals or at different intervals trying to reduce the amount of data saved. If you move in a straight line for 5s at constant speed, it isn’t necessary to collect the points every seconds as they can easily be interpolated.

From this raw data, there are two main directions for the analysis we can do. The first is analysing a single activities and the second is analysing summary of each activities over time.

Focus on a single activity

The summary statistics are quite simple. Mostly we will want to look at the average of the different measure, maximum and minimum. Where it gets more interesting is to look at the series of data. As for most statistics analysis a first phase will be cleaning the data.

Data Cleaning

Let’s look at the graph of the data collected by the gps. You can see it is quite noisy, there is also large part of the data that is not really interesting to look at to. Some is gps noise, area with bad reception, pause due to stop lights,

Rawdatabad

To clean the data, we can first use assumption on expected constraints on the data. For example, define a minimum speed considered valid running speed, or a minimum valid heart rate to remove unreasonable spikes. Another technique used by connectstats is to filter points that have unrealistics acceleration.

FilterBadValues

The last smoothing technic we can apply is a moving average of a few points. Usually the app will use 5 points moving average for data, but it can be controlled in the sliding left settings window.

Filterbadnormalsmoothing

In the case below the graph start to be more readable now, especially with the 2 minutes moving average overlay, which shows the two short faster run intervals around 30min and 40min.

Historical Scatter Plots I like to use

One of my initial motivation to write the app was to look at my activities using scatter plots. I was especially interested in looking at the relationship of heart rate and speed.

Here you can find information how to access them.

scatter-hr-pace

The first thing I look is where is my last activity in my overall history. Here you can see that I was in the middle of the pack, a bit on the high heart rate side.

Screen_Shot_2014-01-18_at_17_44_54-6

 

It’s also interesting to check the pattern overtime. You can see here that the more recent colors are on the higher HR, slower pace area. Not good, I need to improve.

Screenshot_19_01_2014_22_25

Sometimes it can also be useful to check only the recent history, using this button to rotate between all, 1m, 3m, 1y

Screenshot_19_01_2014_22_31-4

Other times, I also want to have a more sophisticated filter for the graph, in that case I can use the search feature. If I define a search in the activity list I can then get the scatter plot only for those activities. The statistic tab will have an extra button beside running, cycling swimming and all: Search.

Screenshot_19_01_2014_22_34-2 Screenshot_19_01_2014_22_35-2 Screenshot_19_01_2014_22_36

Some other interesting historical relationship to look at for bikers: Power and Cadence or Power and Heart Rate

Screen Shot 2014-01-18 at 22.57.28 Screen Shot 2014-01-18 at 22.57.46

 

Best Rolling Plots

Critical Power Plots

I discovered recently the concept of Critical Power Plot, after a user left a comment on the site. Critical Power is the maximum power you can maintain for a given period of time. The concept seems mostly used by cyclists. But it felt to me it could be extended to other data: What is the best pace I maintained for any given period of time? What is the maximum heart rate I maintained for a given period of time?

So I decided to give it a go and implement it in ConnectStats. All I had to do was maintain a rolling average every X seconds and keep track of its maximum. It’s quite an expensive computation: for N points, I need to do NxN computations, and the devices processing power is a bit low, so I chose 5 seconds for X, which seems to work well in practice even on my old iPhone 4.

Of course, the original data in the file produce by the watch isn’t nicely produced every 5 seconds and for the algorithm to work efficiently, I have to resample the original data at the average on that exact interval, which can result in a bit of loss from the original file. But in practice it didn’t appear too bad on most of the ride I looked at.

I end up with a new time serie evenly spaced every 5 seconds: the maximum average heart rate over 5 seconds, over 10 seconds, over 15 seconds, etc, etc.

Just had to come up with a name, cyclist refer to it for the power field as Critical Power, but “Critical Power” or “Critical Pace” felt a bit confusing to me, so I named it “Best Rolling Heart Rate” or “Best Rolling Pace”

Here is the example from my best 10k race for the heart rate.

doc-detail-bestrolling-hrplot

 

This is quite nice and works also for power or pace.

Best Rolling Laps

Of course the plots are nice, but the next thing I wanted to know was for that best HR what were my others statistics for each of that given period of time where I reached that maximum?

So I enhanced the auto lap feature to show the best rolling lap corresponding to a few arbitrary periods of the plot. Below you can see the details for the Best Rolling Power or Critical Power of a friend, along with the distance, speed, HR for each of the correspond section of the ride.

doc-detail-bestrolling-lapsdoc-detail-bestrolling-lapchoices

 

 

 

The last missing piece was to plot on the map and highlight on the plot of another statistic where that best average was reached as below

doc-detail-bestrolling-lapdetail