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.
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.
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.
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.