Download as pdf or txt
Download as pdf or txt
You are on page 1of 84

Time Series

Syllabus
• Time Series Data
• Components of time series
• Additive and Multiplicative models.
• Trend analysis, fitting of trend using principle of least squares- linear
second-degree parabola
• Shifting of origin and Conversion of annual linear trend equation to
quarterly/monthly basis and vice-versa
Time Series Analysis
• Time Series analysis is one of the statistical methods used to determine
the patterns in data collected for a period of time.
• One can also identify the regular or irregular occurrence of any
specific feature over a time period in a time series data.
• Most of the time series data relates to fields like Economics, Business,
Commerce, etc
• For example Production of a product, Cost of a product, Sales of a
product, National income, Salary of an individual, etc..
• By close observation of time series data, one can predict and plan for
future operations in industries and other fields.
Time Series
• Time series is different from more traditional classification and regression
predictive modeling problems.
• A time series is a collection of data points gathered over a period of time
and ordered chronologically.
• If you were to plot the points of time series data on a graph, and one of
your axes would always be time.
• Time series metrics refer to a piece of data that is tracked at an increment
in time. For instance, a metric could refer to how much inventory was sold
in a store from one day to the next.
• Time series analysis involves inferring what has happened to a series of
data points in the past and attempting to predict future values.
• Analyzing time series data allows for extracting meaningful statistics and
other data characteristics
Examples of time series analysis

• Rainfall measurements
• Stock prices
• Annual retail sales
• Monthly subscribers
• Heartbeats per minute
• Annual production of a crop
Example
Example
Time series data can be classified into two
types:
• Measurements gathered at regular time intervals (metrics)
Such analysis requires identifying the pattern of an observed time
series data set. Once the pattern is established, it can be interpreted,
integrated with other data, and used for forecasting
• Measurements gathered at irregular time intervals (events)
Because they happen at irregular intervals, events are unpredictable
and cannot be modeled or forecasted since forecasting assumes that
whatever happened in the past is a good indicator of what will happen
in the future.
Components of Time Series

(i) Secular Trend


(ii) Seasonal variations
(iii) Cyclic variations
(iv) Irregular variations
Secular Trend
• It is a general tendency of time series to increase or decrease or
stagnates during a long period of time.
• An upward tendency is usually observed in population of a country,
production, sales, prices in industries, income of individuals etc.
• A downward tendency is observed in deaths, epidemics, prices of
electronic gadgets, water sources, mortality rate etc.
• It is not necessary that the increase or decrease should be in the
same direction throughout the given period of time.
Seasonal Variations
• In this movements are due to nature- which repeat themselves
periodically in every seasons.
• These variations repeat themselves in less than one year time.
• It is measured in an interval of time.
• Seasonal variations may be influenced by natural force, social
customs and traditions.
• These variations are the results of such factors which uniformly and
regularly rise and fall in the magnitude.
• For example, selling of umbrellas’ and raincoat in the rainy season,
sales of cold drinks in summer season, crackers in Deepawali season,
purchase of dresses in a festival season, sugarcane in Pongal season.
Cyclic Variations
• These variations are not necessarily uniformly periodic in nature.
• That is, they may or may not follow exactly similar patterns after
equal intervals of time.
• Generally one cyclic period ranges from 7 to 9 years and there is no
hard and fast rule in the fixation of years for a cyclic period.
• For example, every business cycle has a Start- Boom- Depression-
Recover.
Irregular Variations
• These variations do not have particular pattern and there is no
regular period of time of their occurrences.
• These are accidental changes which are purely random or
unpredictable.
• Normally they are short-term variations, but its occurrence
sometimes has its effect so intense that they may give rise to new
cyclic or other movements of variations.
• For example floods, wars, earthquakes, Tsunami, strikes, lockouts etc
Decomposition of Time Series
• Decomposition of Time Series means analyzing time series data by
segregating each value(Y) into the constituent 4 parts- T, C, S and I.
• The process of decomposition calls for measuring the components
one by one and eliminating each one before others are measured.
• The four components combine to form models that describe the
behavior of a time series.
• The analysis of time series data depends on the model we choose to
adopt.
• The two models are- Additive and Multiplicative
Mathematical Models for a Time Series
Additive Model
• This model assumes that the observed value is the sum of all the four
components of time series i.e
Y= T+S+C+I
where Y = Original value , T = Trend Value , S = Seasonal component
C = Cyclic component and I = Irregular component
• The additive model assumes that all the four components operate independently.
• It also assumes that the behavior of components is of an additive character.
Mathematical Models for a Time Series
Multiplicative Model
• This model assumes that the observed value is obtained by
multiplying the trend(T) by the rates of other three components.
Y=T×S×C×I
where Y = Original value , T = Trend Value , S = Seasonal component
C = Cyclic component and I = Irregular component
• This model assumes that the components due to different causes are
not necessarily independent and they can affect one another.
• It also assumes that the behavior of components is of a multiplicative
character.
Measurements of Trends

