<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/tired-of-doing-real-math-2-mdash-grad-school-and-coffee-consumption/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://localhost:4000/grad-school-and-coffee/"> Alexej's blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Lately I notice a sharp increase in my coffee consumption (reading <a target="_blank" rel="nofollow" href="https://www.amazon.com/Pour-Your-Heart-Into-Starbucks/dp/0786883561/ref=sr_1_3?ie=UTF8&qid=1487141175&sr=8-3&keywords=howard+schultz">Howard Schultz’s Starbucks book</a>, which is actually quite good by the way, does not help either :grimacing:). Having recently transitioned into a new PhD program I started wondering whether my increased coffee consumption has something to do with my higher stress levels in the last few weeks, and how that conjecture generalizes to the rest of my grad school experience. To answer that question I decided to take a look at how much money I have spent at coffee houses over the last few years. …Also, I’m right now over-caffeinated at 1:40am and I have nothing better to do anyway. <img alt="🙂" class="wp-smiley" src="https://s.w.org/images/core/emoji/2/72x72/1f642.png"></p>
<p>Luckily, <a target="_blank" rel="nofollow" href="https://www.chase.com/">chase.com</a> allows me to download the transaction history of my account as a CSV file (though it’s limited to at most the past two years for some reason). Also luckily, light regex skills in R and the <a target="_blank" rel="nofollow" href="https://blog.rstudio.org/2016/09/15/tidyverse-1-0-0">tidyverse</a> packages is all that’s needed to make sense of these data!</p>
<h3>Number of transactions per month</h3>
<p>First I take a look at the number of transactions performed with my debit card at New Orleans’ coffee houses between 2/13/2015 and 2/13/2017. On the time axis I mark some major occurrences in my academic life.</p>
<p><img title="Coffees per month" alt="Number of transactions performed with my debit card at New Orleans' coffee houses per month" src="https://i2.wp.com/localhost/images/grad_school_coffee/Coffees_per_month.png?w=456" data-recalc-dims="1"></p>
<p>Indeed it seems that I frequent coffee places more often at times when I am more stressed, such as those preceding a paper submission or a qualifying exam (or when my wife is out of town for a month :grimacing:); and I appreciate some variety with respect to the places where I get coffee or tea.</p>
<h3>Yearly statistics</h3>
<p>There seems to be a clear increasing trend in the above bar graph. The trend becomes especially clear when I look at how much money I left at coffee places last year compared to the year 2015. There might be a progressing addiction here :sweat_smile:…</p>
<p><img title="Yearly $$$ spent at coffee places" alt="Amount spent at coffee places per year" src="https://i1.wp.com/localhost/images/grad_school_coffee/Yearly_total_spent.png?w=456" data-recalc-dims="1"></p>
<h3>Time series of daily spending</h3>
<p>The preceding comparison of the yearly amounts does not reveal anything regarding the relationship of my coffee / tea consumption with my stress levels and events in my academic life. Therefore I generated a time series containing my daily coffee house spendings for the considered two-year period. Below is a visualization of this time series smoothed with a simple moving average of order seven (using the <a target="_blank" rel="nofollow" href="https://cran.r-project.org/package=TTR">R package TTR</a>).</p>
<p><img title="Daily spending at coffee places" alt="Time series of daily amounts spent at coffee places" src="https://i1.wp.com/localhost/images/grad_school_coffee/SMA.png?w=456" data-recalc-dims="1"></p>
<p>The finer representation of the data allows some further conclusions:</p>
<ul>
<li>It shows a lower coffee consumption during parts of the summer and winter breaks.</li>
<li>Once again there seems to be a clear association between stressful academic events and an increased coffee (or tea) consumption preceding them.</li>
</ul>
<h3>That’s it. Time to go to bed.</h3>
<p>Because I know from <a target="_blank" rel="nofollow" href="http://www.phdcomics.com/comics/archive.php?comicid=1415">a phdcomics cartoon</a> that caffeine combined with a lack of sleep will turn me into a robot rather than into somebody who might eventually finish graduate school…</p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://localhost:4000/grad-school-and-coffee/"> Alexej's blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/M4AWUD3sMdY"></a></div>