× back

Time series

A time series is a sequence of data points recorded at regular time intervals, used to track changes over time.

A time series refers to a sequential collection of data points or observations recorded over time intervals. These intervals could be regular (daily, weekly, monthly) or irregular, depending on the nature of the data being observed.

Components of time series

  1. ☆ Secular trend or trend
  2. ☆ Seasonal variations
  3. Cyclic variations
  4. Irregular Variations

Secular Trend

  • A secular trend is a long-term pattern or trend in data that shows consistent movement in a single direction over an extended period.
  • Example:- The gradual increase in average global temperatures over the past century is a secular trend. This long-term trend shows a consistent upward movement in temperature data due to climate change.

Seasonal Variations

  • Seasonal variation refers to predictable changes in data that happen at the same time each year. These changes follow a regular pattern due to seasonal factors such as weather, holidays, or cultural events.
  • Example: Electricity use usually increases every summer because people use more air conditioning. This predictable increase in electricity use during the summer months is an example of seasonal variation.

Cyclic Fluctuations

  • Cyclic fluctuation or variation refers to repetitive patterns of ups and downs in data over a period of time. Unlike seasonal variation, which occurs at specific times each year, cyclic variation follows a longer-term cycle that repeats at intervals longer than a year.
  • Example: The real estate market often experiences cycles of booms and busts, with periods of rising property prices followed by downturns. This cyclic pattern of price fluctuations, which may last several years, is an example of cyclic variation in the real estate industry.

Irregular Variations

  • Irregular variation refers to unpredictable or random fluctuations in data that do not follow a specific pattern or cycle. These fluctuations can occur due to various unpredictable factors, such as sudden changes in consumer behavior, unexpected events, or random occurrences.
  • Example: A company's daily sales may experience irregular variation when there is a sudden surge in demand due to a viral social media post about their product. This spike in sales is not part of a regular pattern and is considered an irregular variation in the data.

Measurement or Analysis of Secular Trend

  1. Free hand method (or graphical method)
  2. Method of semi-averages
  3. Method of moving averages
  4. Method of least squares

Free Hand Method

  • In this method, we visually plot the data points on a graph over time to identify the long-term trend.
  • The steps involved in the free hand method include:
    1. Plot data: Construct a graph with time on the x-axis and the variable of interest on the y-axis. Plot each data point.
    2. Identify trend: Analyze the data points to discern the long-term direction (upward, downward, or flat).
    3. Draw trend line: Draw a smooth line that captures the overall trend, not every data point.
      • Upward trend: Line with a positive slope.
      • Downward trend: Line with a negative slope.
      • Flat trend: Line with near-zero slope.

Question: Determine a trend line from the following:

Note: A trendline is a line that represents the overall direction of a dataset. It is not intended to perfectly match every data point, but rather to capture the general trend.

Semi Averages Method

Steps followed:

  1. Divide the Data: Split your time series data into two equal halves. If you have an odd number of data points, exclude the middle one for this method.
  2. Calculate Averages: Compute the average (arithmetic mean) of the values in each half of the data set. These become your "semi-averages."
  3. Plot the Points: Assign the first semi-average to a point midway through the first half of the data, and the second semi-average to a point midway through the second half. Plot these two points on a graph with time on the x-axis and the variable of interest on the y-axis.
  4. Draw the Trend Line: Connect the two plotted points (representing the semi-averages) with a straight line. This line is considered your estimated trend line.

Question 1: Fit a trend line by the method of semi-average to the data given below:

Solution: Here we have even number of years so, these can be divided into two equal parts.


Question 2: Find a trend line by the method of semi-averages.


Moving Average Method

This method is a more robust approach compared to semi-averages. It smooths out short-term fluctuations in the data to reveal the underlying long-term trend (secular trend).

