Quantified Self - My Walking Patterns

Himangshu Pal

June 2, 2017

Introduction

Quantified self - A guide to self-tracking tool or lifelogging. It is a movement to incorporate technologies into data acquisition on aspects of a person’s daily life in terms of inputs, states and performance. Inputs are (food intake, quality of surrounding air etc., States are like mood, blood pressure level, heart beats, sleep patterns etc., and performance in terms of physical and mental. In brief, quantified self is self-knowledge through self-tracking with technologies. Data collection through self-monitoring and self-sensing combines wearable sensors or devices like (Fitbit, Pedometers, Apple Watch etc.) also using different mobile apps like Apple Health, My Fitness Pal, Nike+ etc.). Not limited to the above, we can also use different financial tools to measure or track our personal finances, then we can use many logging technologies or applications to manually log our daily different activities to monitor our time and money flow and control them. Basically, we can control how we are living our life on a day to day basis and make it better through the concepts of quantified self.

An Idea

This is the age of mobile communications and mobile phones. We cannot live a single day or moment without that small device. Mobile phones are evolving every day, so the applications of mobile phones. This is the time of smart phones. Smart phones are smart because they can do a lot with the help of extraordinary applications and make our life smooth and simple. I have iPhone. And I keep it with my all the time. So, why not use it as it can keep records about myself by using Apple Health Application (This application is provided in every iPhone by Apple Inc.). So, I used it to find out how this app could be useful to let me know about some of my daily habits that help me for my good health. Like we walk all day but we do not keep track of it. We only track something that we do explicitly like running in the evening or morning, or going to gym and do cardio and so on. But what about what we do all the time - when we are at home, or in office or outside of home meeting someone or going to shopping etc. A lot of walking happens or in precise, a lot distance we cover every day which we do not care about. So, I wanted to dig into that aspect specifically.

Data Collection

So, I wanted to collect data regarding that aspect mentioned in last section. I used Quantified Self Access application to extract records from Apple Health App in my mobile phone. Quantified Self Access app searches through the device and if it finds application related to quantified self, it extracts the data based on the parameters we provided to QS Access app. For me, I asked QS Access to get me data related to my Walking Habits. So, it fetched me below data related to my walking - Distance covered per second interval:

Methods

So, I extracted the data captured by Apple Health App through QS Access App. It gave me four data sets in CSV format. The data sets were - Data set of my daily step counts Data set of my daily distance covered Data set of Calorie Burn Data Set of Heart Beat per second

I collected the data using QS Access and using Tableau, I merged the data sets in one data set where the Start data time and Finish Date time of any activity matched. And I used that consolidated data set for further analysis. Before I came up with my questions - I explored the data using ‘R’ and package used ‘dplyr’ clean and transform data and ‘ggplot2’ for EDA. While I was exploring the data, the questions started to pop up in my mind. And I selected five of them. To visualize the data to support my questions, I use Tableau tool and found out the story about my walking patterns. In next sections I will tell more about my findings.

Exploratory Data Analysis

Data Set View:

## 'data.frame':    9779 obs. of  11 variables:
##  $ Start        : Factor w/ 9764 levels "1/1/2017 0:02",..: 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 ...
##  $ Finish       : Factor w/ 9652 levels "1/1/2017 0:02",..: 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 ...
##  $ StartDate    : Factor w/ 325 levels "1/1/2017","1/10/2017",..: 243 243 243 243 243 243 243 243 243 243 ...
##  $ DayDivision  : Factor w/ 5 levels "Afternoon","Early morning",..: 3 3 5 5 5 5 5 5 5 5 ...
##  $ Day          : Factor w/ 7 levels "Friday","Monday",..: 4 4 4 4 4 4 4 4 4 4 ...
##  $ Season       : Factor w/ 4 levels "Fall","Spring",..: 3 3 3 3 3 3 3 3 3 3 ...
##  $ Distance     : num  0.04569 0.16284 0.04017 0.00348 0.00395 ...
##  $ Step         : int  124 485 117 8 13 128 66 24 8 12 ...
##  $ ActiveCalorie: num  12.4 48.5 11.7 0.8 1.3 12.8 6.6 2.4 0.8 1.2 ...
##  $ HeartRate    : int  90 83 90 90 87 95 107 107 113 87 ...
##  $ Duration     : int  5 5 3 0 0 2 4 5 0 1 ...

Summary of Distance Walked

