• Welcome to MEDVERSATION®
  • Log InREGISTER
  • SITE HELP
  • MEDVERSATION® is brought to you by Centocor Ortho Biotech Inc.
Introduction to Statistics
Outline Show

Time Series Analysis

Figure 1493 –


5343

A topic closely associated with multiple regression is time series analysis (TSA). Both techniques attempt to fit a line (most often, a straight one) to a series of data points. However, whereas multiple regression analysis (MRA) examines how various independent variables (IVs) operate together to produce an effect, TSA looks at changes in one variable over time. We do this in an informal and nonstatistical way every day. For example, in deciding whether or not to wear a coat today, we review the trend in the temperature over the past few days; or before investing the $20,000 we have just lying around gathering dust, we look at the performance of the stock market in general or of a specific company over the last few months. (We should note that some people rely on this “informal time series analysis” in situations where it shouldn’t be used. After seeing four reds in a row at the roulette wheel, they bet more heavily on black, erroneously assuming that its probability of occurrence is dependent on the previous spins. This is called the “gambler’s fallacy.” )

Although these examples may seem reasonable to a meteorologist or an economist, we rarely simply examine trends over time. More often, we are interested in somewhat different questions: Did things change after some intervention? Did the rate of automobile deaths fall after the speed limit was reduced? Was there a higher incidence of Guillain-Barré syndrome after the swine flu vaccination program was begun? Did the emptying of the psychiatric hospitals follow or precede the introduction of phenothiazines? The technical term for this line of questioning is interrupted time series analysis because it examines the effects of an intervention that may interrupt the ongoing pattern of events. The traditional way of representing this is

O O O O O X O O O O O

where the Os are observations of some variable over time and where X represents the intervention. (We could, of course, use an “I” for the intervention, but this would be too logical.) This shows that we have two sets of observations, those made before the intervention and those made after it. Observations can be of a single person or event over time (e.g., the price of a certain stock during 1 year or a child’s behavior in a classroom during the semester), or each observation can consist of the mean of different people or events (e.g., looking at how successive classes of applicants score on the Medical College Admission Test).

These examples point to two major differences between MRA and TSA. First, in MRA, we are looking at the relationship between one dependent variable (DV) and one or more IVs; in TSA, the interest is in changes in a single variable over time. The second difference, and one of significant consequence, is that in TSA, the data are serially correlated. What this very impressive term means is that the value of the variable at time 1 is related to and affects the value at time 2, which in turn is related to and affects the time 3 value. For example, today’s temperature is dependent in part on yesterday’s; it may differ by a few degrees one way or the other, but a large variation would be unexpected. Moreover, this implies that the temporal order of the variables is important; generally, the value for time 5 must fall between those of time 4 and time 6 to make sense of the trend. Multiple regression is not designed to handle this serial dependency, so it should not be used to analyze time series data although this has never stopped people from misapplying it in the past and most likely will not stop them from doing so in the future.

When we are looking for the effects of some intervention, we can ask three questions: (1) Has the level of the variable changed? (2) Has the rate of change of the variable changed? (3) Have both the level and rate of change of the variable changed?

The easiest way to explain what these questions mean is through a few examples. To begin with, let’s assume that we’ve just heard of a new golf ball that is guaranteed to shave five strokes from our game. How can we check this out? One way would be to play one game with our old ball, then play one with the new ball, and compare scores. However, we know that the scores vary from day to day, depending in part on how we’re feeling but also because of our improvement (we hope) over time. So any “positive” result with the second ball could be the result of a combination of natural fluctuations in our score, coupled with our expected improvement. What we need, therefore, is to play enough games with the first ball so that we have a stable estimate of our score, then play enough rounds with the second ball to be confident we know our new average score. Fig.1187 illustrates the variability in scores for the first six games played with the old ball and the latter six games played with the new ball. The arrow indicates when the intervention took place and where we would expect to see an interruption in the time series. Our question would be, “Taking into account our slow improvement over time and the variability in the two sets of scores, is the level of our scores lower, the same, or higher after the change?” Naturally, if there is a constant increase or decrease in the level of the scores, the average of the preintervention scores will always be different from the postintervention average. So when we talk about a “change in level,” we compare the last preintervention score with the first one after the interruption. Before we tell you how we figure this out, we’ll give a few more examples.

Figure 1187 – Figure 9-1: Golf scores before and after using a new ball.


5343

There’s some evidence that psychiatric hospitals began emptying out before the introduction of the major tranquilizers in 1955. If this is true, then we cannot simply look at the hospital census in 1954 and compare it with the 1956 census because the decrease may be due to something other than drugs. Our question has to be a bit more sophisticated: did the rate of emptying change because of the introduction of psychotropic medications? We can begin by plotting the total number of patients in psychiatric beds in the 10 years prior to our time of interest and for the following 10 years, as shown in Fig.1191(don’t believe the actual numbers; they were made up for this graph). Let’s examine some possible outcomes. In Fig.1191, (a), it appears as if the intervention has had no effect; neither the slope nor the level of the line has changed following the introduction of the new medication. In (b), there has been a sudden drop in the level, but the slope remains the same. This can occur if a large number of people are suddenly discharged at one time but the steady outflow of patients is unchanged. For example, it’s possible that over the time span examined, the hospitals had begun keeping acute patients for shorter periods of time, accounting for the sudden drop, but that this did not hasten (or slow down) the steady discharge of other patients. In (c), a situation is shown in which the rate of discharge of patients was speeded up by the new drug but without a mass discharge of patients at one time. Last, (d) shows both effects happening at once (i.e., a sudden discharge of patients followed by an increased discharge rate for the remaining patients). These are not the only possible patterns; let your imagination run wild and see how many others you can dream up. Try adding a delayed effect, a temporary effect, a gradual effect, and so on.