Steps followed:

  1. Given Moving Average Size: You'll be provided with a specific number of data points to be included in the moving average calculation (the moving average size). This size determines how much smoothing is applied. A larger moving average size results in a smoother line but might be less responsive to recent changes.
  2. Calculate Moving Averages:
    • Odd Moving Average Size: Slide the window (encompassing the moving average size) across your data set one position at a time. For each window position, calculate the average of the data points within that window. You'll directly get a moving average for each data point (except potentially the first few and last few points depending on the moving average size).
    • Even Size (Centered Moving Average): Here's the trick! Because you have an even number of data points in the window, we need a special average for the center. Slide the window as usual. For even-numbered window sizes, find the center data point. To get its centered moving average, average the data point before it and the one after it (basically, the sum of two neighbors divided by 2). Do this for all center points in windows with even sizes.
  3. Plotting the Moving Averages: The original data points are plotted on a graph with time on the x-axis and the variable of interest on the y-axis. Subsequently, the calculated moving averages, including the centered values for even moving average sizes, are plotted alongside the original data points.

Question 1: Find the 5 yearly moving average for the following:

Now, we will plot actual value and trend value on the graph.

Least Square Method

We will understand the least square method using the following question:
Q- Fit a straight line trend by the method of least squares (taking 1978 as the year of origin) for the following data:

  • Step 1:
    The straight-line trend equation is given by:
    y = a + bx ---- (1)
    Normal equations:
    ∑ y = Na + b∑ x ---- (2)
    where N = number of years of data given.
    ∑ xy = a∑ x + b∑ x2 ---- (3)
    In the least squares method, we try to find the values of 'a' and 'b' using the normal equations.
  • Step 2:
    Create a table with columns for x, y, xy, and x2 (these are the values required in the normal equations).

    If the origin year is given in the question, then we can calculate the value of 'x' as the row year minus the origin year. If the origin year is not given, we have to assume it. The condition for assuming the origin year is as follows:
    If 'N' is odd, the middle year can be taken as the origin year. If 'N' is even, the average of the mid two years is taken as the origin year. For example, for the years 1980, 1981, 1982, 1983, 'N' is even, so the average of 1981 and 1982, which is equal to 1981.5, will be taken as the origin year. Accordingly, 'x' will be calculated.
    Now, calculate ∑ x, ∑ y, ∑ xy, and ∑ x2 as we require them in the normal equations to solve them.
    ∑ x = 21, ∑ y = 60, ∑ xy = 248, and ∑ x2 = 91.
  • Step 3:
    Using the values obtained from step 2, substitute them into the equations to find the values of 'a' and 'b':
    Equation 2 becomes: 60 = 6a + 21b
    Equation 3 becomes: 248 = 21a + 91b
    After solving these equations, we get a = 2.40 and b = 2.17.
    Now, substitute the values of 'a' and 'b' into equation 1 to get: y = 2.40 + 2.17x.
  • Step 4:
    Using the trend equation, we can find the trend values.

Seasonal Variations

Method of Simple Averages

In this method, the arranged data will be provided.
Let's understand the method of simple averages using the following question:
Q: Calculate the seasonal index for the following data using the simple average method, assuming the trend is absent.
Data for simple average method
Note: If the question does not explicitly state "use simple average method" but mentions "trend is absent", then we should use the simple average method.

  • Step 1:
    Find the total sum of all quarter values and then find the average.
    Calculation of total sum and average
  • Step 2:
    Calculate the Grand or General average, which is the average of the quarterly averages:
    General average = (average of 1st quarter + average of 2nd quarter + average of 3rd quarter + average of 4th quarter) / 4.
    For example: 3.675 + 4.125 + 3.55 + 3.55 4 = 14.9 4 = 3.725
    General average = 3.725
  • Step 3:
    Calculate the Seasonal Index for each quarter:
    Seasonal Index of a particular quarter = quarter average general average * 100
    For example, the seasonal index for each quarter:
    Seasonal index for 1st quarter = 3.675 3.725 * 100 = 98.66
    Seasonal index for 2nd quarter = 4.125 3.725 * 100 = 110.73
    Seasonal index for 3rd quarter = 3.55 3.725 * 100 = 95.30
    Seasonal index for 4th quarter = 3.55 3.725 * 100 = 95.30

Ratio to Moving Average Method

  • In the ratio to moving average method, we use a moving average to smooth out the data and calculate the seasonal indices by comparing the actual values to the moving average.

