<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/five-kinds-of-weather-youll-meet-in-america/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.decisionsciencenews.com/2017/08/01/five-kinds-weather-youll-meet-america/"> R – Decision Science News</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>K-MEANS CLUSTERING, A WORKHORSE OF DATA SCIENCE AND MACHINE LEARNING</p>
<p><a rel="nofollow" href="https://i0.wp.com/www.decisionsciencenews.com/wp-content/uploads/2017/07/geom_map_weekly_5clust.png" target="_blank"><img sizes="(max-width: 485px) 100vw, 485px" src="https://i2.wp.com/www.decisionsciencenews.com/wp-content/uploads/2017/07/geom_map.s.png?w=450" alt="" class="wp-image-6286" data-recalc-dims="1"></a><br>
<strong>CLICK TO ENLARGE</strong></p>
<p>The USA is a large country. How different are people’s experiences of the weather depending on where they live?</p>
<p>To look into this question, we downloaded high temperature data for over 1,300 airport weather stations in the contiguous USA for every day for five years (2012-2016 inclusive).</p>
<p>We then used <a rel="nofollow" href="https://en.wikipedia.org/wiki/K-means_clustering" target="_blank">k-means clustering</a>, a workhorse of machine learning, to cluster weather stations according to how similar their high temperatures are.</p>
<p>After some exploring, we settled on five clusters because it captures the gist of what is going on.</p>
<p>The result is shown above, where the letters A through E denote the different clusters (which were ordered by their average temperature in the last week of the year). We see broad East-West stripes, with a few patches of cooler temperatures in the Rocky Mountains, and something unusual going on in coastal California and Oregon.</p>
<p>How different are the clusters? To look at this, we plot the average high temperature in each cluster for each week of the year.</p>
<p><a rel="nofollow" href="https://i0.wp.com/www.decisionsciencenews.com/wp-content/uploads/2017/07/seaonal_trends_weekly_5clust.png" target="_blank"><img sizes="(max-width: 485px) 100vw, 485px" src="https://i2.wp.com/www.decisionsciencenews.com/wp-content/uploads/2017/07/seaonal_trends.s.png?w=450" alt="" class="wp-image-6288" data-recalc-dims="1"></a><br>
<strong>CLICK TO ENLARGE</strong></p>
<p>This was eye opening, and gave us two basic generalizations about the weather in the USA</p>
<p>1. As you more North and South, the temperature patterns are similar, just vertically shifted.<br>
2. The Pacific coast is different</p>
<p>On the Pacific coast, temperatures are pretty steady over the year. California and Florida both have nice warm winters, but when you look at the summers, you can see why they put the movie studios in Hollywood. Low variance makes it easy to plan.</p>
<p>Speaking of variance, look how cluster A (Minnesota and Maine) is actually hotter than cluster D (Pacific Coast) around the middle of the year.</p>
<p>Another cool factoid is that the American experience is pretty similar in summer (less than 20 degrees between cluster A and E) and highly varied in winter (about 45 degrees between cluster D and cluster A).</p>
<p>R, ggplot2, tidyverse, etc. code for those who wish to reproduce the analysis.</p>
<p>We scraped the temperatures ourselves, but we’ll save you the trouble and let you download the <a rel="nofollow" href="http://www.decisionsciencenews.com/wp-content/uploads/2017/07/weather_data.zip" target="_blank">temperature data here</a>. Just create a subdirectory called “data” and expand weather_data.zip there. Leave 5 the yearly files in gzip (.gz) because R reads and writes .gz files seamlessly.</p>
<p></p>
<p>The post <a rel="nofollow" href="http://www.decisionsciencenews.com/2017/08/01/five-kinds-weather-youll-meet-america/" target="_blank">Five kinds of weather you’ll meet in America</a> appeared first on <a rel="nofollow" href="http://www.decisionsciencenews.com/" target="_blank">Decision Science News</a>.</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://www.decisionsciencenews.com/2017/08/01/five-kinds-weather-youll-meet-america/"> R – Decision Science News</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 rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/VfdFBpRzHe0" height="1"></a></div>