I’ve taken Time Series analysis class to figure out if analyzing financial data and predicting stock markets (my first association with time series) were something I would be interested in doing. Additionally, there are many practical scientific and business applications - starting with electrocardiology analysis and ending with airline tickets sales.
What I’ve learned, shortly:
- Don’t play on the stock markets - the best guess is (almost) always the current value (in other words, the chance of being any good in prediction is basically zero).
- Use TS to gain insights about your business data.
- Scientific use is very complicated most of the times nonetheless interesting.
What is Time Series Analysis anyways?
In regular stats we have a population (set of all data points), from which we have a random (i.e. representative - hopefully) sample (of size N) of available observations. We calculate sample statistics and infer it to be true about the general population as well. The bigger the sample size N the more we are statistically sure.
Now, Time Series Analysis aims to perform similar trick (analyzing sample and inferring about general) but for the process rather than for the population. Usually, then, we have only one observation/realization (Apple stock price history) of the process , but this process could have generated a different realization - in fact infinitely many of them! That is the key difference of the TS: we trying to describe the process that generated different realizations using available observations (usually one) and then predict what would happen to our realization in the future. I hope by now you get the idea of how sketchy and speculative all that sound - in case of the stock markets, especially, it’s pretty much a gamble.
To describe the observation (time series) people came up with a model ARIMA, which stands for auto regressive integrated moving average. Sounds scary, but in reality it’s extremely simple:
- AR part is just a linear combination (summation with coefficients) of previous TS values equal white noise.
- MA part is again just a linear combination, this time of random noise values equals to the current TS value.
- Integrated simply means that de-trend the time series by linearly subtracting previous value from the current.
Given the realization, we try to fit the coefficients for those linear combinations and then predict the future values.
That is, shortly, what is Time Series about. Again, importantly, the length of the TS doesn’t give us the statistical power, as in regular statistics - we only gain power if we have more realizations, when, for instance, we track the heart beat process for the 24 hours straights, which yields a lot of observations of that cyclic process.
Investigations (pdf papers)
Estimating ARMA Coefficients and Predicting Future
In this take home final exam for TS class we created a definitive ARMA process (by specifying the true coefficients) to generate 500 realizations. Then using them (all or partially) tried to fit the coefficients using the standard tool set, while judging which metrics work better for our case. Finally, there is example of predicting TS - even for the simple case it works remarkably bad, in my opinion.
(Non) Consistent Estimators and the Effect of Differencing
Consistent estimator is an estimator which only gets closer to the true parameter given more realizations. In this paper we learn that while sample autocorrelation is consistent estimator, periodogram is not.
(First order) differencing is just: for each x_(i) in TS do: x_(i) = x_(i) - x_(i-1). By doing so we can remove linear trend. Paper discusses how to do that in R and how it affects sample correlogram and spectrum.
Harmonic Process and How to Convert ARMA into MA
Harmonic process is simply sum of sinusoids, we show it to be second-order stationary. Also it doesn’t have a good spectrum function because it’s not absolutely continuous; the cumulative spectrum is alright though.
Then paper shows how to convert ARMA into MA(inf) representation by long division - which only works if the AR roots are outside of unit circle.
Paper also shows the effect of taking the 12th differencing on spectrum and shows how to check whether or not the AR coefficients are valid (possible).
Time Series Models Summary
A dry summary on TS models: White Noise, Random Walk, Harmonic, AR, MA, ARMA and their properties: ACF, partial ACF and spectrum.