Stationarity and differencing of time series data (2024)

<![if !vml]><![endif]>Data concepts

Principles and risksof forecasting (pdf)

Famous forecastingquotes
How to move data around
Get to know your data
Inflation adjustment (deflation)
Seasonal adjustment
Stationarity and differencing
The logarithm transformation

Stationarity anddifferencing

Statistical stationarity
First difference (period-to-period change)

Statisticalstationarity: Astationary time series is one whose statistical properties such as mean,variance, autocorrelation, etc. are all constant over time. Most statistical forecastingmethods are based on the assumption that the time series can be renderedapproximately stationary (i.e., "stationarized") through the use ofmathematical transformations. A stationarized series is relatively easy topredict: you simply predict that its statistical properties will be the same inthe future as they have been in the past! (Recall our famous forecasting quotes.) The predictions forthe stationarized series can then be "untransformed," by reversingwhatever mathematical transformations were previously used, to obtainpredictions for the original series. (The details are normally taken care of byyour software.) Thus, finding the sequence of transformations needed tostationarize a time series often provides important clues in the search for anappropriate forecasting model.Stationarizing a time series through differencing (where needed) is animportant part of the process of fitting an ARIMA model, as discussed in the ARIMA pagesof these notes.

Anotherreason for trying to stationarize a time series is to be able to obtainmeaningful sample statistics such as means, variances, and correlations withother variables. Such statistics are useful as descriptors of future behavior onlyif the series is stationary. For example, if the series is consistentlyincreasing over time, the sample mean and variance will grow with the size ofthe sample, and they will always underestimate the mean and variance in futureperiods. And if the mean and variance of a series are not well-defined, thenneither are its correlations with other variables. For this reason you shouldbe cautious about trying to extrapolate regression models fitted tononstationary data.

Mostbusiness and economic time series are far from stationary when expressed intheir original units of measurement, and even after deflation or seasonaladjustment they will typically still exhibit trends, cycles, random-walking,and other non-stationary behavior. If the series has a stablelong-run trend and tends to revert to the trend line following a disturbance,it may be possible to stationarize it by de-trending (e.g., by fitting a trendline and subtracting it out prior to fitting a model, or else by including thetime index as an independent variable in a regression or ARIMA model), perhapsin conjunction with logging or deflating. Such a series is said to be trend-stationary. However, sometimes even de-trending is not sufficient to make theseries stationary, in which case it may be necessary to transform it into aseries of period-to-period and/or season-to-season differences. Ifthe mean, variance, and autocorrelations of the original series are notconstant in time, even after detrending, perhaps the statistics of the changesin the series between periods or between seasons will beconstant. Such a series is said to be difference-stationary.(Sometimes it can be hard to tell the difference between a series that istrend-stationary and one that is difference-stationary, and a so-called unitroot test may be used to get a more definitive answer. We willreturn to this topic later in the course.)
(Return to top of page.)

Thefirst difference of a time series is the series of changes from oneperiod to the next. If Yt denotes the value of the time series Y atperiod t, then the first difference of Y at period t is equal to Yt-Yt-1.In Statgraphics, the first difference of Y is expressed as DIFF(Y), and inRegressIt it is Y_DIFF1. If the first difference of Y is stationary and also completelyrandom (not autocorrelated), then Y is described by a randomwalk model: each value is a random step away from the previous value. Ifthe first difference of Y is stationary but not completely random--i.e.,if its value at period t is autocorrelated with its value at earlierperiods--then a more sophisticated forecasting model such as exponentialsmoothing or ARIMA may be appropriate. (Note: if DIFF(Y) isstationary and random, this indicates that a random walk model is appropriatefor the original series Y, not that a random walk model should be fittedto DIFF(Y). Fitting a random walk model to Y is logically equivalent tofitting a mean (constant-only) model to DIFF(Y).)

Here is agraph of the first difference of AUTOSALE/CPI, the deflated auto sales series.Notice that it now looks approximately stationary (at least the mean andvariance are more-or-less constant) but it is not at all random (a strongseasonal pattern remains):

Stationarity and differencing of time series data (2)
(Return to top of page.)

Thefollowing spreadsheet illustrates how the first difference is calculated forthe deflated auto sales data:

Stationarity and differencing of time series data (3)


(Return to top of page.)

Go on to next topic: The logarithm transformation

Stationarity and differencing of time series data (2024)

FAQs

Stationarity and differencing of time series data? ›

A stationary time series is one whose statistical properties do not depend on the time at which the series is observed. Thus, time series with trends, or with seasonality

