Consider the following time series,
What does it look like ? I know, this is a stupid game, but I keep using it in my time series courses. It does look like a random walk, doesn’t it ? If we use Philipps-Perron test, yes, it does,
> PP.test(x) Phillips-Perron Unit Root Test data: x Dickey-Fuller = -2.2421, Truncation lag parameter = 6, p-value = 0.4758
If we look at the autocorrelation function, we do observe some persistence,
> acf(x,100)
Perhaps this persistence can be related to long range dependence, or to some fractional random walk. A natural idea could be estimate Hurst parameter, using for instance Beran (1992) estimator – based on Whittle (1956) – where we assume that the autocorrelation function satisfies
as for some (the so called Hurst index). But here, we start to observe unexpected ouputs,
> library(longmemo) > (d <- WhittleEst(x)) 'WhittleEst' Whittle estimator for fractional Gaussian noise ('fGn'); call: WhittleEst(x = x) time series of length n = 759. H = 0.9899335 coefficients 'eta' = Estimate Std. Error z value Pr(>|z|) H 0.98993350 0.02468323 40.1055 < 2.22e-16 <==> d := H - 1/2 = 0.49 (0.025) $ vcov : num [1, 1] 0.000609 ..- attr(*, "dimnames")=List of 2 .. ..$ : chr "H" .. ..$ : chr "H" $ periodogr.x: num [1:379] 1479.3 1077.3 371.7 287.2 51.2 ... $ spec : num [1:379] 62.5 31.7 21.3 16.1 12.9 ...
or more precisely some non-expected values for Hurst parameter, which should be in
> confint(d) 2.5 % 97.5 % H 0.9415553 1.038312
Oops, perhaps, we did miss something, because it looks like there is extremely strong persistence on our time series,
> plot(d)
It is probablty time to ask where I found that series… To be honest, I did borrow it from a great canadian website http://climate.weatheroffice.gc.ca/climateData/. For instance, it you want the temperature we did experience a few days ago, you can use
> Y=2013 > M=1 > D=25 > url=paste( "http://climate.weatheroffice.gc.ca/climateData/hourlydata_e.html? timeframe=1&Prov=QC&StationID=5415&hlyRange=1953-01-01|2013-02- 01&Year=",Y,"&Month=",M,"&Day=",D,sep="") > page=scan(url,what="character")
Yes, that series is the temperature we did experience in Montréal last month (hourly time seies). On the graph below, you can actually compare it with temperature experienced in Januarys over the past 60 years,
So it is not that surprising to see long range dependence models appearing (I did write a paper on that topic precisely a few years ago). What I found puzzeling is that persistence is large, extremely large. And the problem is that I do not see how we can explain ‘jumps’ that we do observe on that series. For instance the behavior of the series while I was in Europe, before January 20th: within 3 days, the temperature went down, from 0°C to -20°C, and up from -20°C to 0°C, and then down again, from 0°C to -20°C (a nice И if we use cyrillic letters). Or how can we explain the oscillating behavior observed the week after, where the temperature went up, from -25°C to (almost) +10°C in a few days. Within 10 days, we did observe also two ‘jumps’ (or ‘crashes‘ if we want to use the terminology of financial time series) with a decrease of 25 degrees in less than 24 hours ! Obviously, we need to find other classes of model to replicate that kind of behavior we observe on temperatures…
OpenEdition suggests that you cite this post as follows:
Arthur Charpentier (February 2, 2013). A random walk ? What else ? Freakonometrics. Retrieved November 5, 2024 from https://doi.org/10.58079/ouou
Hi Arthur!
I have done the same for a random walk:
x <- rnorm(1000)
y <- cumsum(x)
WhittleEst(y)
Gives me the same Hurst exponent… 0.9899413
les bonds que tu mentionnes, c’est de ça que je voulais (maladroitement) parler l’autre fois, i.e. est-ce que le moment ou ils arrivent est totalement imprévisible; ici ça semble être le cas…peut-être si on avait une (ou plusieurs?) autre série corrélée
My recollection is that failing to reject with the Dickey-Fuller test indicates problems with non-stationarity, and that could be the reason for the very slowly-decaying autocorrelations. Does your Montreal temperature data behave better if you take differences?
(I meant to try it myself, copying your code, but my variable “page” was full of html, and I didn’t see how you had extracted the data from that.)
Actually, one can easily play with html code, since the structure of the page is always (exactly) the same. With the following code, you can extract the temperature (I guess much more efficient codes can be produced)
For instance,