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

Garmin automatic synchronisation to Strava and implication for ConnectStats

Strava now automatically synchronises with Garmin

Garmin provide now automatic synchronisation with different services, most notably Strava. You can read about it from this post from @dcrainmakerblog.

I find it very useful. I personally use Strava as well, I like their segment functionality and the social aspect of followers.

This is a continuation of the new policy change of Garmin to not support 3rd party app that access the data from garmin directly. You can also read about it here from @dcrainmakerblog

What’s next for ConnectStats

For ConnectStats, this new approach of auto sync just does not work. I do not have the ability, the means nor the time to build my own service to save users data on a web server and use that from ConnectStats.

Garmin announced that they would stop supporting the API ConnectStats uses, but as of beginning of August and the time of writing this, it still continues to work. We just don’t know for how much longer.

To address the potential shutdown, ConnectStats can use Strava as data source instead of Garmin Connect.

I still believe that ConnectStats can be quite useful to many users with extra plots, reports and views it provide currently not available directly from other services on an iOS device. So I will try to continue maintaining ConnectStats even if Garmin shuts down the API access. For that purpose the auto sync to strava is very useful, because it lets ConnectStats use Strava as a service provider to replace Garmin Connect.

What ConnectStats users will loose

It’s not all perfect though, here are some of what will be lost when Garmin Connect shuts down its service and ConnectStats user have to switch fully to Strava:

  • The auto sync service only seems to upload recent activities, long history of data will no longer be available to users.
  • Strava API itself only lets you download the two most recent months of activity via their API. This is quite an issue because a large part of the attraction of ConnectStats is to do comparison and plots that go back in time. My favourite features are to compare my fitness evolution over long period of time
  • Strava API currently will not provide access to all the different fields provided by garmin devices. Training Effects, Normalized Power, Vertical Oscillation, and many other data will no longer be available access to the garmin service stops and ConnectStats user switch to Strava.

Note that to mitigate the issue with only accessing recent history from Strava, I plan to add a merge feature to ConnectStats multiple service support, so at the time Garmin Connect API shuts down for those lucky user that already have their history saved on their device they can continue and use strava only for new activities.

Recent Silence

I have been recently a bit quiet. I admit the idea of potentially not being able to download data from Garmin and the implication of an end of ConnectStats wasn’t a great motivation to build new features.

Recently though I had a couple of ideas that excited me. I am still working on ability to keep track of time in zone, best rolling plots, Critical power plots etc over time. I would love to be able to compare my best rolling plot of current month versus last, or versus a given year, etc.

The other feature I am working on is ability to compare your recent performance (current training) versus your long term built fitness. Somewhat inspired by training peaks’ performance chart, and leveraging ideas from the following articles about how to measure impact of exercise.

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

Multiple Profiles in ConnectStats

ConnectStats allows you to maintain multiple profiles. This can be useful to either track several users or now several services independently.

You access the profile setup from the settings view, the blue arrow 2 below

ServiceAndProfiles

You will then see the list of profiles existing in the app. It will start with only one named Default. Each profile will maintain its own list of activity and service setup.

You create a new profile by using the New Profile line. It will the prompt you for the name of the profile. Please avoid using special characters in the name. You can then simply tap on the profile you want to activate at any time.

Here is the list of profile in my current setup. You can see I created profile for different service setup and other accounts in garmin connect I use, as well as for the activity of friends.

Screenshot 29 03 2014 10 14

If you use the Delete Activities or Profile, this will let you either completely delete the current profile or some activity in the profile. Note that deleting activities here, is only locally in the app, not on the remote service, at the next refresh the activity will be downloaded again. It’s mostly useful if you want to make sure you refresh many activities from the remote services at once.

View or manage cache is simply a way to see how much disk space the app uses across the different files it keeps.

ConnectStats setup for multiple services

From version 1.8, ConnectStats can source its activities data from different services. This was mainly done such that there is a future for the app, even if Garmin decide to close its data to 3rd parties.

