Global temperature widget

 I've created a web-based app that calculates linear regression trends on the Cowtan-Way global temperature data set using annual mean temperature. The reason I picked that particular data set is simply that it's one of the easiest of the surface temperature data sets to download to R.  I chose annual data because red noise is insignificant at that scale so we can go with linear regression without worrying about autoregression. The app was made using the Shiny app in R Studio.

When you open the app, you're greeted by a single page with two input boxes on the left-hand side. You enter the start year in the top box and end year in the bottom box and the Shiny app does the rest. The output includes the linear temperature trend per 100 years, the 95% confidence interval for that trend, a graph of the data and trend, complete with 95% confidence interval lines, and at the bottom the actual R output listing the model and fit statistics like the R2 statistic. 

I've demonstrated the output of the app for the 1970-2020 time period. As you can see, global mean temperatures have increased by an average rate of 1.86ºC per century with a 95% confidence interval of 1.68 to 2.04ºC. That's statistically significant since the confidence interval does not bracket zero, which agrees with a p-value less than 2 x 10-16. The linear model is a great fit for the data, with an adjusted R2 value of 0.895, meaning the linear trend explains 89.5% of the variation in the 1970-2020 data.

You can use any year since 1850 as your start year and any year up to the most recently completed year as your endpoint. The only restriction is that your start year must be less than your end year. The calculations and graph will automatically update.

One other feature: If you hover your mouse pointer over the graph, it will display the actual temperature anomaly for each year as you move the pointer around, thanks to the ggplotly package.

If you want to check it out yourself, you can find it here on or I've linked to it on the Climate Data Sources page on this blog. Happy computing.


Post a Comment

Popular posts from this blog

Tom Luongo's multiple lies about climate change

Enough hockey sticks for a team