-
9
Aug -
Is Temperature a Random Walk?
Posted by David Stockwell in All
We use the data from CRU, and input it into R using the code in the post R Code to Read CRU Data. The initial approach to testing whether global temperatures from CRU is to run a Dickey-Fuller Test for Unit Root.
The augmented Dickey-Fuller test checks whether a series has a unit root. The default null hypothesis is that the series does have a unit root.
A unit root refers to the coefficeint b in the sequence being greater than one and leads to series with a tendency to wander infinitely far from the starting point, and display ‘trendiness’ or the appearence of trends with no specific driving variable.
Xt = bXt-1 + e
The adf.test() command needs the tseries library for this test.
R automates the process of finding, downloading and installing libraries. In Windows, you are presented with a list of packages after selecting a CRAN mirror site (if you are connected to the internet). Then, on selecting xseries all the required packages are loaded. In this case:
package 'scatterplot3d' successfully unpacked and MD5 sums checked
package 'mlbench' successfully unpacked and MD5 sums checked
package 'randomForest' successfully unpacked and MD5 sums checked
package 'SparseM' successfully unpacked and MD5 sums checked
package 'xtable' successfully unpacked and MD5 sums checked
package 'fBasics' successfully unpacked and MD5 sums checked
package 'sandwich' successfully unpacked and MD5 sums checked
package 'acepack' successfully unpacked and MD5 sums checked
package 'lmtest' successfully unpacked and MD5 sums checked
package 'car' successfully unpacked and MD5 sums checked
package 'dynlm' successfully unpacked and MD5 sums checked
package 'e1071' successfully unpacked and MD5 sums checked
package 'leaps' successfully unpacked and MD5 sums checked
package 'oz' successfully unpacked and MD5 sums checked
package 'Hmisc' successfully unpacked and MD5 sums checked
package 'chron' successfully unpacked and MD5 sums checked
package 'fCalendar' successfully unpacked and MD5 sums checked
package 'strucchange' successfully unpacked and MD5 sums checked
package 'DAAG' successfully unpacked and MD5 sums checked
package 'quadprog' successfully unpacked and MD5 sums checked
package 'zoo' successfully unpacked and MD5 sums checked
package 'its' successfully unpacked and MD5 sums checked
package 'tseries' successfully unpacked and MD5 sums checked
The downloaded packages are in
C:\Documents and Settings\David Stockwell\Local Settings\Temp\Rtmp11853\downloaded_packages
updating HTML package descriptions
The next steps are to load the library, get the CRU data into a variable and run the Dickey-Fuller Test for Unit Root.
> library(tseries) > d< -readCRU() > adf.test(d) Augmented Dickey-Fuller Test data: d Dickey-Fuller = -6.3935, Lag order = 12, p-value = 0.01 alternative hypothesis: stationary Warning message: p-value smaller than printed p-value in: adf.test(d)
We can try this again with annual values.
d< -readCRU(temp=14)
> adf.test(d)
Augmented Dickey-Fuller Test
data: d
Dickey-Fuller = -2.0938, Lag order = 5, p-value = 0.5372
alternative hypothesis: stationary
For comparison we can apply the test to random numbers which don’t have a unit root, and the cumulative sum of random numbers that do. i.e.
adf.test(rnorm(1000)) adf.test(cumsum(rnorm(1000))
The results are similar to the results for monthly and annual temperature. Monthly temperatures don’t have a unit root and annual temperatures do have a unit root. This preliminary testing suggests annual temperatures are indistinguishable from a random walk. This doesn’t mean that they are, as more rigorous testing may succeed in rejecting the null hypothesis. The post Scale Invariance for Dummies suggests that temperatures are actually very close, but slightly less than the unit root.
- 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!