In the first release, ConnectStats will support extracting data from Strava. At this point, getting the data from Garmin is still the only way to get running dynamics data for the new garmin devices (Forerunner 620), or some advance statistics like Normalized Power, etc. But Strava provide a good alternative for everything else.

We will go over in this post how to set up services. Please note it can be quite useful to maintain different profiles when using multiple services. You can also have several services enabled for one profile and it will combine the activities.

You access the setup from the settings page as below. The green arrow 1 points to the services setup, and 2 to the profiles setup.
To enable a service for activities download, turn on the Download Activities toggle.

ServiceAndProfiles

Services Setup

The service setup screen will initial shows the list of service with the setup for Garmin expanded. After all, at this point this app is still focused on the Garmin service… Simply tap on the service name, pointed with the blue arrow, to expand or collapse the setup information for a given service.

ServiceDefault

Garmin Setup

For garmin, once you enable the service, your main choice is the log in method.

  • With the direct method you enter your name and password, and ConnectStats will handle the login directly.
  • With the Web method you need to enter your name and password manually when required in the Garmin login screen. The direct method is much better, but unfortunately the Garmin service seems a bit capricious and sometimes returns an Access Denied, in which car using the web method can usually help.

Note that from the experience of users so far the Access Denied error usually is transient and after a day or so the connection may work again. Needless to say that Garmin has so far not helped providing any info how to avoid the problem. If they charge the fee they mentioned, one can only hope they will provide better support and a more reliable 3rd party access process.

There is also a Manual Login option. This is a last resort tool if all fails to see via a browser what happens during the login process. Try to login and once the Garmin Connect Dashboard appear, you can press either the List button or One to manually query some of the API the app is using.

Strava Setup

You can use Strava service in two ways:

  • As the source for your activities, when the Download Activities toggle is on.
  • To upload the activities you look at, when the Auto Sync on Download toggle is on.

There is no entry for the username and password in Strava, as the service rely on authentication via Strava website directly. What that mean is that, when you will try to use the service, the Strava website login will pop up. You will then need to enter your credential and the first time, authorise ConnectStats to access your data. Once you have connected once, usually the login won’t be presented again, unless you change profile.

Withings Setup

You can use Withings data to enrich your analysis with history of your weight or other measurement from a Withings scale.
To Enable, you need to enter your name and password in the setup, and Tap the Press to login line.

If your credentials were entered correctly, the screen should show the following

WithingsOk

If you have several user in your Withings accounts, you can select the correct one to use.

If you select the Auto Refresh option, every time you update your activities, ConnectStats will query the Withings service for new measures.

When the service is enabled, you will see in each activity details the latest weight corresponding to a given activity and in the Stats section you’ll be able to use the weight series.

Comparing activities in ConnectStats

My activities are often on the same paths, so I wanted a way to compare activities. Of course segment in Strava are really useful in finding out how fast you can run or bike certain route, but I wanted a bit more control in what I was comparing. I also wanted a way that is not over complicated within the UI flow of connectstats. Here is what I came up with.

To compare an activity you need to first mark the activity that will compared to any other activity you will then look at. For that, you slide an activity in the list to the left, which reveals the Mark button.

Markactivity 6

After you press the button and the activity is then marked, note the mark icon on top of the activity icon.

Markedactivity 4

You can then look at any other activity and the graphs of the marked activity will then appear in the background of the current activity. Here I am looking at activities where I skied up the same slope with skins. It’s clear the first one my heart rate was much higher than the compared one. It was pretty much the same path up, so really just show how I adapted to the altitude over the course of the week, I think… Look at the HR histogram

SkiupHRHistogram 3

Or the rolling best plot

Skiupbestrolling 3

Now of course I claim I took the same path up, or did I? Hit the map and the two paths will appear. The compared path is slightly less opaque

Comparepaths 2

Here you see though large part of the ski up was the same, I didn’t start from the same exact same place, but arrived at the same destination.

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