##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## 0.003579 0.809300 1.663000 2.044000 3.171000 8.786000

Summary of Steps Count

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##       8    1970    4360    5236    7846   24040

Summary of Active Calorie

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     0.8   197.0   436.0   523.6   784.6  2404.0

Summary of Heart Rate

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     0.0    87.0   100.0   100.9   115.0   164.0

The minimum heart rate is zero. Whic his odd.

Why minimum heart rate is zero in the summary? I am still alive!!!

## [1] 87
##     StartDate    Distance Step HeartRate ActiveCalorie
## 1   7/10/2016 0.013297344   29         0           2.9
## 2   7/12/2016 0.025215243   63         0           6.3
## 3   7/12/2016 0.037853933  101         0          10.1
## 4   7/29/2016 0.101097093  268         0          26.8
## 5   7/31/2016 0.010494959   26         0           2.6
## 6   7/31/2016 0.012887239   29         0           2.9
## 7   8/15/2016 0.082107989  215         0          21.5
## 8   8/15/2016 0.015453502   37         0           3.7
## 9   8/15/2016 0.129611817  314         0          31.4
## 10  8/15/2016 0.054612314  145         0          14.5
## 11  8/15/2016 0.018100543   47         0           4.7
## 12  8/15/2016 0.097586346  209         0          20.9
## 13  8/15/2016 0.073160244  178         0          17.8
## 14  8/15/2016 0.150819216  384         0          38.4
## 15  8/15/2016 0.160935139  433         0          43.3
## 16  8/15/2016 0.062472660  136         0          13.6
## 17  8/15/2016 0.197527688  432         0          43.2
## 18  8/15/2016 0.063280442  156         0          15.6
## 19  8/17/2016 0.009332995   21         0           2.1
## 20  8/17/2016 0.130879414  330         0          33.0
## 21   9/6/2016 0.123528593  332         0          33.2
## 22   9/6/2016 0.161550296  473         0          47.3
## 23   9/6/2016 0.024078134   59         0           5.9
## 24  10/5/2016 0.050604470  106         0          10.6
## 25  10/6/2016 0.029869313   69         0           6.9
## 26  10/6/2016 0.114611916  314         0          31.4
## 27 10/19/2016 0.009451056   29         0           2.9
## 28 10/20/2016 0.098841516  286         0          28.6
## 29 10/20/2016 0.055805347  157         0          15.7
## 30  11/5/2016 0.005716615   13         0           1.3
## 31  11/5/2016 0.033336564   77         0           7.7
## 32  11/5/2016 0.005287869   12         0           1.2
## 33  11/5/2016 0.025718554   60         0           6.0
## 34  11/5/2016 0.013315985   34         0           3.4
## 35  11/5/2016 0.043551907  131         0          13.1
## 36  11/5/2016 0.021257108   51         0           5.1
## 37  11/5/2016 0.022953452   56         0           5.6
## 38  11/5/2016 0.048870844  140         0          14.0
## 39  11/5/2016 0.072333820  182         0          18.2
## 40  11/5/2016 0.060757675  148         0          14.8
## 41  11/6/2016 0.019020172   51         0           5.1
## 42  11/6/2016 0.051648373  122         0          12.2
## 43  11/6/2016 0.003293267   10         0           1.0
## 44 11/20/2016 0.041196910  103         0          10.3
## 45 11/21/2016 0.163843156  456         0          45.6
## 46 11/21/2016 0.098555685  249         0          24.9
## 47   1/7/2017 0.091111658  252         0          25.2
## 48  1/10/2017 0.112002157  257         0          25.7
## 49  1/10/2017 0.152677116  357         0          35.7
## 50   2/1/2017 0.208830430  484         0          48.4
## 51   2/3/2017 0.114108606  324         0          32.4
## 52   2/3/2017 0.103905691  297         0          29.7
## 53   3/5/2017 0.006959357   16         0           1.6
## 54   3/5/2017 0.005101457   11         0           1.1
## 55   3/5/2017 0.092646445  242         0          24.2
## 56   3/5/2017 0.050983506  138         0          13.8
## 57   3/5/2017 0.025612921   70         0           7.0
## 58   3/5/2017 0.015161457   45         0           4.5
## 59   3/5/2017 0.005231945   12         0           1.2
## 60   3/5/2017 0.040861370  119         0          11.9
## 61   3/5/2017 0.008251809   16         0           1.6
## 62   3/5/2017 0.013222779   30         0           3.0
## 63   3/5/2017 0.010650302   24         0           2.4
## 64   3/5/2017 0.004436590   10         0           1.0
## 65   3/9/2017 0.078392190  203         0          20.3
## 66   3/9/2017 0.280312972  687         0          68.7
## 67  3/18/2017 0.015726905   42         0           4.2
## 68  3/20/2017 0.086855265  205         0          20.5
## 69  3/21/2017 0.012874811   28         0           2.8
## 70  4/14/2017 0.034989412  100         0          10.0
## 71  4/15/2017 0.042290523  125         0          12.5
## 72  4/15/2017 0.022133242   58         0           5.8
## 73   5/6/2017 0.021921976   51         0           5.1
## 74   5/6/2017 0.068941134  194         0          19.4
## 75   5/6/2017 0.133221984  386         0          38.6
## 76   5/6/2017 0.054854649  148         0          14.8
## 77   5/6/2017 0.080734759  192         0          19.2
## 78   5/6/2017 0.119940701  318         0          31.8
## 79   5/6/2017 0.098120725  249         0          24.9
## 80   5/6/2017 0.076844975  192         0          19.2
## 81   5/6/2017 0.128331792  335         0          33.5
## 82   5/6/2017 0.000671081    2         0           0.2
## 83   5/6/2017 0.057178577  166         0          16.6
## 84   5/6/2017 0.033255786   79         0           7.9
## 85   5/8/2017 0.007611797   17         0           1.7
## 86   5/8/2017 0.036362642   85         0           8.5
## 87  5/29/2017 0.018889684   42         0           4.2

