-
26
Mar -
Programming in R — statistics
Posted by David Stockwell in All
While R is a vector language, it is mostly known as a language for statistics. The R language statistics capability and the packages developed by users to extend it is the main reason people come to use R.
The development of elementary probability models is easy using R code. Here I build on the previous R programming post using climate statistics, and inbuilt functions to perform t statistics for regression, the generation of statistical models in R, simple linear regression and show global warming is seemingly unrelated to many parts of the atmosphere.
The graph below shows the global stratospheric (top), lower tropospheric (lower black) and southern hemisphere tropospheric (blue) temperatures measured by the microwave sounding unit (MSU) satellite from Remote Sensing Systems (RSS). The red lines on the plot illustrate the trend of the temperatures since 1995. The trend in temperatures in stratospheric and southern hemisphere temperatures have not been significantly increasing.
The significance of the trends is shown by the simple statistical test results supplied by R in the summary output, listed in the table below.
| Level | Trend (C/yr) | t value | Pr(>|t|) | Sig |
|---|---|---|---|---|
| Stratosphere | 0.054 | 1.33 | 0.192 | |
| Troposphere | 0.138 | 3.246 | 0.001 | ** |
| SH Tropo | 0.060 | 1.36 | 0.176 | |
| NH Tropo | 0.213 | 4.11 | 0.000006 | *** |
This simple statistical analysis indicates that much of the atmosphere has shown a great deal of stability since at least 1995, after the stratospheric disruption of Mt Pinatubo in the Philippines in 1991 died away. Recent temperature increases have largely been confined to the lower troposphere of the northern hemisphere.
A number of bloggers have drawn attention to recent falls in temperature, or at least lack of increases in global temperature.
- The large drop in temperatures in the last 12 months here
- a decline in temperatures in the last 7 years reported here,
- decline in the last 10 years here,
- and now, indications of atmospheric stability back to 1995, or 13 years.
Simple regression modeling and validation have teased out components of atmospheric stability, and shown difference between northern hemisphere tropospheric temperatures and the rest of the atmosphere that are seemingly unrelated. CO2 however is globally distributed gas influencing temperatures at all levels of the atmosphere. These results are at variance with presentations of long term trends of globally averaged temperatures.
Global warming is not ‘taking a breather‘. The recent warming is not global, but better described as northern hemisphere warming. If the pattern doesn’t fit, you should acquit (CO2 that is).
Below is the statistics R code used here:
TLT< -"ftp://ftp.ssmi.com/msu/monthly_time_series/rss_monthly_msu_amsu_channel_tlt_anomalies_land_and_ocean_v03_1.txt"
TLS<-"ftp://ftp.ssmi.com/msu/monthly_time_series/rss_monthly_msu_amsu_channel_tls_anomalies_land_and_ocean_v03_0.txt"
TLTo<-"ftp://ftp.ssmi.com/msu/monthly_time_series/rss_monthly_msu_amsu_channel_tlt_anomalies_ocean_v03_1.txt"
UAH<-"data/tltglhmam_5.2.txt"
readRSS<-function(skip=3,file=UAH,col=3) {
f<-read.table(file,fill=TRUE,skip=skip)
ts(f[col],start=f$V1[1],frequency=12)
}
redot<-function() {
tls3<-readRSS(file=TLS)+3
tlt3<-readRSS(file=TLT)
tlt11<-readRSS(file=TLT,col=11)
plot(tls3,ylim=c(-1,4))
lines(tlt3)
lines(tlt11,col="blue")
mod(tls3)
mod(tlt3)
mod(tlt11)
}
mod<-function(y=tls3,off=0) {
y<-y[192:350]
x<-(1:159)/12
l<-lm(y~x)
s<-l$coefficient[2]
lines(c(1995,2008),c(mean(y),mean(y)+s*13),col="red")
print(summary(l))
}
- Published by David Stockwell in: All
- If you like this blog please take a second from your precious time and subscribe to my rss feed!