As noted in in the time series introduction not all time series are stationary. For example, the measles time series shown in the introduction document shows quite different statistical behaviour in the first and second halves of the series.
We also wrote about the autocorrelation function. The autocorrelation quantified the degree of association generally within the series between any point and another point separated from the first by a lag which we denoted by k. The autocorrelation is a global concept and applies to the whole series at once.
However, as shown by the measles example the statistical properties of nonstationary series depend very much where you are looking: at which time point. Hence, for a nonstationary series we need to ask about the value of autocorrelation at a given lag (as before) and also where in the series.
Mathematically, the autocovariance function for stationary series is given by c(k). For a nonstationary series c is a function of time t and lag k and can be written as c(t, k).
So, if autocovariance and autocorrelation can vary for a nonstationary time series and we need to estimate c(t,k), how can we do that (or rather get a computer to do it for us)? There are several possible solutions, some good, some not so good.
One easy solution is to find the point in time that you are interested in, t say and gather together (in time order, of course) all of the time series points near to t and apply the regular autocovariance method to that segment. That sounds pretty good, but there are a number of problems with this approach.
Taking segments will indeed give you `localized' estimates, but how long should your segment be? Should it be of length 10, 20, 50 or longer? Of course, choosing longer segment lengths should give better estimates of the local autocovariance, but as the segment length gets longer the estimate is becoming less and less local. On the other hand, if your segment is very short then there is no way you are going to be able to estimate the longer lags. For example, if your segment length was 10 how are you going to estimate an autocovariance at lag 11? Do you take overlapping or non-overlapping segments? How do you form confidence intervals when you have the results of many, possible overlapping segments?
Pretty soon the segmented solution does not sound so attractive. A better solution is maybe to estimate the whole quantity c(t, k) in one go.
The concept of localized autocovariance, c(t, k), as a function that measures the covariance between Xt and Xt+k, has been around for a long time (see, for example, the excellent book by Priestley (1981), but the idea goes way back). There is one c(t, k) but several ways in which is can be estimated.
One method of estimation is to obtain a time-varying local frequency spectrum, maybe using some form of time-frequency analysis. Then one can obtain a localized autocovariance by taking a windowed Fourier transform of the time-frequency spectrum (just as we noted that autocovariance and the classical spectrum were a Fourier pair in the introduction).
Nason, von Sachs and Kroisandt (2000) introduced another method based on using wavelet processes (wavelet processes are models for time series that use small oscillations, wavelets, as building blocks). The idea is similar to the Fourier method above. One can form a time-varying wavelet spectrum which provides information on how the time series' power is distributed over time and scale. The wavelet spectrum can be converted into the localized autocovariance using a type of wavelet, not Fourier, transformation.
The idea of estimating localized autocovariance using wavelet methods has recently been developed further by Nason (2013). The new work presents a new estimator as well as mathematically rigorous confidence intervals permitting, for the first time, confidence intervals for the autocovariances. The confidence intervals permit the user to assess whether a given autocovariance at a given time point is statistically significantly different from zero or not. The localized autocovariance figures below are produced using this new work in conjunction with the associated R software package locits.
Example: Measles Localized Autocovariance. The figure below shows the estimated localized autocovariances for the London measles time series (shown in the introduction). Lags from zero to seven are shown by numbers overlaid on the lines one for each lag. At lag zero we know that the localized autocovariance is always equal to one and so this is shown by the solid perfectly horizontal line at height of one.
All the autocovariances at lags from one to seven are at different heights but are remarkably similar in form. Either side of 1978 the localized autocovariances seem relatively constant indicating that this might be piecewise constant process with different regimes in operation either side of 1978. For example, let us pick on the specific lag of two. Prior to 1978 the autocovariance seems to be about 0.65 and stays very close to this level. After 1978 the lag two autocovariance rapidly increased to about 0.95 and then stays roughly at that level.
The previous plot showed the localized autocovariance at different lags across time. The next plot picks on two time locations 10th September 1955 and 2nd August 1985 and draws the localized autocovariances at those points in the style of the regular autocovariance. The previous plot indicates these two time plot by two blue dashed vertical lines.
One can see clearly that the autocovariance is quite different at the beginning and ends of the London measles series. The red vertical bars provide the approximate pointwise 95% confidence intervals for the point estimate of the localized autocovariance shown by a diamond. Note, that by these confidence intervals the lag six autocovariance on the 10th September 1955 is not statistically significant from zero, but it is at the later date. Looking at these two plots it is quite clear that the London measles series have changed its dynamics quite considerably, and apparently via a step change around 1978.
Example: Simulated autoregressive example
The following figure shows a realization of a time-varying autoregressive process (TVAR for short) of order 1. This is similar to the (stationary) AR process introduced in the introduction: the crucial difference being that in the TVAR(1) process the constant parameter a is permitted to change over time and become at. In other words the model behind the TVAR(1) is
xt = at xt-1 + zt.
For the figure below the parameter at varies linearly from 0.9 to -0.9 over the extent of the series. Figure a., b., c. and d. are the localized autocovariance at times 100, 200, 300 and 400 respectively. The far left of this figure looks like the AR(1) with parameter of 0.9 shown in the left plot and the far right of the figure looks like the AR(1) with parameter -0.9 shown in the right plot of the figure in the introduction. This TVAR(1) model is not stationary.
So, what does the localized autocovariance look like? See the the following figure.
Plot (a.) shows the localized autocovariance around time 100. The TVAR(1) parameter around this time point is about 0.55 and the true autocovariance for an (equivalent stationary) AR process is about 0.79. The dashed horizontal line is drawn at height 0.79 in plot (a.) and it can be seen that the 95% CI for the lag one autocovariance covers it. Similarly, for the other three plots the 95% CI cover the true values of the parameters at lag one.
It is certainly useful to compare the true values with the estimates but it it also useful to take in all four pictures as a whole. The localized autocovariance plot at time 100 (a.) looks like the autocovariance for an AR process with positive mid-sized parameter, and the plot at time 400 (d.) looks like the autocovariance for an AR process with negative mid-sized parameter. As a whole one can see the TVAR parameter changing from positive to negative in the single realization , i.e. a nonstationary realization.
Example: FTSE log returns data
The FTSE log return data was plotted in the introduction here. The conventional wisdom for this kind of series is that its autocorrelation/autocovariance is always zero (for all non-zero lags, of course). The next figure shows the regular autocorrelation function computed on the FTSE log returns series.
Well, all the nonzero lag autocorelations are certainly small. According to the approximate 95% confidence intervals at least one is statistically significant from zero! However, the autocorrelations are small so maybe its sampling error, and they really are zero? Note, the lag one sample autocorrelation is 0.139.
For an alternative explanation the following picture shows the localized autocorrelation plotted against time. The horizontal dashed blue line is the value 0.139 (and a horizontal dotted line is also plotted at height 0 for reference). What is interesting is that the localized autocorrelation at lag one for the FTSE series starts off very close to zero, and then steadily climbs to about 0.2 In fact, if you averaged all of the localized autocorrelation values over time you would end up with a value not far from 0.139 which is demonstrated by the horizontal dashed blue line which is located at the middle (in height) of the two extreme values of 0 and 0.2. So, the regular autocorrelation averages out the localized autocorrelation.
Clearly, then, the FTSE series seems to have a time-changing autocorrelation. To the left of the series it is near zero, and to the right it is near to 0.2. Let us plot the localized autocovariances in the style of a regular autocovariance plot with confidence intervals, to see whether the seemingly bigger values (at the right hand end) are significantly different from zero.
First, the next plot shows the localized autocovariance at time 100.
Well, the autocovariance values are not exactly zero (and you'd expect that as they're random and computed from data). However, ALL the 95% confidence intervals completely cover the zero line. So, the conclusion is that NONE OF THEM are significantly different from zero. What about for the later time of 400? The next plot shows this.
For the time 400 plot the lag one autocovariance's confidence interval does not overlap zero and hence we can conclude that the lag one autocovariance IS significantly different from zero, and actually the same is true for the lag four, five, six and some of the higher lags.
Hopefully, this page and its examples will have convinced you of the usefulness of localized autocovariance and autocorrelation. If you have tested your time series for stationarity and it rejects stationarity then the localized tools above could be appropriate for, and give you insight into your data.
The localized autocovariances and their confidence intervals are produced using the Rvarlacv function in the locits in R.
Nason, G.P. (2013) A test for second-order stationarity and approximate confidence intervals for localized autocovariances for locally stationary time series, Journal of the Royal Statistical Society, Series B, 75, (to appear).
Nason, G.P., von Sachs, R. and Kroisandt, G. (2000) Wavelet processes and adaptive estimation of the evolutionary wavelet spectrum., Journal of the Royal Statistical Society, Series B, 62, 271-292.
Priestley, M.B. (1981) Spectral Analysis and Time Series, London: Academic Press.