Following are the methods by which we can measure the trend.


(i) Freehand or Graphic Method.
(ii) Method of Semi-Averages.
(iii) Method of Moving Averages.
(iv) Method of Least Squares.
Freehand or Graphic Method.

It is the simplest and most flexible method for estimating a trend. Procedure:
(a) Plot the time series data on a graph.
(b) Draw a freehand smooth curve joining the plotted points.
(c) Examine the direction of the trend based on the plotted points.
(d) Draw a straight line which will pass through the maximum number of plotted
points.
Example 1
Example 1
Merits and Demerits
• Simple and doesn’t require any mathematical calculations.
• The trend drawn by the freehand method can be extended to predict
the future values of the given data.
• However, this method is subjective in nature, predictions obtained by
this method depends on the personal bias and judgement of the
investigator handling the data.
Method of Semi-Averages
• In this method, the semi-averages are calculated to find out the trend
values.
Procedure
(i) The data is divided into two equal parts. In case of odd number of data,
two equal parts can be made simply by omitting the middle year.
(ii) The average of each part is calculated, thus we get two points.
(iii) Each point is plotted at the mid-point (year) of each half.
(iv) Join the two points by a straight line.
(v) The straight line can be extended on either side.
(vi) This line is the trend line by the methods of semi-averages.
Example 2
Example 2
Example 3
Example 3
Merits and Demerits
• Its objective
• The future values can be predicted.
• Easy to understand and apply
• The trend values obtained by this method and the predicted values are not precise.
This is because it depends on mean which is affected by extreme values. If
extreme values are present in either half or both halves of the series, then the trend
line does not give the true picture of the growth factor.
Method of Moving Averages
• In this method, we take arithmetic mean of the values for a certain time
span.
• The time span can be three-years, four -years, five- years and so on
depending on the data set and our interest.
Procedure
(i) Decide the period of moving averages (three- years, four -years).
(ii) In case of odd years, averages can be obtained by calculating,

(iii) If the moving average is an odd number, there is no problem of centering


it, the average value will be centered besides the second year for every three
years.
Procedure (contd.)
(iv) In case of even years, averages can be obtained by calculating,

(v) If the moving average is an even number, the average of first four values
will be placed between 2 nd and 3rd year, similarly the average of the second four
values will be placed between 3rd and 4th year. These two averages will be again
averaged and placed in the 3rd year. This continues for rest of the values in the
problem. This process is called as centering of the averages.
Example 4
Example 4
Example 5
Example 5

The calculated 4-yearly centered moving


average belongs to the particular year
present in that row eg; 132.37 belongs to
the year 2003.
Example 6
For the following data, verify that five yearly weighted moving average
trend values with weights 1,2,2,2,1 respectively is equivalent to 4 yearly
centered moving average trend values:

