Overview of the Quantified Self movement


ANLY512: Data Visualization

The Quantified Self (QS) is a movement motivated to leverage the synergy of wearables, analytics, and “Big Data”. This movement exploits the ease and convenience of data acquisition through the internet of things (IoT) to feed the growing obsession of personal informatics and quotidian data. The website http://quantifiedself.com/ is a great place to start to understand more about the QS movement.

For this project, I chose data collected from my Apple Watch. The data consists of various activities like exercise, number of steps, sleep time, stand time and distance covered. The data is collected from April 2022 to February 2023. The purpose of this analysis is to take a look at the trend of excersise activities, standing time, and sleeping time to further analyze what might be improved in order to have a better lifestyle.

Summary of 6 Quantified Self Questions:

  1. What is the amount of active Calories burned each day?
  2. Is there any correlation between steps taken to calories burned?
  3. Is number of hours spent sleeping adequate?
  4. What is the relation between excersise time vs active Calories Burned?
  5. How does the total stand time look like?
  6. How does distance walking and running vary over time and how is it related to active energy burned?

Q1: What is the amount of active and resting energy burned each day?


Active energy burned is different from total calories burned since it is only calculated during running, walking or similar activities without accounting for resting or standing calories burned. As a result, the values might not be large. There are few days where almost 400 active calories were burned. These days coincide with the long distance running days. On most days daround 300 calories were burned signifying that a moderately active lifestyle was led. Some days have barely any activity. Its possible that some of the days tracker was not used.

Q2: Is there any correlation between steps taken to calories burned?


As expected calories burnt are mostly correlated to steps taken. Although there are few outliers too. Some days have large number of steps but comparatively less calories were burnt. This implies that less strenuous activities were done over a longer period of time.

Q3: Is number of hours spent sleeping adequate?


The sleep time is mostly between 6 and 7 hours. This is lower than recommended amount of sleep. Moreover, the sleep hours seem to decreasing by a small amount recently, which needs to be improved. Some very low data points are probably because of removing the watch. The sleep time and resting heart rate seem to align very closely with each other.

Q4: What is the relationship between excersise time (in minutes) vs active Calories Burned?


Since I am only accounting for active energy burned so a strong correlation is expected between excersise time and active calories burned. Here I also want to investigate the correlation between walking heart rate and excersise time.

Q5: How does stand time (in minutes) look like overtime and what is its relationship with active energy burned?


The average stand time seems to be 100 minutes and seem to be increasing recently.

Conclusion

Based on the visual analytics, following conclusions can be drawn

  1. The average active calories burned is around 300.The average resting energy burned is around 1200 calories.

  2. There is a strong linear relationship between step count and active energy burned.

  3. We also see a strong linear relationship between excersise time (in minutes) and active energy burned.

  4. The amount of sleep is not adequate and should be improved.

  5. The average amount of stand time in minutes is around 100.

---
title: "ANLY 512 Final Project"
author: "Tin Bui"
output: 
  flexdashboard::flex_dashboard:
    storyboard: true
    social: menu
    source: embed
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(ggplot2)
library(tidyverse)
library(readxl)
library(dplyr)
library(xts)
library(zoo)
library(lubridate)

```
Overview of the Quantified Self movement
==========


***
ANLY512: Data Visualization

The Quantified Self (QS) is a movement motivated to leverage the synergy of wearables, analytics, and "Big Data". This movement exploits the ease and convenience of data acquisition through the internet of things (IoT) to feed the growing obsession of personal informatics and quotidian data. The website http://quantifiedself.com/ is a great place to start to understand more about the QS movement.

For this project, I chose data collected from my Apple Watch. The data consists of various activities like exercise, number of steps, sleep time, stand time and distance covered. The data is collected from April 2022 to February 2023. The purpose of this analysis is to take a look at the trend of excersise activities, standing time, and sleeping time to further analyze what might be improved in order to have a better lifestyle. 

Summary of 6 Quantified Self Questions:

1. What is the amount of active Calories burned each day?
2. Is there any correlation between steps taken to calories burned?
3. Is number of hours spent sleeping adequate?
4. What is the relation between excersise time vs active Calories Burned?
5. How does the total stand time look like?
6. How does distance walking and running vary over time and how is it related to active energy burned?


Q1: What is the amount of active and resting energy burned each day?
==========


```{r 1, echo=FALSE}
fitness<- read.csv("C:\\Harrisburg\\02-2022-Late Fall\\ANLY 512-90-O\\Assignments\\Project\\fitness.csv")
Date<- as.Date(fitness$Date, format = "%m/%d/%Y")
  ggplot(fitness, aes(x=Date, y= activeenergyburned)) + geom_bar(stat = "identity", color = 'Green') +
  theme(axis.text.x=element_text(angle=60, hjust=1))
  
ggplot(fitness, aes(x=Date, y= restingenergy)) + geom_bar(stat = "identity", color = 'Red') +
  theme(axis.text.x=element_text(angle=60, hjust=1))  