Q: From the following data, calculate the seasonal indices by the ratio to moving average method.
Data for ratio to moving average method

  • Step 1:
    Create a table with the following columns: 4-quarter moving total, 4-quarter centralized total, 4-quarter moving average trend (T), and the ratio of the moving average.
    Table for ratio to moving average method
  • Step 2:
    Find the total of the quarterly values and calculate the average for each quarter.
     Year | 1st Q | 2nd Q |  3rd Q | 4th Q
    -----------------------------------------
     1985 |   -   |   -   |  96.6  |  101.2
     1986 | 105.3 |  94.3 |  99.0  |  97.4
     1987 | 107.1 |  97.7 |   -    |   -
    -----------------------------------------
     total| 212.4 | 192   |  195.6 | 198.6
     avg  | 106.2 | 96    | 97.8   |  99.3
                            
  • Step 3:
    Calculate the General Average:
    General average = (106.2 + 96 + 97.8 + 99.3) / 4
    = 399.3 / 4
    = 99.825
  • Step 4:
    Calculate the Seasonal Indices:
    Seasonal Index for a particular quarter = quarter average general average * 100
    For example, the seasonal indices for each quarter are calculated as follows:
    Seasonal Index for 1st quarter = 106.2 99.825 * 100 = 106.39
    Seasonal Index for 2nd quarter = 96 99.825 * 100 = 96.16
    Seasonal Index for 3rd quarter = 97.8 99.825 * 100 = 97.97
    Seasonal Index for 4th quarter = 99.3 99.825 * 100 = 99.47

Ratio to Trend Method

  • In this method, we compare the actual data to the trend values to calculate the seasonal indices.
  • This method can be divided into 4 steps:
    1. Calculating the trend (similar to the least square method)
    2. Determining the quarterly trend
    3. Calculating the percentage of the quarterly trend
    4. Finding the seasonal indices

Q: Find the seasonal indices using the ratio to trend method from the data given below.
Data for ratio to trend method

  • Step 1: Calculating the yearly trend. For this, we sum up the quarterly data to get yearly totals, and then find the average and deviation using the mid-year as the origin.
    Yearly trend calculation
    To calculate the yearly trend values, we need the trend equation, which is y = a + bx, and the normal equations: Σy = Na + bΣx and Σxy = aΣx + bΣx².
    Now in the table, we add columns for Σxy and Σx².
    Table with additional columns for calculations
    Using the normal equations, we find the trend equation:
    Σy = Na + bΣx (here N = 5, number of years)
    Σxy = aΣx + bΣx²
    280 = 5a + 0 (since Σx is zero for mid-year as the origin)
    a = 56
    120 = 10b
    b = 12
    Hence, a = 56 and b = 12
    The trend equation is: y = 56 + 12x
    Trend values for each year:
    Year      Trend Value
    -----------------------
    1987        56 + 12(-2) = 32
    1988        56 + 12(-1) = 44
    1989        56 + 12(0)  = 56
    1990        56 + 12(1)  = 68
    1991        56 + 12(2)  = 80
            
  • Step 2:
    Calculating the quarterly trend:
    The yearly trend values are 32, 44, 56, 68, and 80, with a common difference of 12.
    The yearly increment is 12.
    The quarterly increment is 12 / 4 = 3.
    In the quarterly trend value table, the first year data is calculated as shown, and for subsequent years, we add the yearly increment (12).
    Quarterly trend value table
  • Step 3:
    Calculating quarterly values as a percentage of the trend value:
    Percentage = (O / T) * 100 where O is the observed value and T is the quarterly trend value calculated in step 2.
    Percentage calculation of quarterly values
  • Step 4:
    Calculating the seasonal indices:
    First, find the general average (GA): GA = sum of all quarterly averages / 4
    = (92.78 + 118.26 + 102.92 + 89.12) / 4
    = 403.08 / 4
    = 100.77
    Now, calculate the Seasonal Index = (Quarterly Average / General Average) * 100
    Seasonal index for 1st quarter = (92.78 / 100.77) * 100 = 92.1
    Seasonal index for 2nd quarter = (118.26 / 100.77) * 100 = 117.4
    Seasonal index for 3rd quarter = (102.92 / 100.77) * 100 = 102.1
    Seasonal index for 4th quarter = (89.12 / 100.77) * 100 = 88.4

Reference