Year 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
Sales(Rs 5 3 7 6 4 8 9 10 8 9 9
in lakhs)
Merits and Demerits
• Its objective.
• Moving Averages Method gives a trend with a fair degree of accuracy.
• Trend values can not be computed for all the years. Some trend values
have to sacrificed at the beginning and at the end.
• The selection of the period of the moving average is not objective.
Method of Least Squares
• The line of best fit is a line from which the sum of the deviations of various points
is zero.
• This is the best method for obtaining the trend values.
• It gives a convenient basis for calculating the line of best fit for the time series.
• It is a mathematical method for measuring trend.
• Further the sum of the squares of these deviations would be least when
compared with other fitting methods. So, this method is known as the Method of
Least Squares and satisfies the following conditions:
(i) The sum of the deviations of the actual values of Y and Ŷ (estimated value of
Y) is Zero. that is Σ(Y–Ŷ) = 0.
(ii)The sum of squares of the deviations of the actual values
of Y and Ŷ (estimated value of Y) is least, that is, Σ(Y–Ŷ)2 is least
Procedure
(i) The straight line trend is represented by the equation Yc = a + bX …(1)
where Yc are the trend values, X is time measured from origin or midpoint, a
and b are constants
(ii) The constants ‘a’ and ‘b’ are estimated by solving the following two normal
Equations ΣY = n a + b ΣX ...(2)
ΣXY = a ΣX + b ΣX2 ...(3)
Where ‘n’ = number of years given in the data.
(iii) By taking the mid-point of the time as the origin, we get ΣX = 0
(iv) When ΣX = 0 , the two normal equations reduces to

The constant ‘a’ gives the mean of Y and ‘b’ gives the rate of change (slope).
(v) By substituting the values of ‘a’ and ‘b’ in the trend equation (1), we get the Line
of Best Fit.
Example 6
Example 5
Example 6
Example 6
Example 7
• Below are the figures of production of a factory (in’000 tons) in sugar
factory:

Year 1999 2000 2001 2002 2003 2004 2005


Production 77 88 94 85 91 98 90

• Fit a straight line trend by the method of least squares and show the trend
values
• Show the trend on the graph
• What is monthly increase in production?
• Find out short period fluctuations for the given years using additive model
• Eliminate trend by using multiplicative model
Example 8/22
The linear trend of sales of a company is rs 650000 in 2014 and it rises
by 16500 per year
i. Write down the trend equation
ii. If the company knows that its sales in 2017 will be 10% below the
forecasted trend sales, find its expected sales in 2017
Merits
• Given the mathematical form of the trend to be fitted, the least squares method is
an objective method.
• Unlike the moving average method, it is possible to compute trend values for all
the periods and predict the value for a period lying outside the observed data.
• The results of the method of least squares are most satisfactory because the fitted
trend satisfies the two most important properties, i.e. (1) ෍ 𝑦0 − 𝑦𝑡 =0
And (2) ෍ 𝑦0 − 𝑦𝑡 2 is minimum
Here 𝑦0 denotes the observed values and 𝑦t denotes the calculated trend value.
Demerits
• It is cumbersome method.
• It is not flexible like the moving average method. If some observations
are added, then the entire calculations are to be done once again.
• Since the choice of a particular trend is arbitrary, the method is not,
strictly, objective. (care needs to be exercised to select the type of
trend curve)
FITTING OF PARABOLIC TREND
• Linear trend appropriate in cases where the variable changes by
almost equal amounts and therefore the movements are nearly in a
straight line.
• In case the changes in the variable vary at an approximately constant
rate, a curvilinear trend is appropriate. A quadratic trend equation is
used and its graph is called a second degree parabola.
FITTING OF PARABOLIC TREND

The mathematical form of a parabolic trend is given by:

Here a, b and c are constants to be determined from the given data.


Using the method of least squares, the normal equations for the
simultaneous solution of a, b and c are:
FITTING OF PARABOLIC TREND
• By selecting a suitable year of origin, i.e. define X = t – origin such that
∑X = 0, the computation work can be considerably simplified. Also
note that if ∑X = 0, then ෍ 𝑋 3 will also be equal to zero. Thus, the
above equations can be rewritten as:

• This are the three equations to find the value of constants a, b and c.
Example
Solution
Example
• Given the data
Year 2006 2007 2008 2009 2010 2011 2012
Sales in 21 21 30 29 62 68 91
lacs

• Fit a parabola of second degree taking 2009=0


• Obtain the trend values for 2006 through 2012
• Forecast the sales for 2014
Solution
a
X=Year-
Year Y 2009 X2 X3 X4 XY X2Y
2006 21 -3 9 -27 81 -63 189
2007 21 -2 4 -8 16 -42 84
2008 30 -1 1 -1 1 -30 30
314=7a+28c……1
2009 21 0 0 0 0 0 0 336=28b………….2
2010 62 1 1 1 1 62 62 1456=28a+196c……..3
2011 68 2 4 8 16 136 272
2012 91 3 9 27 81 273 819 b=336/28= 12
Solving 1 and 3
314 28 0 196 336 1456
c=2.38
a= 35.33
2 Trend values Yc=35.33+12X+2.38X2
b. Yc=35.33+12X+2.38X 20.75
20.85
25.71
35.33
49.71
c. 35.33+12(5)+2.38(5)2
68.85 =154.83 lakh rupees
92.75
Shifting of origin
Example
Example