The application logged 0 heart beats in last 10 monts. Which is really unacceptable. Possibly the ##application was not able to collect correct heart rate records. Let’s explore heart rate first.

Average heart rate Histogram

The Heart Rate distribution is normal.

Calorie burn vs Heart Rate

But when plot heart rate with Calorie, the scater plot does not show any linear realtionship between these two parameter. But in general, there has to be a relation ship between the heart rate and calories burn. From the plot, I can see that, when calorie burn is very minimum, the heart rate is maximum (155). Also, when calori burn is about 1300 the heart rate is about 20. These two findings are really odd. The average heart rate is normal as its is between 85 to 110. So, looks like there are discripancies in the heart rate data. As of now, I am not going to explore more this data for heart rate. But in future I will analyse this particular parameter to find out what is worng with my heart rate.

The day I burned maximum calorie and the distance covered.

##   StartDate DailyStep DailyDistance
## 1 7/16/2016     24037      8.786095

The day I burned minimum calorie and the distance covered.

##    StartDate DailyStep DailyDistance
## 1 11/27/2016         8   0.003579098

Heart rate reached to burn maximum calorie

## [1] 164

Heart rate when minimum calorie burned

## [1] 85

Daily Calorie burn pattern

Calorie burn pattern is right skewed.But on an average I burn 300 to 700 Calorie daily which is ###great.

Distance walked pattern

As expected distance walk pattern is alligned with the calorie burn pattern.

Weekdays walked pattern

On Thursdays, I walk more but majority of walking happened on middile part of the week.

Distance vs Calorie - Seasonal effect

Looks like, the relationship is linear between my distance walked daily and Calorie burned. During fall, I walked more where summer the frequency of walking is less.

Seasonal and daily comaprison of distance walked vs calorie burned.

Questions

From above exploratory analysis the below questions came into my mind.

*Is my walking habbit predictable? Comparison 2017 vs 2016

*What is my active walking time of the day?

*Which season of the year I walked most?

*Which season of the year and which day of the week I walk most?

*Can I compare my calorie burn with my distance walked evry month of hte year sinc July 2016?

Visual Analysis

The data visualization created by using Tableau. Please click the below link for the visualizations.

[https://public.tableau.com/views/Data1_32/MyWalkPattern?:embed=y&:display_count=yes]

Conclusion

From the above visualization, I can see that the I walk more in 2016 later part of the year comare to this years walking distance covered till May 2016. I can improve it as I still have half of the year left. Also, I have found that during Fall season I am active and my capability to burn calories is more. At night I covered most of my walking distance and at the early part of the week from Monday to Thursday I walked most. So, by looking at all those datails I can tell that, I like cool weather and like to go out whle the outside temperature is not too high or not too low. Because of quantfied self I got to know all those details whic I never know about me. I will keep digging my self logging data and analyze more to know more about me.