A time series comprises four major components. A trend. A seasonal component. A cyclic component. And a stochastic/ random component. All these components may or may not be present in a time series.
Therefore, before estimating these components, we need to first check for their existence. If they are present then we can move forward with their estimation.
This article explains the Relative Order Test for testing the existence of a trend.
Let’s start with an example. Suppose we have 12 observations of a time series. And, we need to find whether a trend is present or not.
Once you skim through the observations, it will be evident that a trend exists. The values gradually move from 1 to 11.
From Fig.2 also, we can say, a rising trend exists.
Our intuition says that the trend exists, now lets us try to prove this mathematically.
It is a non-parametric measure of a relationship between columns of sequential data. And time series is sequential. Hence we can use Tau to check the relationship between time and variable Y.
If they are highly correlated, then we can say a trend exists, as the timestamps are always increasing.
Consequently, if they are positively correlated, an increasing trend exists. Whereas, if they are negatively correlated, a decreasing trend exists.
Kendall’s Tau is given in Fig.3
In Fig.3, T is Kendall’s Tau, C is Concordant pairs, and D is Discordant pairs.
The pairs (i, Y(i)) and (j, Y(j)), where i and j are the timestamps, and Y(i) and Y(j) are the value of the variable at that time, forms a Concordant Pair if:
They form a Discordant pair if:
If T=0 or the number of concordant and discordant pairs are equal, no trend exists. Because, if C = D, the occurrence of a rise or a fall is equally likely. Hence we cannot say a trend component exists.
If T=1 or T=-1, a strong trend exists. Because if C=0 or D=0, the series have either a rising trend or a falling trend. In short, a trend exists.
Now, let us calculate the concordant and discordant pairs for the example given.
We calculate the value of T=0.85 from the formula in Fig.3. That is close to unity. Hence, we can say that a strong trend exists, which is also coherent with our intuition.
But we have to explain what “close” means in the above sentence. For that, we will perform some statistical tests.
Once we have calculated T, we can calculate the z-score and p-value. For a 95% confidence interval if p-value<0.05, we can reject the null hypothesis. Which states that there is no trend present.
The formulas for z-score and degree of freedom are given in Fig.7.
So let’s apply this statistical testing to the example given.
We define the hypotheses as:
Null Hypothesis H0: No trend exists
Alternate Hypothesis Ha: Some trend exists
Also, previously we have calculated the following:
T = 0.85
Degree of Freedom (dof) = N-2 = 10
We can put the values in Fig.7, and get z = 3.85 and dof=10.
Corresponding to these values, we arrive at p-value = 0.001, which is less than 0.05.
Hence we can reject the null hypothesis. Therefore, we can say, there is a trend present.
We have mathematically tested our intuition. And, it comes that it was right. This is called Relative Order testing.
This is a very easy technique to check the existence of a trend in a Time series.
For more such content, please visit my youtube channel.