Yc=25+2(X+3)=33+2X
Example
• Given the quarterly trend equation for sales(in Rs thousand) of a
commodity: Yc=65+3.6X
• Origin: First quarter of 2002, X unit=one quarter Y unit= average
quarterly sales.
• Shift the origin to 1st July 2002
Example
• Given the quarterly trend equation for sales(in Rs thousand) of a
commodity: Yc=65+3.6X
• Origin: First quarter of 2002, X unit=one quarter Y unit= average
quarterly sales. Shift the origin to 1st July 2002
• Solution
• Yc=65+3.6(X+1.5)
=70.4+3.6X
Origin: 1st July 2002, X=one quarter Y= average quarterly sales
Conversion of trend equations
• By conversion of a trend equation, we mean the change of trend
equation formulated on one type of time basis into a trend equation
on another type of time basis.
• Thus, if a trend equation of yearly period is transformed into a trend
equation of monthly or quarterly period, or vice versa, it will be called
conversion of a trend equation.
Methods of Conversion
The following methods are to be adopted for converting a given trend
equation into a required trend equation:
(i) To convert an annual trend equation into a monthly trend equation :
Divide a by 12, bX, by 12 x 12 (or 144), cX², by 12 × 12 × 12 (or 1728) and
so on.
(ii) To convert a monthly trend equation into an annual trend equation.
Multiply a by 12, bX by 12 × 12, cX² by 12x12× 12 (or 1728) and so on.
(iii) To convert an annual trend equation into a Quarterly trend equation :
Divide a by 4, bX by 4 × 4 (or 16), cX², by 4 × 4 x 4(or 64) and so on.
(iv) To convert a quarterly trend equation into an annual trend equation :
Multiply a by 4, bX by 4 × 4and cX², by 4 × 4 x 4 and so on.
Example

X unit: year Y unit: yearly sales


Example
The following equation has been derived for production of steel
Y=10.27+1.65X
Origin:2007, Time unit: 1 year, Y unit: Tonnes per year
Rewrite the equation by:
i. Shifting the origin to 2012
ii. Find the monthly trend equation
iii. Find the value of Y for July 2013 on the basis of (ii)
Example
The following equation has been derived for production of steel
Y=10.27+1.65X
Origin:2007, Time unit: 1 year, Y unit: Tonnes per year
Rewrite the equation by:
i. Shifting the origin to 2012 Y= 10.27 +1.65(X+5) =18.52+1.65X
Origin: 2012, X unit=1 month, Y unit =monthly sales
ii Find the monthly trend equation Y= 18.52/12 + 1.65X/144
Y=1.5433+0.0114X
Origin: 1 July 2012, X unit=1 month, Y unit =monthly sales

