Studying Data to Predict Weather Patterns
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
Introduction
Weather is important for most aspects of human life. Β Predicting weather is very useful. Β Humans have attempted to make predictions about the weather, many early religions used gods to explain the weather. Β Only relatively recently have humans developed reasonably accurate weather predictions. Β I decided to collect weather data and measured the accuracy of predictions made using linear regression.
Scraping Data
I collected data from www.wunderground.com, and I found many measurements every day for decades from several locations within the USA. Β I collected the following observations:
- TemperatureΒ - the measure of warmth or coldness
- Humidity - the amount of moisture in the atmosphere
- Precipitation - the amount of moisture (usually rain or snow) which falls on the ground
- Wind Speed - Β the speed at which air flows through the environment
- Pressure - the force the atmosphere applies on the environment
I collected multiple readings of these observations for each day from 1986-2016 in the following locations: Alaska, Chicago, San Francisco, Miami, New York City, Washington, DC, and Los Angeles. Β The data collection was complicated because the rows in tables weren't uniform, some measurements were missing or had units inconsistentlyΒ and some values varied between numbers and strings.
Data Analysis
After collecting the data, I created a Shiny Application to analyze patterns between weather observations. Β It is available Β https://robinganemccalla.shinyapps.io/robinsweatherproject/. Β For any location and pair of weather observations (including time) the Application will automatically display a scatterplot of all the data with a regression line and a regression analysis of how well the first observation predicted the second observation. Β In addition, the Application automatically displays a multi-variate regression for the y-axis, using every other observation to predict the observation on the y-axis.
After comparing all of the observation combinations, I did not find many strong patterns. Β Most R-squared values for single variable linear equation were below 0.1 and many were even lower than that. Β Some patterns existed in some locations but were reversed in others. Β For example, in Los Angeles, New York City, Miami and Washington, DC temperatures rose as humidity rose. Β But in Alaska, Chicago and San Francisco the opposite was true.
Even when all variables were used, the R-Squared values were seldom over 0.5. Β And there was not consistency of weather patterns between location. Β The two variables which were more consistently predicted were humidity and wind speed. Β This could be because they are least effected by external weather and variables I did not collect.
Professional weather forecasters are not perfect, but their predictions are typically more accurate than those of this linear regression model. Β This implies that weather is a non-linear system. Β Additionally, my predictions were all based on data from one location as opposed to multiple locations that most forecasters use. Β Though my model is imperfect, it does describe limitation of linear regression on predicting weather.