seasonality
A seasonal pattern occurs when a time series is affected by seasonal factors such as the time of the year or the day of the week. Seasonality is always of a fixed and known frequency.
, are not stationary — the trend and seasonality will affect the value of the time series at different times.

What is a differencing time series? ›

Differencing is a technique to transform a non-stationary time series into a stationary one. It involves subtracting the current value of the series from the previous one, or from a lagged value.

Which are the 3 types of stationarity in data? ›

Types of Stationary Series
  • Strict Stationary – Satisfies the mathematical definition of a stationary process. Mean, variance & covariance are not a function of time.
  • Seasonal Stationary – Series exhibiting seasonality.
  • Trend Stationary – Series exhibiting trend.

How to tell if a time series is stationary? ›

The observations in a stationary time series are not dependent on time. Time series are stationary if they do not have trend or seasonal effects. Summary statistics calculated on the time series are consistent over time, like the mean or the variance of the observations.

What is the difference between trend stationary and difference stationary? ›

Trend stationary: The mean trend is deterministic. Once the trend is estimated and removed from the data, the residual series is a stationary stochastic process. Difference stationary: The mean trend is stochastic. Differencing the series D times yields a stationary stochastic process.

Why do we need stationarity in time series? ›

Trends and patterns in stationary time series are easier to interpret because relationships between data points remain constant, which means that we can be confident that any trends or patterns we observe are not simply due to random fluctuations in the data.

What is the first differencing time series data? ›

The first difference of a time series is the series of changes from one period to the next. If Yt denotes the value of the time series Y at period t, then the first difference of Y at period t is equal to Yt-Yt-1. In Statgraphics, the first difference of Y is expressed as DIFF(Y), and in RegressIt it is Y_DIFF1.

What to do if a time series is not stationary? ›

Transforming non-stationary into stationary time series can be achieved through differencing or taking the natural logarithm of the data. Not all time series are stationary, and it's important to be aware of this assumption and to take appropriate steps to account for non-stationarity when analyzing such data.

What is an example of a stationarity time series? ›

A stationary process' distribution does not change over time. An intuitive example: you flip a coin. 50% heads, regardless of whether you flip it today or tomorrow or next year. A more complex example: by the efficient market hypothesis, excess stock returns should always fluctuate around zero.

Why is second order differencing in time series needed? ›

For a discrete time-series, the second-order difference represents the curvature of the series at a given point in time. If the second-order difference is positive then the time-series is curving upward at that time, and if it is negative then the time series is curving downward at that time.

What is the Dickey Fuller test for stationarity? ›

In statistics, the Dickey–Fuller test tests the null hypothesis that a unit root is present in an autoregressive (AR) time series model. The alternative hypothesis is different depending on which version of the test is used, but is usually stationarity or trend-stationarity.

Can second differencing in time series help to eliminate which trend? ›

For example, first-differencing a time series will remove a linear trend (i.e., differences = 1 ); twice-differencing will remove a quadratic trend (i.e., differences = 2 ).

What is a stationary time series for dummies? ›

A stationary series is one where the mean of the series is no longer a function of time. With trending data, as time increase the mean of the series either increases or decreases with time (think of the steady increase in housing prices over time).

Is stationary the same as autocorrelation? ›

Stationarity means that the mean, variance, and autocovariance of your data do not change over time. Autocorrelation means that the values of your data are correlated with their past values. These properties affect how you can model and forecast your data, as well as how you can test for significance and causality.

How to detrend a time series? ›

The simplest way to detrend a time series is by subtracting the mean value of the data. This is called a constant model, and it assumes that the trend of the time series is a straight horizontal line.

What is the difference between stationery and stationary time series? ›

Stationary vs non-Stationary Time Series

A time series is said to be stationary when its statistical properties are constant and there's no seasonality in the time series. For a time series to be stationary, The mean of the time series is constant. The standard deviation of the time series is constant.

What is a differencing technique? ›

Differencing of a time series in discrete time is the transformation of the series to a new time series where the values are the differences between consecutive values of. . This procedure may be applied consecutively more than once, giving rise to the “first differences”, “second differences”, etc.

Why is differencing important and advantageous? ›

Differencing has several advantages for time series analysis. First, it can simplify the modeling and forecasting process by reducing the complexity and variability of the time series.

What is the difference between Detrending and differencing? ›

Detrending is a method used to remove the long-term trend or seasonality from a time series. Differencing, on the other hand, is a technique used to remove the short-term correlations in a time series.

What is differencing in time series Python? ›

When working with time series data, differencing is a common technique used to make the data stationary. Stationary data is important because it allows us to apply statistical models that assume constant parameters (like the mean and standard deviation) over time, and this can improve the accuracy of our predictions.

Top Articles
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 6544

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.