iii. Find the value of Y for July 2013 on the basis of (ii)
Y=1.5433+0.114(12.5)=1.6858
Example
Example
Example
• Given the following equation
• Yc=372+288X
• Origin:2006, X unit=1 year, Y unit =Annual sales
Convert the above equation
i. To monthly trend equation with January 2007 as origin and
estimate sales for March 2007
ii. To quarterly trend equation with first quarter, 2007 as origin and
estimate sales for third quarter of 2007
Example
• Given the following equation
• Yc=372+288X
• Origin:2006, X unit=1 year, Y unit =Annual sales
Convert the above equation
i. To monthly trend equation with January 2007 as origin and estimate
sales for March 2007
Yc=372/12+288X/144 (monthly trend equation)
Yc=31+2X
Origin: 1 July 2006, X unit=1 month, Y unit =monthly sales
Yc=31+2(X+6.5)=44+2X
Origin: 15 Jan 2007, X unit=1 month, Y unit =monthly sales
Sales for March 2007: 44+2(2)= 48
Example
• Given the following equation
• Yc=372+288X
• Origin:2006, X unit=1 year, Y unit =Annual sales
Convert the above equation
ii. To quarterly trend equation with first quarter, 2007 as origin and
estimate sales for third quarter of 2007
Yc=372/4+288X/16 =93+18X (Quarterly trend equation)
Origin:1st July 2006, X unit=1 quarter, Y unit =quarterly sales
Yc=93+18(X+2.5)=138+18X
Origin:First quarter 2007, X unit=1 quarter, Y unit =quarterly sales
Yc=138+18(2)= 174 (third quarter of 2007)
Example: Obtain monthly trend equation
Yc=372+288X
• Origin:2006, X unit=1 year, Y unit =Annual sales
• Origin:2006, X unit=1 year, Y unit= Average monthly sales
• Origin:2006, X unit=1/2 year, Y unit =Annual sales
• Origin:2006, X unit=1/2 year, Y unit= Average monthly sales
Example: Obtain monthly trend equation
Yc=372+288X
• Origin:2006, X unit=1 year, Y unit =Annual sales
• Origin:2006, X unit=1 year, Y unit= Average monthly sales
• Origin:2006, X unit=1/2 year, Y unit =Annual sales
• Origin:2006, X unit=1/2 year, Y unit= Average monthly sales
Example: Shift also to a month
Yc=372+288X
• Origin:2006, X unit=1 year, Y unit =Annual sales
• Yc=372/12+288X/144
• Origin: 1 July 2006, X unit=1 month, Y unit =monthly sales
• Origin:2006, X unit=1 year, Y unit= Average monthly sales
• Yc=372+288X/12
• Origin: 1 July 2006, X unit=1 month, Y unit =monthly sales
• Origin:2006, X unit=1/2 year, Y unit =Annual sales
• Yc=372/12+288X/6 x 12
• Origin: 1 July 2006, X unit=1 month, Y unit =monthly sales
• Origin:2006, X unit=1/2 year, Y unit= Average monthly sales
• Yc=372+288X/6
• Origin: 1 July 2006, X unit=1 month, Y unit =monthly sales
Example: Shift to a month
Yc=372+288X
• Origin:2006, X unit=1 year, Y unit =Annual sales
• Yc=372/12+288X/144 =31+2X
• Origin: 1 July 2006, X unit=1 month, Y unit =monthly sales
• Yc= 31+2(X+0.5)=32+2X
• Origin: 15 July 2006, X unit=1 month, Y unit =monthly sales
Example
• Given monthly trend equation
• Yc=130+1.8X
• Origin: 1/7/2002, X unit=1 month, Y unit=monthly sales
Convert into annual trend equation
Example
• Given monthly trend equation
• Yc=130+1.8X
• Origin: 1/7/2002, X unit=1 month, Y unit=monthly sales
Convert into annual trend equation

• Yc=130 x 12 + (1.8 x 144)X


• Origin: 1/7/2002, X unit=1year, Y unit=yearly sales
Example
• Given monthly trend equation
• Yc=130+1.8X
• Origin: January 2002, X unit=1 month, Y unit=monthly sales
Convert into annual trend equation
Example
• Given monthly trend equation
• Yc=130+1.8X
• Origin: January 2002, X unit=1 month, Y unit=monthly sales
Convert into annual trend equation
Step 1: Shift origin to from middle of month to middle of year(July 1,2002)
Yc=130+1.8(X+5.5)
Origin: 1 July 2002, X unit=1 month, Y unit=monthly sales
Step 2: Find annual trend equation
• Yc=130 x 12 + (1.8 x 144)X
• Origin: 1/7/2002, X unit=1year, Y unit=yearly sales
Example
• Given quarterly trend equation
• Yc=130+1.8X
• Origin: First quarter 2002, X unit= 1 quarter, Y unit=quarterly sales
Convert into annual trend equation
Example
• Given quarterly trend equation
• Yc=130+1.8X
• Origin: First quarter 2002, X unit= 1 quarter, Y unit=quarterly sales
Convert into annual trend equation
Step 1: Shift origin from mid quarter to mid year i.e 1 July 2002
Yc=130+1.8(X+1.5)
Origin: 1/7/2002, X unit=1 quarter, Y unit=quarterly sales
Step2: annual trend equation
• Yc=130 x 4 + (1.8 x 16)(X+1.5)
• Origin: 1/7/2002, X unit=1year, Y unit=yearly sales

You might also like