```


***
Active energy burned is different from total calories burned since it is only calculated during running, walking or similar activities without accounting for resting or standing calories burned. As a result, the values might not be large. 
There are few days where almost 400 active calories were burned. These days coincide with the long distance running days. On most days daround 300 calories were burned signifying that a moderately active lifestyle was led. Some days have barely any activity. Its possible that some of the days tracker was not used.

Q2: Is there any correlation between steps taken to calories burned?
==========
```{r 2, echo=FALSE}

ggplot(fitness, aes(Date, stepcount)) +
  geom_bar(stat = "identity", color = 'Green')

ggplot(fitness, aes(x= stepcount, y=activeenergyburned)) +
  geom_point(color = 'Green') +
  geom_smooth(method = "lm",color = 'Blue') +
  theme(axis.text.x=element_text(angle=60, hjust=1))
```

***
As expected calories burnt are mostly correlated to steps taken. Although there are few outliers too. Some days have large number of steps but comparatively less calories were burnt. This implies that less strenuous activities were done over a longer period of time.


Q3: Is number of hours spent sleeping adequate?
==========
```{r 3, echo=FALSE}
sleep<- read.csv("C:\\Harrisburg\\02-2022-Late Fall\\ANLY 512-90-O\\Assignments\\Project\\sleep.csv")
ggplot(sleep, aes(Date, timeinbed)) +
  geom_bar(stat = "identity", color = 'Green') +
  labs(title = 'Sleep Pattern', x = 'Days', y = 'Time in Hours')
ggplot(sleep, aes(Date, restingheartrate)) +
  geom_bar(stat = "identity", color = 'Green') +
  labs(title = 'Resting Heart Rate', x = 'Days', y = 'beats per minute')


```






***
The sleep time is mostly between 6 and 7 hours. This is lower than recommended amount of sleep. Moreover, the sleep hours seem to decreasing by a small amount recently, which needs to be improved. Some very low data points are probably because of removing the watch. The sleep time and resting heart rate seem to align very closely with each other.   

Q4: What is the relationship between excersise time (in minutes) vs active Calories Burned?
==========
```{r 4, echo=FALSE}
ggplot(fitness, aes(fitness$excersisetime, activeenergyburned)) +
  geom_point(color = 'Green') +
  geom_smooth(method = "lm",color = 'Blue') +
  theme(axis.text.x=element_text(angle=60, hjust=1))+
  labs(title = 'Excersise time vs Active Calories Burnt', x = 'Excersise Minutes', y = 'Active Calories Burnt')
ggplot(fitness, aes(fitness$excersisetime, walkingheartrate)) +
  geom_point(color = 'Green') +
  geom_smooth(method = "lm",color = 'Blue') +
  theme(axis.text.x=element_text(angle=60, hjust=1))+
  labs(title = 'Excersise time vs Walking Heart Rate', x = 'Excersise Minutes', y = 'Walking Heart Rate')
```




***
Since I am only accounting for active energy burned so a strong correlation is expected between excersise time and active calories burned. Here I also want to investigate the correlation between walking heart rate and excersise time. 

Q5: How does stand time (in minutes) look like overtime and what is its relationship with active energy burned?
==========
```{r 5, echo=FALSE}

ggplot(fitness, aes(Date, standtime)) +
  geom_point(color = 'Green') +
  geom_smooth(method = "lm",color = 'Blue') +
  theme(axis.text.x=element_text(angle=60, hjust=1))
ggplot(fitness, aes(fitness$standtime, activeenergyburned)) +
  geom_point(color = 'Green') +
  geom_smooth(method = "lm",color = 'Blue') +
  theme(axis.text.x=element_text(angle=60, hjust=1))+
  labs(title = 'Stand time vs Active Calories Burnt', x = 'Stand Minutes', y = 'Active Calories Burnt')

```




***
The average stand time seems to be 100 minutes and seem to be increasing recently.

Q6: How does distance (in miles) covered vary over time and how is it related to active energy burned?
==========
```{r 6, echo=FALSE}


ggplot(fitness, aes(Date, distancewalkingrunning)) +
  geom_point(color = 'Green') +
  geom_smooth(method = "lm",color = 'Blue') +
  theme(axis.text.x=element_text(angle=60, hjust=1))
ggplot(fitness, aes(distancewalkingrunning, activeenergyburned)) +
  geom_point(color = 'Green') +
  geom_smooth(method = "lm",color = 'Blue') +
  theme(axis.text.x=element_text(angle=60, hjust=1))+
  labs(title = 'Excersise time vs Active Calories Burnt', x = 'Excersise Minutes', y = 'Active Calories Burnt')

```

We can see significant variation of walking and running distance over time. Moreover, we see a strong linear relationship between excersise time and active energy burned. 

Conclusion
==========
Based on the visual analytics, following conclusions can be drawn

1. The average active calories burned is around 300.The average resting energy burned is around 1200 calories.  

2. There is a strong linear relationship between step count and active energy burned. 

3. We also see a strong linear relationship between excersise time (in minutes) and active energy burned. 

4. The amount of sleep is not adequate and should be improved.

5. The average amount of stand time in minutes is around 100.