R Tutorials Top Banner

TIME SERIES ANALYSIS


Definition

When a process is measured over time--i.e., in a sense, "time" is the independent or explanatory variable--then the resulting sequence of measured values is called a time series. The difference between time series data and independent measurements that just happen to be made over time is that in time series data the successive data points are often correlated. For example, the built-in data set "sunspots" is a count of the number of sunspots observed during every month from 1749 through 1983. The autocorrelation function reveals how successive data points in the series are correlated...

> acf(sunspots)
sunspots acf
As seen in this graph, the data points are perfectly correlated with themselves (lag = 0), but successive points are also highly correlated as well. For example, a point is correlated with the next point at higher than r = 0.9, and this autocorrelation between points in the series does not drop to near zero until three years have passed.

This means traditional techniques that assume independent measurements should not be used in the analysis of time series data.

Before we go on, I have to warm you. My knowledge of time series analysis is rudimentary to say the least. So I will be presenting just the very basics here. You should not assume this is all that R can do with time series--it's just all I can do. In fact, R contains extensive facilities, many in optional packages, for dealing with time series. If you want an elementary introduction to time series, I'm told that Chatfield (2003) is an excellent source.



Return to the Table of Contents