Let’s turn our attention from what TSA does to how it achieves such miracles. One factor that makes interpreting the graph more difficult is that the value of the variable may change over time, even without any intervention. If the change is always in one direction, it is called a trend. A gradual change one way followed by a gradual change the other way is referred to as drift. If we have relatively few data points, it may be difficult to differentiate between the two. The primary cause of trend or drift is the dependency of a value at one point on previous values. As we mentioned before, this is called serial dependency, and we find out if it exists by calculating the autocorrelation coefficient. When we compute a normal run-of-the-mill correlation, we have two sets of scores, X and Y, and the result can tell us how well we can predict one from the other. The “pairs” of scores are formed somewhat differently in autocorrelations; the value at time 1 is paired with the value at time 2, time 2 is paired with time 3, and so on. In a way analogous to a Pearson correlation, this tells us to what degree scores at time t are predictive of scores at time t + 1, and this is referred to as a lag 1 autocorrelation. However, the effect at time t may be powerful enough to affect scores down the line. We can explore this by lagging the scores by two units (e.g., time 1 with time 3, time 2 with time 4), three units (time 1 with time 4, time 2 with time 5), and so forth. If the lag 1 autocorrelation is significant (i.e., if the data are serially dependent), then the autocorrelations most often become smaller as the lags get larger. This makes sense on an intuitive level because the effect of one event on subsequent ones usually dissipates over time.

Figure 1191 – Figure 9-2: Different possible results from an intervention.


5343

A significant autocorrelation can be due to one of two causes: the scores themselves may be serially correlated, or sudden “shocks” to the system may have effects that last over time. The first situation is called the autoregression model whereas the second is referred to as the moving averages model. Thus, this is known as the autoregressive integrated moving averages (ARIMA) technique. Moving averages is another trick statisticians use to smooth out a messy line; that is, one with fluctuations from one observation to the next. We can take the average of scores 1 and 2, then the average of 2 and 3, then of 3 and 4, and so on. If the curve hasn’t been smoothed enough, we increase the order of smoothing, by averaging scores 1, 2, and 3; then scores 2, 3, and 4; then 4, 5, and 6, etc., until the end of the series. Since the extreme score is “diluted” by averaging it with more “normal” scores, its effect is thereby lessened. Theoretically, we can continue this until we have only one number, the mean of all the scores.

Our next step is to try to remove the effect of the trend or drift in order to see if there is any change in the level. This is done by differencing the time series, which means that the observation at time 1 is subtracted from the one at time 2, the time 2 observation is subtracted from the time 3 observation, and so forth. Let’s see how this works. Assume we have the following sequence of numbers:

1 3 5 7 9 11 13

If we were to draw these on a graph, a definite trend would be apparent since the points would increase in value with every observation period. Now, let’s take the differences between adjacent pairs of numbers. What we get is

2 2 2 2 2 2

So it’s obvious that there is no trend; the line is flat over all the observations. Note two things: first, there is one less differenced number than original observations, and second and more importantly, life is never this beautiful or clean-cut.

The success of differencing is checked by recalculating the autocorrelation. If it works, then the autocorrelation should quickly (i.e., after a few lags) drop to zero, and the series is said to be stationary. If there is still a trend, we repeat the process by subtracting the first differenced value from the second, the second from the third, and so on. Although in theory we can repeat this process of autocorrelating and differencing many times (or at least until we run out of numbers because we lose one observation each time we difference), we need only do it once or twice in practice.

Up to this point, what TSA has done is to try to determine what factors can account for the data. This is done by going through the following sequence of steps:

  1. Compute the lagged autocorrelations to determine if the sequence is stationary or nonstationary.

  2. If the sequence is nonstationary, difference the scores until it becomes stationary.

  3. Recompute the autocorrelations to see if the trend or drift is due to an autoregressive or a moving averages process.

These steps are referred to collectively as model identification. The next stages involve actually trying out this model with the data to see how well they fit. This involves estimating various parameters in the model and then diagnosing any discrepancies. Again, this is an interactive process since any discrepancies suggest that we have to identify a new model, estimate new parameters, and again diagnose the results.

Once all this is done we can move on to the last step, which is to see if the intervention had any effect. One way of doing this is simply to analyze the preintervention and postintervention data separately and then to compare the two models. The parameters will tell us if there has been a change in the trend, in the level, or in both. We are fortunate that computer programs exist to do the work for us although this is a mixed blessing because it has allowed people to analyze inappropriate data and report results that best belong in the garbage pail.5343 

Content on this page was last changed on March 19, 2009.

© 2002 BC Decker Inc. Show Disclaimer

References:

5343.  Norman GR, Streiner DL. PDQ Statistics . 3rd ed. Hamilton, Ontario: BC Decker Inc.; 2003.

Next Page: Examples »

Last Complete Site Update On: August 16, 2010