# Removing a 'trend in variance' from a time series

I'm looking at a time series which has a very strong daily cycle in it. However, on top of having a daily cycle in the actual values of the time series, it also has a very strong daily variance cycle.

I am wondering if I can meaningfully remove the 'variance trend' from my time series. I can calculate the 'average variance' for a given hour and then divide by it, but I'm not sure I'm doing anything useful if I do this?

The large variance does correlate with large values in the daily cycle too, but taking a log doesn't seem to help much.

EDIT: EXTRA INFORMATION

As pointed out in the comments, this problem is rather under-defined. Unfortunately, this is a symptom I am also dealing with and so I can't fix that. However, I will try to give some more information.

The goal is to have a model of the time series from which realisations can be drawn. The time series data is a measure of concentration over time, with clear daily and yearly cycles and a linear trend. There are many covariate time series which at least follow the same daily and yearly cycles.

I am currently just trying to explore and learn different time series techniques. I wasn't hoping for a 'solution' but rather for a bit of direction as I hadn't been able to find much information about trends in the variance.

• If you are interested in predicting variations within a day, you need to model them. If you are not, then aggregate to daily values. What's missing from this question is quite what you want to do, based on what you consider interesting or useful for later applications. There can't be a recommendation for what to do independent of that. Aug 5 '13 at 7:20
• What are you measuring? Are they counts, for example? Aug 5 '13 at 8:43
• Fair point Nick, the problem is unfortunately under defined, the goal being 'a good' model of the time series. I will update my question though to reflect this. Glen: No, it is a concentration. Aug 5 '13 at 23:04
• This would explain the changing variance. You might want to look at models that incorporate this understanding fairly directly. Are these concentrations like compositional data (limited to [0,1]) or is it more that there's practically just a lower bound (of zero)? In the second case you might find log-concentrations (for example) easier to model both in terms of the location and the spread. Aug 6 '13 at 5:20
• Hmm, I hadn't considered specifically looking at transformations intended for concentrations. The concentrations are actually in a fairly uninteresting window (say [200,1000]). I'll do some reading. Aug 6 '13 at 7:23

No one will be able to help you without an example of the data or more information, however a few things can be said. I will not elaborate on the algebra of things though, you best research that for yourself.

The books of Greene and/or Hayashi concerning Econometrics are a good source about the topics of heteroscedasticity, autocorrelation and (F)GLS. An easier example is Stock/Watson.

First, the variance trend can probably be modeled by a matrix of covariances, ie. $V[\epsilon|X] = \Omega$
In that case you can use the GLS estimator to eliminate the heteroscedasticity. Especially useful to you should be the FGLS techniques. In that case you estimate the matrix from residuals of a regular OLS and then iteratively refine your estimates. Wikipedia FGLS

As far as your dependency on the magnitude of your data is concerned, this is also eliminated by FGLS. You can see that the GLS estimator (in terms of General Method Of Moments) comes down to the following problem:
${E}[\,x_t(y_t - x_t'\beta)/\sigma^2(x_t)\,]=0$
So you should transform your model accordingly (this is equivalent to using the GLS estimator, using the matrix $\Omega$
In addition to the wikipedia article I wrote about GLS / heteroscedasticity here

If you are using R, another strategy can be to use Newey-West variance/covariance robust error term estimators. This can be achieved by adding vcov=vcovHAC as an argument to your R-functions. If your dataset is large enough, this will give you consistent estimates of your error terms.

• Thanks IMA (and Nick). I'm going to add some more detail to my question, but I'll try and follow the direction you've pointed me in. Aug 5 '13 at 23:06
• well you had the right idea. In general, dividing by the variance gives you a good transformation. This essentially what FGLS does (based on the empirical estimate of your variance). But you should be aware that the precise GLS estimate would be with the unknown, theoretical covariance matrix. Anyway, if you transform via FGLS you should have what you were looking for, good luck.
– IMA
Aug 6 '13 at 7:25
• As far as the general techniques for time series are concerned - (F)GLS is very much a technique associated with cross-sectional yet heteroscedastic data - and data which has explanatory variables. Often in time series you will try to instead model the time series on itself, so with lagged values of that time series as explanatory variables. This is another topic (keywords: Arma, Arima). Once again I strongly suggest looking at econometric literature, as this is the field most concerned with time series. The books from above will be an excellent start.
– IMA
Aug 6 '13 at 7:31
• @IMA Very good advice, but econometrics is the field most concerned with time series? That's a widespread impression within economics or econometrics, but many engineers or physical scientists would raise an eyebrow or two at that. (I am not trying to start an argument, just underlining how many fields have serious interests in time series, each tending to regard their own perspective as central.) It's unfortunate that the OP leaves open what field they are working in, but the interest in "concentrations" suggests that it is not economics. Aug 6 '13 at 9:36
• I meant it the other way around - econometricians don't do more, but the "standard" teaching progression in finance and economics is overwhelmingly focused on large datasets and timeseries data. For better or worse the courses often skip other concepts, more than other fields I think. Also, for me, Hamilton and Luetkepohl are the standard monographic texts in time-series analysis and both are from the economics field. Both Engle and Granger with the nobel price for cointegration and Garch (TS essentials) are economists...
– IMA
Aug 6 '13 at 10:03

You can find some suggestions by looking with following keywords:

-Seasonal ARIMA models -State Space Models -Basic Structural Model by AC Harvey -Kalman Filter and structural time series models -TRAMO/SEATS and/or Demetra