0% found this document useful (0 votes)
14 views77 pages

Time Forecast Project SAMPLE REPORT

The document outlines a time forecasting project focusing on shoe and soft drink sales, detailing various analytical and modeling approaches including exploratory data analysis, data preprocessing, and model building. It highlights trends, seasonality, and volatility in sales data, while assessing the performance of different forecasting models such as linear regression and moving averages. The findings suggest that simpler models struggle to capture the complexities of the data, indicating a need for more sophisticated forecasting techniques.

Uploaded by

Nandini Priya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views77 pages

Time Forecast Project SAMPLE REPORT

The document outlines a time forecasting project focusing on shoe and soft drink sales, detailing various analytical and modeling approaches including exploratory data analysis, data preprocessing, and model building. It highlights trends, seasonality, and volatility in sales data, while assessing the performance of different forecasting models such as linear regression and moving averages. The findings suggest that simpler models struggle to capture the complexities of the data, indicating a need for more sophisticated forecasting techniques.

Uploaded by

Nandini Priya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

TIME FORECASTING PROJECT

BUSINESS REPORT
NANDINI PRIYA M

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
Contents – Shoes Sales
Problem 1 : Exploratory Data Analysis……………………………………………………………………………………………..4
Problem 2 : Data Preprocessing……………………………………………………………………………………………………….10
Problem 3 : Model Building – Original Data……………………………………………………………………………………..12
Problem 4 : Check for Stationarity …………………………………………………………………………………………………..20
Problem 5 : Model Building – Stationary Data…….……………………………………………………………………………22
Problem 6 : Compare the performance of the models……………………………………………..……………..……….34
Problem 7 : Actionable Insights & Recommendations…………………………………………………………………………...38

Contents – Soft Drinks


Problem 1 : Exploratory Data Analysis……………………………………………………………………………………………..39
Problem 2 : Data Preprocessing……………………………………………………………………………………………………….44
Problem 3 : Model Building – Original Data……………………………………………………………………………………..46
Problem 4 : Check for Stationarity …………………………………………………………………………………………………..61
Problem 5 : Model Building – Stationary Data…….……………………………………………………………………………62
Problem 6 : Compare the performance of the models……………………………………………..……………..……….74
Problem 7 : Actionable Insights & Recommendations…………………………………………………………………………...75

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Problem 1
Define the problem and perform Exploratory Data Analysis- Read the data as an
appropriate time series data - Plot the data - Perform EDA - Perform Decomposition

Overall Trend: The graph suggests a positive overall trend in the number of soft drink sales over
the 175-year period. While there are fluctuations, the general direction is upward, indicating an
increasing popularity or consumption of soft drinks over time.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Seasonality: The graph exhibits strong seasonality. There are repeating patterns of peaks and
troughs at regular intervals. This suggests that soft drink sales are influenced by seasonal factors,
likely related to weather (e.g., higher sales during warmer months) or cultural events/holidays.
Cyclical Patterns: Beyond the seasonality, there might be longer-term cyclical patterns visible. For
example, there appear to be periods of faster growth followed by periods of slower growth or
plateaus. These cycles could be driven by economic conditions, changes in consumer preferences, or
other factors.
Volatility: The series shows a significant amount of volatility. The fluctuations are quite large,
indicating that predicting future sales with high precision might be challenging. This volatility could
be due to various factors like marketing campaigns, competitor actions, or unforeseen events.

Monthly Trends: The x-axis represents months (Jan to Nov), suggesting we're looking at monthly
sales data for each year.
Yearly Comparison: Each line represents a different year from 1980 to 1995. This allows us to
compare sales patterns across different years.
Overall Upward Trend: Most years show an overall upward trend from January to November. This
indicates a general increase in sales of the product over these months.
Seasonal Peak: There seems to be a noticeable peak in sales around September-November for
most years. This strongly suggests a seasonal effect, perhaps related to holiday shopping, a specific
event, or a change in weather.
Year-to-Year Variability: While there's a general upward trend and seasonal peak, there's
significant year-to-year variability. Some years show steeper increases, while others have more
moderate growth or even declines in certain months.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Monthly Sales Breakdown: The graph breaks down the sales data by month (Jan to Dec) for each
year from 1980 to 1995.
Yearly Trend: Each line represents the sales for a specific month across the years. This allows us to
see how sales for a particular month have changed over time.
General Upward Trend: Overall, there's a general upward trend in sales for most months over the
years. This suggests an increasing demand or popularity for the product over time.
Seasonal Fluctuations: While there's an upward trend, there are noticeable fluctuations within
each year (along each line). This indicates that sales are influenced by seasonal factors. However, it's
not a consistent pattern across all years, suggesting other factors are at play.
January as a Low Point: January generally appears to be a low point for sales across most years. This
could be due to post-holiday season slowdown or other factors.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Monthly Sales Distribution: Each boxplot represents the distribution of sales for a specific month
(Jan to Dec) across the years. This gives us a sense of the central tendency, spread, and potential
outliers for each month.
Median Trend: The green line inside each boxplot represents the median sales for that month. We
can observe a general upward trend in median sales as we move from January to December.
Interquartile Range (IQR): The box itself represents the IQR (the range between the 25th and 75th
percentiles). The IQR indicates the spread of the middle 50% of the data. We notice that the IQR
tends to increase as we move towards the later months of the year, suggesting higher variability in
sales during these months.
Whiskers: The whiskers extend to 1.5 times the IQR from the box. They show the range of typical
data points (excluding outliers).
Outliers: The circles outside the whiskers represent potential outliers. We see a few outliers,
particularly in the later months, indicating unusually high or low sales in those months for certain
years.
January as the Lowest: January consistently shows the lowest median sales and the narrowest
IQR, indicating lower and less variable sales in January.
December as the Highest: December exhibits the highest median sales and a wide IQR, suggesting
higher sales and greater variability in December.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Additive decomposition

Original Time Series (No_Softdrink_Sales):


 Shows a clear upward trend with noticeable seasonal patterns.
 Confirms our previous observations about the presence of both trend and seasonality.
Trend Component:
 Exhibits a gradual upward trend over the entire period.
 Shows a period of slower growth or a plateau in the middle of the time series (around
observations 50-75).
 Indicates an overall increase in soft drink sales over time, but not at a constant rate.
Seasonal Component:
 Displays a consistent and repeating pattern with peaks and troughs at regular intervals.
 The peaks and troughs are relatively uniform in magnitude, confirming the additive nature of
the seasonality.
 Suggests a strong yearly seasonality, likely related to weather or holiday patterns.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Residual Component:
 Shows random fluctuations around zero.
 The fluctuations are relatively small, indicating that the trend and seasonal components have
effectively captured most of the systematic variation in the data.

Multiplicative Decomposition

Original Time Series (No_Softdrink_Sales):


 Same as in the additive decomposition: Shows a clear upward trend with noticeable seasonal
patterns.
Trend Component:
 Same as in the additive decomposition: Exhibits a gradual upward trend over the entire
period, with a period of slower growth or a plateau in the middle.
Seasonal Component:
 Key Difference: In a multiplicative decomposition, the seasonal component is expressed as a
factor around 1.0.
 Here, we see the seasonal pattern oscillating around 1.0. Values above 1.0 indicate periods
where sales are higher than the trend, and values below 1.0 indicate periods where sales are
lower.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 The peaks and troughs are relatively consistent in their magnitude relative to 1.0, suggesting
a stable multiplicative seasonal pattern.
Residual Component:
 Key Difference: In a multiplicative decomposition, the residuals are also expressed as a factor
around 1.0.
 The residuals are scattered around 1.0, indicating that the trend and seasonal components
have captured most of the systematic variation.

Problem 2

Data Pre-processing- Missing value treatment - Visualize the processed data - Train-test split

There are no missing values

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
monthly soft drink sales from January 1980 to July 1995, split into training and test sets. The training data
covers 1980-1990, while the test data covers 1990-1995, allowing for evaluation of predictive models on
unseen data. There's a clear time-series nature to the sales, suggesting potential trends and seasonality.

The graph visually separates the soft drink sales data into training and test sets, highlighting a clear upward
trend and seasonal patterns across both periods. The test data (orange) shows a continuation of the patterns
observed in the training data (blue), indicating the potential for effective forecasting.

Training Time instance

Training Time instance


[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130]
Test Time instance
[256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312]

The training time instances represent a contiguous sequence from 1 to 130, implying a time-series dataset
where each instance likely corresponds to a sequential time point. The test time instances, however, start
much later (256) and also form a contiguous sequence, indicating a gap between the training and testing
periods, which is crucial for evaluating a model's ability to forecast beyond the known data.

Problem 3

Model Building - Original Data- Build forecasting models - Linear regression - Simple Average -
Moving Average - Exponential Models (Single, Double, Triple) - Check the performance of the models
built
Logistic Regression

The graph shows a linear regression model fitted to the test data, attempting to predict the soft drink
sales trend. While the regression line captures a slight upward trend in the test data, it doesn't
accurately reflect the significant seasonal fluctuations seen in both the training and test sets. This
suggests that a simple linear regression may not be the most appropriate model for forecasting this
time series.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
The provided information indicates a Root Mean Squared Error (RMSE) of 814781.662584 for a
"RegressionOnTime" model on the test data. This extremely high RMSE suggests that the model's
predictions are significantly inaccurate and far from the actual values. 1 It's likely the model is not a
good fit for the data and is failing to capture the underlying patterns or trends.

Naïve Forecast

The graph shows a "Naive Forecast" applied to the test data, where the forecast is a flat line using
the last observed value from the training set. This forecast fails to capture the seasonal fluctuations
and upward trend present in the test data, indicating that it's a poor fit for this time series. The Naive
Forecast's simplicity leads to significant underestimation of the true values.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
The Naive Model has a Root Mean Squared Error (RMSE) of 679797.438596 on the test data. This
extremely high RMSE indicates that the Naive Model's predictions are significantly inaccurate and far
from the actual values. It confirms that the model is not a good fit for this time series, as expected
given its simplicity and inability to capture trends or seasonality.
Simple Average forecast

The graph shows a Simple Average Forecast applied to the test data. The forecast is a horizontal line
representing the average of the training data. This forecast fails to capture both the upward trend
and the strong seasonality present in the test data. It consistently underestimates the actual values,
indicating that a simple average is not an appropriate model for this time series. The forecast's
flatness suggests it's ignoring the crucial temporal patterns, leading to poor predictive performance.

Both models exhibit extremely high RMSE values, indicating very poor predictive performance. The
Simple Average Model has a significantly higher RMSE than the Naive Model, suggesting that, for this
dataset, simply using the last observed value (Naive Model) is slightly better than using the average
of the training data. However, neither model is adequate for accurate forecasting. They both fail to
capture the underlying patterns in the time series

Moving Average

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Smoothing Effect: As the window size increases, the moving average lines become smoother,
effectively reducing the noise and short-term fluctuations in the data.
Lagging Trend: All moving averages lag behind the original data, meaning they reflect past trends
rather than predicting future ones. The larger the window size, the greater the lag.
Trend Capture: The moving averages, especially those with larger window sizes, capture the
overall upward trend in the data.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Smoothing and Lagging: The moving averages smooth out the fluctuations in the test data, but
they lag behind the actual values, especially with larger window sizes. This means they are reflecting
past trends rather than predicting future ones.
Seasonality Dampening: The moving averages effectively dampen the strong seasonal patterns
observed in the test data, with larger window sizes resulting in smoother, less volatile lines.
Trend Capture: While the moving averages capture the general upward trend in the test data, they
fail to accurately predict the peaks and troughs of the seasonal fluctuations

Naive and Simple Average Models Perform Poorly: Both the Naive Model and the Simple Average
Model have very high RMSE values, indicating significant inaccuracies in their predictions.
Trailing Moving Averages Improve Performance: The trailing moving average models, especially
the 2-point moving average, show a substantial improvement in RMSE compared to the naive and
simple average models.
Smaller Window Size is Better: The 2-point trailing moving average has the lowest RMSE among all
the models, suggesting that a smaller window size captures the patterns in the data more effectively.
As the window size increases (4, 6, 9 points), the RMSE also increases, indicating a decrease in
accuracy.
Moving Averages Still Have Limitations: While the moving averages perform better than the naive
and simple average, their RMSE values are still relatively high, suggesting that they might not be
capturing all the complexities of the time series, such as strong seasonality and potential trends.

Model Comparison

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Poor Performance of Simple Models: The naive forecast and simple average models (flat lines) fail
to capture the upward trend and seasonality in the test data, indicating their inadequacy for this time
series.
Linear Regression's Limited Success: The linear regression model shows a slight upward trend but
doesn't accurately represent the seasonal fluctuations, suggesting it's not a strong fit.
2-Point Moving Average's Closer Fit: The 2-point trailing moving average appears to follow the
test data more closely than the other simple models, capturing some of the seasonality and trend.
Need for More Sophisticated Models: Despite the 2-point moving average's relatively better fit, all
models struggle to precisely predict the peaks and troughs, implying the need for more complex
models that can handle seasonality and trends more effectively.

Simple exponential smoothening

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Flat Forecast: The SES model with alpha = 0.99 produces a nearly flat forecast line on the test data.
This indicates that the model is essentially using the last observed value from the training set as the
forecast for all subsequent points in the test set.
Neglect of Seasonality and Trend: The flat forecast line fails to capture the strong seasonal
fluctuations and the upward trend observed in the test data.
High Alpha, High Reliance on Recent Data: An alpha value of 0.99 gives very high weight to the
most recent observation and very little weight to past observations. This explains why the forecast is
essentially a horizontal line at the level of the last training data point.
Poor Fit: The SES model with alpha = 0.99 is a poor fit for this time series, as it doesn't account for
the underlying patterns. It is essentially acting like a Naive Forecast.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Simple Exponential Smoothing (SES) with Alpha = 0.99 (Green): As we saw before, this produces a
flat forecast line, essentially using the last observed training value. It fails to capture the trend and
seasonality of the test data.
Double Exponential Smoothing (DES) with Alpha = 0.099, Beta = 0.0001 (Red): This model, while
still not perfect, does a better job of capturing the upward trend in the test data. However, it still
largely misses the strong seasonal fluctuations.
Parameter Impact: The low alpha (0.099) in DES means it gives more weight to past observations,
and the very low beta (0.0001) suggests it's not adjusting the trend component much.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
DES Improvement: DES, by accounting for trend, provides a better fit than SES for this data, which
exhibits an upward trend.

DES Performs Better: The Double Exponential Smoothing (DES) model, with an RMSE of
614456.734894, performs significantly better than the Simple Exponential Smoothing (SES) model,
which has an RMSE of 797167.792.
DES Captures Trend: The lower RMSE of DES suggests that it is better at capturing the trend
component in the data compared to SES. DES accounts for trend and level, while SES only accounts
for level.
Both Models Still Show High Error: While DES is an improvement over SES, both models still have
relatively high RMSE values. This suggests that neither model is ideal for forecasting this time series,
and more complex models that handle seasonality might be necessary.

Problem 4

Check for Stationarity- Check for stationarity - Make the data stationary (if needed)

Non-Stationary: A p-value of 0.9952 is much greater than the common significance level of 0.05..
This means we conclude that the time series is non-stationary.

Performing differencing ( d=1 ) as the data is non-stationary

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Differenced Data: The graph shows the time series data after performing first-order differencing
(d=1). This means that each data point represents the difference between consecutive values in the
original time series.
Stationarity Suggestion: The differenced data appears to be more stationary than the original
data. It fluctuates around zero with no apparent trend or seasonality.
Reduced Trend and Seasonality: The differencing process has effectively removed the upward
trend and the seasonal patterns that were present in the original data.

log transformation of the data.

Exponential Growth: The fact that the upward trend remains after the log transformation suggests
that the original soft drink sales data likely exhibited exponential growth.
Multiplicative Seasonality: The persistence of seasonality in the logged data indicates that the
seasonality is multiplicative.
Trend Remains: The graph still shows an upward trend in the logged data, indicating that the original
data had an exponential growth pattern.
Seasonality Remains: The seasonal fluctuations are still visible in the logged data, suggesting that
the seasonality is multiplicative (i.e., the magnitude of the seasonal fluctuations increases with the
level of the series).

Performing differencing (d=1) on the log transformed time series

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Stationarity: The differenced log-transformed series appears to be stationary. It fluctuates around
zero with no apparent trend or seasonality.
Removal of Trend: The differencing has successfully removed the upward trend observed in the
log-transformed data.
Removal of Seasonality (Mostly): While some minor fluctuations might still suggest weak
seasonality, the differencing has significantly reduced the strong seasonal patterns seen in the
original data.
.

Problem 5

Model Building - Stationary Data- Generate ACF & PACF Plot and find the AR, MA values. - Build
different ARIMA models - Auto ARIMA - Manual ARIMA - Build different SARIMA models - Auto
SARIMA - Manual SARIMA - Check the performance of the models built

Auto Regressive(AR) Models

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
AR(1) Dominance: The model suggests that the first autoregressive term (AR(1)) is the most
influential factor in predicting the log of soft drink sales.
AR(2) Not Significant: The second autoregressive term (AR(2)) does not contribute significantly to
the model.
Model Simplification: The model might be simplified by removing the AR(2) term, as it's
statistically insignificant. An AR(1) model might be more appropriate.
Good Fit (Relative): The AIC, BIC, and HQIC values suggest a reasonable fit, but further model
comparisons with other ARIMA/SARIMA models are needed to determine the best model.
Calculating RMSE for best AR model

The Root Mean Squared Error of our forecasts is 999.193


The AR(2) model (which simplifies to AR(1)) provides a reasonable fit based on information criteria
but has a high RMSE, suggesting significant prediction errors. This indicates that the model is not
accurately capturing the underlying patterns in the time series, despite the statistical significance of
the AR(1) term

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Data Split: The graph clearly shows the split between the "Train Sales" (blue) and "Test Sales"
(orange) data. This indicates a time series forecasting context where the model is trained on the blue
data and evaluated on the orange data.
Strong Seasonality: Both the train and test data exhibit strong seasonal patterns, characterized by
regular peaks and troughs.
Upward Trend: There's a general upward trend in the data over time, suggesting increasing sales.
Forecasted Sales (Green): The "Forecasted Sales" (green) line represents the model's predictions
for the test data period.
Poor Forecast Performance: The forecasted sales (green) line is essentially flat and fails to capture
both the seasonality and the upward trend observed in the actual test data (orange).

AR(2) Model Selected: The selection of an ARIMA(2, 0, 0) model suggests that the autoregressive
components (AR terms) are the most significant in modeling the time series. The lack of differencing
(I(0)) implies the series was likely stationary or made stationary through prior transformations (e.g.,
log transformation).
High RMSE: The RMSE of 999.19256 is relatively high, indicating that the model's predictions have
a significant average error. This suggests the model, while considered the "best" among the tested
ARIMA models, is not highly accurate.

ARMA Model building to estimate best 'p' , 'q' ( Lowest AIC Approach )

ARIMA(1, 0, 1) - AIC:-350.8225798335556

The ARIMA(1, 0, 1) model, with an AIC of -350.82, suggests a potential improvement over the
ARIMA(2, 0, 0) model (based on the lower AIC). This indicates that a model with one autoregressive
(AR) term and one moving average (MA) term might better balance model fit and complexity for this
time series data.

Building ARMA model with best p,q parameter

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Complex Model: The model is relatively complex, with 3 AR terms and 3 MA terms.
Significant AR Terms: All AR terms are highly significant, suggesting a strong autoregressive
relationship in the data.
Significant MA Terms (Mostly): The first two MA terms are significant, while the third is only
marginally significant.
Good Fit (Relative): The AIC, BIC, and HQIC values are relatively low, suggesting a good fit
compared to simpler models.

Calculating RMSE for best MA model


The Root Mean Squared Error of our forecasts is 796.42
ARIMA(3, 0, 3) model, while showing a good fit based on information criteria and statistically
significant AR and MA terms, has an RMSE of 796.42. This suggests that the model's predictions have
a moderate average error

 Data Split: The graph shows the training data (blue), test data (orange), and the forecasted
sales (green).
 Strong Seasonality: Both the training and test data exhibit strong seasonal patterns with
regular peaks and troughs.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Upward Trend: There's a general upward trend visible in the data over the years.
 Forecasted Sales (Green): The forecasted sales (green) attempts to follow the pattern in the
test data but shows some deviations.
 Better Fit Than Previous Models: Compared to the flat forecasts we saw earlier, this forecast
(green) appears to capture the seasonality and trend to a greater extent.
Inference:
 Improved Model: The forecasting model used here is better than the simple models (naive,
average) and exponential smoothing models we saw previously. It seems to be capturing the
seasonal patterns and the upward trend more effectively.

RMSE Value: The RMSE of 100.968926 indicates the average magnitude of the errors between the
forecasted values and the actual values in the test set.
Model Fit: The RMSE suggests that the ARIMA(3, 0, 3) model is providing forecasts that are, on
average, about 100.97 units away from the actual values.

ARIMA Model building to estimate best 'p' , 'd' , 'q' paramters ( Lowest AIC Approach )
ARIMA(1, 0, 1) - AIC:-350.8225798335556

Low AIC: The AIC value of -350.8225798335556 is relatively low. AIC is a measure of model fit that
penalizes model complexity. A lower AIC generally indicates a better balance between model fit and
complexity.
Potential for Good Fit: The low AIC suggests that the ARIMA(1, 0, 1) model might be a good fit for
the data compared to other models with higher AIC values

Building ARIMA model with best parameters p,d,q

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Complex Model: The model is relatively complex, with 3 AR terms and 3 MA terms.
Significant AR Terms: All AR terms are highly significant, suggesting a strong autoregressive
relationship in the data.
Significant MA Terms (Mostly): The first two MA terms are significant, while the third is only
marginally significant.
Good Fit (Relative): The AIC, BIC, and HQIC values are relatively low, suggesting a good fit
compared to simpler models.

Calculating RMSE for best ARIMA model


The Root Mean Squared Error of our forecasts is 796.42

 Data Split: The graph shows the training data (blue), test data (orange), and the forecasted
sales (green).
 Strong Seasonality: Both the training and test data exhibit strong seasonal patterns with
regular peaks and troughs.
 Upward Trend: There's a general upward trend visible in the data over the years.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Forecasted Sales (Green): The forecasted sales (green) attempts to follow the pattern in the
test data but shows some deviations.
 Better Fit Than Previous Models: Compared to the flat forecasts we saw earlier, this forecast
(green) appears to capture the seasonality and trend to a greater extent.
Inference:
 Improved Model: The forecasting model used here is better than the simple models (naive,
average) and exponential smoothing models we saw previously. It seems to be capturing the
seasonal patterns and the upward trend more effectively.

ARIMA(2, 0, 0) - High RMSE: The ARIMA(2, 0, 0) model, which is essentially an AR(2) model (only
autoregressive terms), has the highest RMSE of 999.19256.
ARIMA(3, 0, 3) - Lower RMSE: Both the "Best ARMA Model" (ARIMA(3, 0, 3)) and the "Best ARIMA
Model" (also ARIMA(3, 0, 3)) have a significantly lower RMSE of 796.420052.
ARIMA(3, 0, 3) Selected: The ARIMA(3, 0, 3) model, which includes both autoregressive (AR) and
moving average (MA) terms, is selected as the best model, both for ARMA and general ARIMA.
Inference:
ARMA(3, 0, 3) Superior: The ARIMA(3, 0, 3) model demonstrates better forecasting accuracy
than the ARIMA(2, 0, 0) model, as evidenced by its lower RMSE

SARIMA MODEL

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Autocorrelation: Autocorrelation measures the correlation of a time series with its own past
values (lags).
 Significant Lags: Significant autocorrelation at specific lags indicates that those past values
are useful in predicting the current value.
 Plot Interpretation: The plot shows the autocorrelation values at different lags (x-axis) and
the corresponding correlation coefficients (y-axis). The shaded blue area represents the
confidence interval.
Inference from the Plot:
1. Significant Lags: There are two significant lags (lags that exceed the confidence interval):
o Lag 1: Shows a strong positive autocorrelation.
o Lag 12: Shows a moderate positive autocorrelation.
2. Lag 1 Significance: The strong positive autocorrelation at lag 1 suggests that the current
value is highly correlated with the value from the previous time period. This is common in
time series data.
3. Lag 12 Significance: The significant autocorrelation at lag 12 points towards potential
seasonality with a period of 12. This could represent yearly seasonality in monthly data or
weekly seasonality in daily data.

SARIMA(1, 0, 1)x(1, 0, 1, 12) - AIC:-541.771509610299


Seasonal Components: The (1, 0, 1, 12) part of the model confirms the presence of seasonality
with a period of 12, as suggested by the autocorrelation plot we discussed earlier. The model
includes both seasonal AR and MA terms.
Improved Fit: The AIC of -541.77 is significantly lower than the AIC values we saw for simpler
ARIMA models (e.g., ARIMA(1, 0, 1) or ARIMA(3, 0, 3)). This strongly suggests that the SARIMA model
provides a much better fit to the data.

Building SARIMA model with the best parameters

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Strong Persistence: The coefficients for ar.L1 and ar.S.L12 are very close to 1, suggesting strong
persistence in both the non-seasonal and seasonal components. This indicates that past values have
a strong influence on the current value.
Significant AR and MA Terms: All AR and MA terms (both seasonal and non-seasonal) are highly
statistically significant, indicating that they are important for modeling the time series.
Good Fit: The AIC, BIC, and HQIC values are very low, suggesting a good fit to the data. This is a
significant improvement over simpler ARIMA models.
Seasonality Captured: The model effectively captures the seasonal patterns in the data, as
evidenced by the significant seasonal AR and MA terms and the low AIC.

The Root Mean Squared Error of our forecasts is 432.39

 Data Split: The graph shows the training data (blue), test data (orange), and the forecasted
sales (green).
 Strong Seasonality: Both the training and test data exhibit strong seasonal patterns with
regular peaks and troughs.
 Upward Trend: There's a general upward trend visible in the data over the years.
 Forecasted Sales (Green): The forecasted sales (green) attempts to follow the pattern in the
test data but shows some deviations.
 Better Fit Than Previous Models: Compared to the flat forecasts we saw earlier, this forecast
(green) appears to capture the seasonality and trend to a greater extent.
Inference:
 Improved Model: The forecasting model used here is better than the simple models (naive,
average) and exponential smoothing models we saw previously. It seems to be capturing the
seasonal patterns and the upward trend more effectively.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 ARIMA(2, 0, 0) - Highest RMSE: The ARIMA(2, 0, 0) model, essentially an AR(2) model (only
autoregressive terms), has the highest RMSE of 999.192560.
 ARIMA(3, 0, 3) - Moderate RMSE: Both the "Best ARMA Model" (ARIMA(3, 0, 3)) and the
"Best ARIMA Model" (also ARIMA(3, 0, 3)) have a significantly lower RMSE of 796.420052
compared to ARIMA(2, 0, 0).
 SARIMAX(1, 0, 1)x(1, 0, 1, 12) - Lowest RMSE: The SARIMAX(1, 0, 1)x(1, 0, 1, 12) model has
the lowest RMSE of 432.389655, indicating the best performance among the models
considered.
Inference:
 SARIMA Best Model: The SARIMAX(1, 0, 1)x(1, 0, 1, 12) model, which incorporates seasonal
components, provides the most accurate forecasts with the lowest RMSE.
 Seasonality Importance: The significant improvement in RMSE with the SARIMA model
highlights the importance of accounting for seasonality in this time series.
 ARIMA(3, 0, 3) Improvement: The ARIMA(3, 0, 3) model, with both AR and MA terms,
performs better than the AR(2) model, indicating that moving average components are
helpful.
 AR(2) Poor Performance: The high RMSE of the AR(2) model suggests that it fails to capture
the underlying patterns in the data.
 Model Selection: The table provides a clear comparison of model performance based on
RMSE, guiding the selection of the SARIMAX(1, 0, 1)x(1, 0, 1, 12) model for forecasting.

In summary, the SARIMAX(1, 0, 1)x(1, 0, 1, 12) model, which incorporates seasonal components, is
the most accurate model based on RMSE, demonstrating the importance of accounting for
seasonality in this time series. The ARIMA(3, 0, 3) model also performs better than the AR(2) model,
indicating the usefulness of moving average terms

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Gap in Data: There's a significant gap in the data between 1995 and 2014, where no observed data
is shown.
Forecast Accuracy: The forecast (orange) closely follows the trend and fluctuations of the
observed data (blue) during the forecast period.
Confidence Interval (Grey Area): The grey shaded area around the forecast represents the
confidence interval, indicating the uncertainty associated with the forecast.

. Standardized Residuals Over Time (Top Left):


Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Random Fluctuations: The residuals seem to fluctuate randomly around zero, suggesting
that the model has captured most of the systematic patterns in the data.
 No Obvious Patterns: There are no clear trends or seasonality visible in the residuals,
indicating that the model is not missing any significant information.
 Potential Outliers: There might be a few potential outliers (values far from zero), which
could be investigated further.
2. Histogram and Density Plots (Top Right):
 Near-Normal Distribution: The histogram of the residuals closely resembles a normal
distribution, as indicated by the fitted normal curve (N(0, 1) in green) and the kernel density
estimate (KDE in orange).
 Slight Skewness: There might be a slight positive skew in the distribution, but it's not very
pronounced.
3. Normal Q-Q Plot (Bottom Left):
 Points Close to Line: Most of the points fall close to the red line, indicating that the residuals
are approximately normally distributed.
 Minor Deviations: There are some minor deviations from the line at the tails, suggesting
slight departures from perfect normality.
4. Correlogram (Bottom Right):
 No Significant Autocorrelation: All autocorrelation values fall within the blue shaded area
(confidence interval), indicating that there is no significant autocorrelation in the residuals.
 Randomness Confirmed: This suggests that the residuals are random and uncorrelated,
which is a desirable property for a good model.
Overall Inference:
 Good Model Fit: The diagnostic plots suggest that the model fits the data well. The residuals
are approximately normally distributed, randomly scattered around zero, and exhibit no
significant autocorrelation.
 Model Adequacy: The absence of patterns in the residuals indicates that the model has
captured most of the relevant information in the data.
 Potential Outliers: The potential outliers in the standardized residuals plot warrant further
investigation to understand their impact on the model.

Problem 6

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Compare the performance of the models- Compare the performance of all the models built - Choose the best
model with proper rationale - Rebuild the best model using the entire data - Make a forecast for the next 12
months

Models Compared:
1. Regression on Time: (Linear Regression) - Very high RMSE, poor fit.
2. Naive Model: (Last observed value) - High RMSE, poor fit.
3. Simple Average Model: (Mean of training data) - Very high RMSE, poor fit.
4. Trailing Moving Average (Various Window Sizes): Improved over naive and simple average,
but still high RMSE and doesn't capture seasonality.
5. Simple Exponential Smoothing (SES): High RMSE, flat forecast, doesn't capture trend or
seasonality.
6. Double Exponential Smoothing (DES): Improved over SES by capturing trend, but still high
RMSE and doesn't capture seasonality.
7. ARIMA(2, 0, 0): (AR(2) Model) - High RMSE, doesn't capture seasonality.
8. ARIMA(3, 0, 3): (ARMA Model) - Lower RMSE than AR(2), but still moderate and potential
overfitting.
9. SARIMA(1, 0, 1)x(1, 0, 1, 12): (Seasonal ARIMA) - Lowest RMSE, captures both trend and
seasonality.
Performance Comparison:
 RMSE: The Root Mean Squared Error (RMSE) is a key metric for evaluating model
performance. Lower RMSE indicates better accuracy.
o Worst: Naive, Simple Average, Regression on Time (very high RMSE).
o Poor: SES, DES, ARIMA(2, 0, 0) (high RMSE).
o Moderate: ARIMA(3, 0, 3) (moderate RMSE).
o Best: SARIMA(1, 0, 1)x(1, 0, 1, 12) (lowest RMSE).
 AIC/BIC: Akaike Information Criterion (AIC) and Bayesian Information Criterion (BIC) are used
to compare model fit while penalizing complexity. Lower values are better.
o Best: SARIMA(1, 0, 1)x(1, 0, 1, 12) (lowest AIC, BIC).
o Better: ARIMA(3, 0, 3) (lower AIC, BIC than ARIMA(2, 0, 0)).
 Visual Fit: Comparing the forecasted values to the actual test data visually:
o Worst: Naive, Simple Average, SES (flat forecasts).
o Poor: Regression on Time, DES (miss seasonality).
o Moderate: ARIMA(3, 0, 3) (follows trend, some seasonality).
o Best: SARIMA(1, 0, 1)x(1, 0, 1, 12) (captures seasonality and trend).
 Residual Analysis: Residual diagnostics for the SARIMA(1, 0, 1)x(1, 0, 1, 12) model showed:
o Random residuals.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
o Near-normal distribution.
o No significant autocorrelation.
Best Model and Rationale:
The SARIMA(1, 0, 1)x(1, 0, 1, 12) model is the best model based on the following rationale:
 Lowest RMSE: It has the lowest RMSE among all the models, indicating the highest accuracy
in forecasting the soft drink sales.
 Lowest AIC/BIC: It has the lowest AIC and BIC values, suggesting the best balance between
model fit and complexity.
 Captures Seasonality and Trend: It effectively captures the strong seasonal patterns and the
upward trend in the time series, which other models failed to do.
 Good Residual Diagnostics: The residual diagnostics confirm the model's adequacy, showing
random, normally distributed, and uncorrelated residuals.
 Statistical Significance: All terms in the model are statistically significant, indicating their
importance in modeling the data.
Conclusion:
The SARIMA(1, 0, 1)x(1, 0, 1, 12) model is the most suitable model for forecasting soft drink sales due
to its high accuracy, good fit, and ability to capture the underlying patterns in the data. Its low RMSE,
low information criteria, and good residual diagnostics make it the most reliable choice for predicting
future sales.

 Observed Data (Blue): The blue line represents the actual observed sales data for soft
drinks over time.
 Forecast Data (Orange): The orange line represents the forecasted sales data for the next 12
months (as indicated by the title).
 Time Range: The graph covers the time period from approximately 1980 to 1996.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Forecast Period: The forecast (orange) covers the last 12 months of the data, likely
representing the test or validation period.
 Seasonal Pattern: Both the observed and forecasted data show a clear seasonal pattern with
regular peaks and troughs.
 Forecast Accuracy: The forecast (orange) closely follows the seasonal pattern of the
observed data (blue) during the forecast period.
 Confidence Interval (Grey Area): The grey shaded area around the forecast represents the
confidence interval, indicating the uncertainty associated with the forecast.
Inference:
1. Successful Forecasting: The forecast (orange) successfully captures the seasonal pattern in
the soft drink sales data during the forecast period. This indicates that the model used for
forecasting is effective in predicting future sales.
2. Model Validation: The close match between the forecasted and observed data during the
forecast period validates the model's performance and its ability to generalize to unseen
data.
Problem 7

Actionable Insights & Recommendations- Conclude with the key takeaways (actionable insights and
recommendations) for the business

Key Takeaways (Actionable Insights):


1. Strong Seasonality is Key: The sales of soft drinks exhibit a strong seasonal pattern.
Understanding and leveraging this seasonality is critical for accurate forecasting and effective
business planning.
2. SARIMA Model is Superior: The SARIMA(1, 0, 1)x(1, 0, 1, 12) model provides the most
accurate forecasts due to its ability to capture both the trend and the seasonal patterns.
3. Accurate Forecasting Possible: With the right model, accurate forecasts of soft drink sales
are achievable, allowing for better inventory management, resource allocation, and
promotional planning.
4. Confidence in Short-Term Forecasts: The model provides reasonably precise forecasts for
the next 12 months, as evidenced by the narrow confidence interval.
5. Potential for Long-Term Forecasting: The model has shown good performance, but
uncertainty increases with longer-term forecasts.
6. Recommendations for the Business:
7. Implement SARIMA(1, 0, 1)x(1, 0, 1, 12) for Forecasting: Adopt the SARIMA(1, 0, 1)x(1, 0, 1,
12) model for forecasting soft drink sales. This will provide the most accurate predictions and
enable better decision-making.
8. Optimize Inventory Management: Use the accurate forecasts to optimize inventory levels,
minimizing stockouts during peak seasons and reducing holding costs during off-seasons.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
9. Plan Targeted Promotions: Leverage the understanding of seasonal patterns to plan targeted
promotions and marketing campaigns during peak sales periods.
10. Resource Allocation: Allocate resources (staffing, production, logistics) based on the
forecasted demand, ensuring efficient operations and maximizing sales.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
TIME FORECASTING OF SOFT DRINKS
Problem 1
Define the problem and perform Exploratory Data Analysis- Read the data as an
appropriate time series data - Plot the data - Perform EDA - Perform Decomposition

Non-Stationarity: The series exhibits a clear non-stationary pattern. There's an apparent upward
trend from 1980 to around 1988, followed by a potential level shift and then a more stable (but still
fluctuating) pattern. This non-stationarity suggests that standard time series models like ARIMA
might need differencing to achieve stationarity.
Level Shift/Structural Break: Around 1986-1988, there's a significant jump in the "No_Shoe_Sales."
This indicates a potential structural break or level shift.
Volatility: The series shows varying degrees of volatility. The period from 1986-1990 exhibits higher
volatility compared to the periods before and after.
Potential Seasonality? While not immediately obvious, there might be some underlying seasonality
in the data.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Monthly Data: The plot shows monthly data over several years (1980-1995), making it a time series
visualization.
Fluctuations: There are significant fluctuations in "No_Shoe_Sales" across months within each year
and across the years themselves.
Potential Seasonality: There appears to be a repeating pattern across years, suggesting potential
seasonality. We'll examine this more closely.
Variability Across Years: The overall level of sales varies considerably from year to year, indicating
non-stationarity.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Monthly Shoe Sales Over Years: The plot displays monthly shoe sales data from 1980 to 1994, with
each month represented by a separate line.
Significant Fluctuation: The sales data shows substantial fluctuations over time, both within each
year (across months) and between years.
Potential Seasonality: While not as immediately clear as in the previous plot (where months were on
the x-axis), we can still look for recurring patterns across years to infer potential seasonality.
Upward Trend and Level Shift: There appears to be an upward trend in sales, particularly from
around 1986 to 1988, followed by a plateau or slight decline. This suggests a potential level shift or
structural break.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Monthly Shoe Sales Distribution: The plot shows the distribution of shoe sales for each month using
boxplots. This allows us to compare the central tendency, spread, and potential outliers across
different months.
Potential Seasonality: The boxplots suggest a potential seasonal pattern, particularly with higher
sales in the later months of the year (November and December).
Variability: There's variability in sales across different months, both in terms of the median and the
spread of the data.

Additive decomposition

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Trend Component (Second Plot):
 Upward Trend: The trend component shows an upward trend, particularly from around 1980
to 1988. This indicates a general increase in shoe sales over this period.
 Level Shift: There's a sharp jump or level shift in the trend around 1986-1988. This suggests a
significant change in the underlying sales pattern during this time.
 Plateau/Decline: After the peak around 1988, the trend component plateaus or shows a
slight decline, indicating a change in the growth pattern.
Seasonal Component (Third Plot):
 Strong Seasonality: The seasonal component shows a clear and consistent cyclical pattern.
This indicates that there are regular seasonal fluctuations in shoe sales.
 Peak and Trough: The peaks and troughs in the seasonal component suggest a consistent
pattern of high and low sales at specific times of the year. This pattern needs further
investigation to identify the specific months or periods with the highest and lowest sales.
Residual Component (Fourth Plot):
 Random Fluctuations: The residual component shows random fluctuations around zero. This
indicates that the trend and seasonal components have captured most of the systematic
patterns in the data, leaving behind only random noise.
 No Obvious Pattern: There doesn't appear to be any obvious pattern in the residuals,
suggesting that the model has adequately captured the underlying structure of the data.
Multiplicative Decomposition

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Trend Component (Second Plot):
 Upward Trend (Multiplicative): The trend component shows an upward trend, indicating a
multiplicative increase in sales over time. This means sales are growing by a percentage
rather than a fixed amount.
 Level Shift (Multiplicative): The sharp jump or level shift around 1986-1988 suggests a
significant proportional change in the sales pattern.
 Plateau/Decline (Multiplicative): The plateau or slight decline after 1988 indicates a change in
the rate of growth.
Seasonal Component
 Relative Seasonal Variation: The seasonal component ranges from approximately 0.8 to 1.4.
This means that during the low season, sales are about 80% of the average, and during the
high season, they are about 140% of the average.
 Consistent Proportional Pattern: The consistent cyclical pattern indicates that the relative
magnitude of seasonal fluctuations is consistent over time.
 Multiplicative Impact: The seasonal component multiplies the trend to produce the observed
seasonality.
Residual Component
 Relative Random Fluctuations: The residual component fluctuates around 1.0, indicating that
the random variations are also proportional. A residual of 1.1 means sales are 10% higher
than expected after accounting for trend and seasonality.
 Multiplicative Impact: The residual multiplies the trend and seasonal components to produce
the observed data
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Problem 2

Data Pre-processing- Missing value treatment - Visualize the processed data - Train-test split

There are no missing values

Monthly Data: The data is organized monthly, indicated by the "Month Year" column and the date format in
the index.
Time Range:
 Training Data: Spans from January 1980 to October 1990.
 Test Data: Spans from November 1990 to July 1995.
Target Variable: The "No_Shoe_Sales" column represents the number of shoe sales, which is the target
variable we want to forecast.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Time Series Data: The plot shows the "No_Shoe_Sales" data over time, with the x-axis representing years
and the y-axis representing the number of shoe sales.
Training and Test Split: The data is clearly divided into training and test sets, indicated by the different
colored lines (blue for training, orange for test).

Training Data (Blue Line):


 Upward Trend: The training data (blue line) shows a general upward trend from the early 1980s to the
late 1980s.
 Level Shift: There's a noticeable jump in sales around 1986-1988, indicating a level shift.
 Higher Volatility: The training data exhibits higher volatility, particularly in the later part of the
training period (around 1986-1990).
 Data for Model Training: This data is used to train the forecasting model.
Test Data (Orange Line):
 Post Level Shift Behavior: The test data (orange line) starts after the level shift, showing a more stable
pattern with fluctuations around a mean level.
 Lower Volatility: The test data generally shows lower volatility compared to the training data.
 Data for Model Evaluation: This data is used to evaluate the model's performance on unseen data.

Training Time instance


[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130]
Test Time instance
[256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312]

Training Time Instances:


 Sequential Order: The training time instances are sequential, starting from 1 and going up to 130. This
suggests that the data is time-ordered.
 Continuous Range: The training instances represent a continuous range of time points, indicating that
there are no gaps or missing data points within the training period.
Test Time Instances:
 Sequential Order: The test time instances are also sequential, starting from 256 and going up to 312.
 Continuous Range: The test instances represent a continuous range of time points, indicating no gaps
within the test period.
 Gap Between Training and Test: There's a significant gap between the last training instance (130) and
the first test instance (256). This gap implies that a portion of the time series data is excluded from
both training and testing.

Problem 3

Model Building - Original Data- Build forecasting models - Linear regression - Simple Average -
Moving Average - Exponential Models (Single, Double, Triple) - Check the performance of the models
built
Logistic Regression

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Training and Test Data: The plot shows the training and test data, as indicated by the blue and
orange lines, respectively.
Logistic Regression Forecast: The green line represents the forecast made by logistic regression on
the test data.
Poor Forecast Accuracy: The logistic regression forecast (green line) appears to be a poor fit for
the actual test data (orange line).
Poor Fit to Test Data:
 Significant Deviation: The green line deviates significantly from the orange line, indicating
that the logistic regression model fails to capture the underlying patterns in the test data.

Extremely High RMSE: The RMSE value of 331,850.445317 is exceptionally high. This suggests that
the model's predictions are significantly far from the actual values in the test set.
Poor Model Performance: A high RMSE indicates poor model performance. The model is not
accurately capturing the patterns in the data and is producing large errors.

Naïve Forecast

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Naive Forecast Behavior:
 Constant Forecast: The green line (Naive Forecast) is a flat, horizontal line. This confirms that
the forecast is constant and equal to the last value in the training data.
 No Trend or Seasonality Capture: The Naive Forecast completely ignores any trend or
seasonality present in the data.
Poor Fit to Test Data:
 Significant Deviation: The green line deviates significantly from the actual test data (orange
line).

High RMSE: The RMSE value of 11605.175439 is relatively high. This suggests that the Naive
Forecast model's predictions are significantly different from the actual values in the test set.
Poor Model Performance: A high RMSE indicates poor model performance. The Naive Forecast, as
expected, is not accurately capturing the patterns in the data and is producing large errors.

Simple Average forecast

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Simple Average Behavior:
 Constant Forecast: The green line (Simple Average Forecast) is a flat, horizontal line. This
indicates that the forecast is a constant value, representing the mean of the training data.
 No Trend or Seasonality Capture: The Simple Average Forecast completely ignores any trend
or seasonality present in the data.
Poor Fit to Test Data:
 Significant Deviation: The green line deviates significantly from the actual test data (orange
line).
 Ignoring Fluctuations: The Simple Average Forecast fails to capture the fluctuations and
variations present in the test data.

Simple Average Outperforms Naive: The Simple Average Model has a significantly lower RMSE
(4974.097699) compared to the Naive Model (11605.175439). This means the Simple Average Model
is providing more accurate forecasts than the Naive Model on the test data.
Still High RMSE: While the Simple Average Model performs better than the Naive Model, its RMSE
of 4974.097699 is still relatively high. This suggests that the model's predictions are still significantly
different from the actual values in the test set

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Moving Average

Multiple Moving Averages: The plot shows the original training data (blue line) along with moving
average forecasts calculated using different window sizes: 2, 4, 6, and 9 points.
Smoothing Effect: All the moving average lines show a smoothing effect compared to the original
data, reducing the fluctuations and highlighting the underlying trends.
Varying Degrees of Smoothing: The degree of smoothing varies with the window size. Larger
window sizes result in smoother forecasts.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Multiple Trailing Moving Averages: The plot shows the original training (blue line) and test
(orange line) data, along with trailing moving average forecasts calculated using different window
sizes: 2, 4, 6, and 9 points on the test data.
Smoothing Effect (Test Data): Similar to the previous plot, the trailing moving average lines show a
smoothing effect compared to the original test data, reducing fluctuations.
Varying Degrees of Smoothing (Test Data): The degree of smoothing varies with the window size
on the test data as well. Larger window sizes result in smoother forecasts.
Lagging Behavior (Test Data): The moving averages lag behind the actual test data, especially at
turning points.

For 2 point Moving Average Model forecast on the Training Data, RMSE is 2096.333
For 4 point Moving Average Model forecast on the Training Data, RMSE is 3456.840
For 6 point Moving Average Model forecast on the Training Data, RMSE is 4244.904
For 9 point Moving Average Model forecast on the Training Data, RMSE is 4983.745

2-Point Trailing Moving Average Performs Best: The 2-point trailing moving average has the
lowest RMSE (2096.333333) among all the models. This indicates that it provides the most accurate
forecasts on the test data compared to the other models.
Simple Average Outperforms Naive and Larger Moving Averages: The Simple Average Model
(RMSE: 4974.097699) outperforms the Naive Model (RMSE: 11605.175439) and the larger trailing
moving averages (6-point and 9-point).
RMSE Increases with Larger Moving Average Windows: As the window size of the trailing moving
average increases (from 2 to 9), the RMSE also increases. This suggests that larger window sizes lead
to less accurate forecasts on the test data.
Model Comparison:
 Naive Model (Worst): The Naive Model has the highest RMSE, indicating the poorest
performance.
 Simple Average (Better): The Simple Average Model performs better than the Naive Model.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Trailing Moving Averages (Varying): The performance of trailing moving averages varies with
the window size. The 2-point trailing moving average performs the best, while larger window
sizes perform worse.

Model Comparison

Regression On Time (Green Line):


 Linear Trend: The regression model fits a linear trend to the training data.
 Poor Forecast: The forecast (green line) deviates significantly from the actual test data
(orange line), indicating poor performance.
 Not Suitable: This suggests that a simple linear regression is not suitable for forecasting this
time series.
Naive Forecast (Red Line):
 Constant Forecast: The Naive Forecast is a constant value, equal to the last observation in
the training data.
 Poor Fit: The Naive Forecast (red line) doesn't capture the fluctuations in the test data
(orange line).
 Not Suitable: The Naive Forecast is too simplistic and not suitable for this time series.
Simple Average (Purple Line):
 Constant Forecast: The Simple Average is also a constant value, representing the mean of
the training data.
 Poor Fit: Similar to the Naive Forecast, the Simple Average (purple line) doesn't capture the
fluctuations in the test data.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Not Suitable: The Simple Average is too simplistic and not suitable for this time series.
2 Point Trailing Moving Average (Brown Line):
 Smoothed Trend: The 2 Point Trailing Moving Average (brown line) shows a smoothed trend
in the training data.
 Closer Fit: It appears to be a closer fit to the test data compared to the other models, but still
doesn't capture the fluctuations perfectly.
 Relatively Better Performance: It performs relatively better than the other models, but still
has limitations.
Model Comparison:
 2 Point Trailing Moving Average (Best): Among the compared models, the 2 Point Trailing
Moving Average appears to be the best-performing, but still has limitations.
 Regression, Naive, Simple Average (Poor): The regression, Naive, and Simple Average
models perform poorly on the test data.

Simple exponential smoothening

Simple Exponential Smoothing (Alpha = 0.99):


 High Alpha Value: An alpha value of 0.99 gives a very high weight to the most recent
observation and very little weight to past observations.
 Nearly Naive Forecast: With such a high alpha, the forecast is essentially a Naive Forecast, as
it's heavily influenced by the last training data point.
 Constant Forecast: The forecast (red line) is a flat, horizontal line, similar to the Naive
Forecast.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Poor Fit to Test Data:
 Significant Deviation: The forecast (red line) deviates significantly from the actual test data
(orange line).
 Ignoring Fluctuations: The forecast fails to capture the fluctuations and variations present in
the test data.

 Simple and Double Exponential Smoothing (SES & DES): The plot compares the forecasts
generated by Simple Exponential Smoothing (SES) with alpha = 0.99 and Double Exponential
Smoothing (DES) with alpha = 0.099 and beta = 0.0001.
 Training and Test Split: The data is split into training (blue line) and test (orange line) sets.
 Poor Fit: Both SES and DES forecasts show a poor fit to the test data.
Specific Inferences:
1. Simple Exponential Smoothing (SES) with Alpha = 0.99 (Green Line):
o High Alpha Value: As discussed previously, an alpha of 0.99 makes the forecast
essentially a Naive Forecast, heavily influenced by the last training data point.
o Constant Forecast: The forecast (green line) is a flat, horizontal line.
o Poor Fit: The SES forecast doesn't capture the fluctuations in the test data.
2. Double Exponential Smoothing (DES) with Alpha = 0.099 and Beta = 0.0001 (Red Line):
o Low Alpha and Beta: Low alpha and beta values indicate that the model gives more
weight to past observations and less weight to recent changes.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
o Linear Trend: The DES forecast (red line) shows a linear trend, attempting to capture
the overall upward trend in the training data.
o Poor Fit: The DES forecast still deviates significantly from the actual test data and
fails to capture the fluctuations.
3. Model Comparison:
o DES Slightly Better: The DES forecast (red line) appears to follow the general
direction of the test data (orange line) slightly better than the SES forecast (green
line), which is completely flat.
o Both Poor Performance: However, both models exhibit poor performance and don't
accurately capture the actual fluctuations in the test data.

SES Significantly Outperforms DES: The Simple Exponential Smoothing (SES) model with alpha =
0.99 has a significantly lower RMSE (109.515017) compared to the Double Exponential Smoothing
(DES) model with alpha = 1 and beta = 0.0189 (20949.171963). This indicates that the SES model
provides much more accurate forecasts on the test data than the DES model.
DES Performance is Poor: The DES model's RMSE of 20949.171963 is extremely high. This suggests
that the DES model is performing very poorly and is not capturing the patterns in the data effectively.
SES Performance is Relatively Good: The SES model's RMSE of 109.515017 is relatively low. This
indicates that the SES model is providing reasonably accurate forecasts on the test data, at least
compared to the DES model.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Simple Exponential Smoothing (SES) with Alpha = 1 (Green Line):
 High Alpha Value: An alpha of 1 makes the forecast essentially a Naive Forecast, heavily
influenced by the last training data point.
 Constant Forecast: The forecast (green line) is a flat, horizontal line.
 Poor Fit: The SES forecast doesn't capture the fluctuations in the test data.
Double Exponential Smoothing (DES) with Alpha = 0.99 and Beta = 0.001 (Red Line):
 High Alpha, Low Beta: A high alpha and low beta indicate that the model gives more weight
to recent observations and less weight to the trend.
 Linear Trend: The DES forecast (red line) shows a linear trend, attempting to capture the
overall upward trend in the training data.
 Poor Fit: The DES forecast still deviates significantly from the actual test data and fails to
capture the fluctuations.
Triple Exponential Smoothing (TES) with Alpha = 0.25, Beta = 0.0, and Gamma = 0.74 (Purple
Line):
 Moderate Alpha, Zero Beta, High Gamma: These parameter values indicate that the model
gives moderate weight to recent observations, ignores the trend component, and gives high
weight to the seasonal component.
 Fluctuating Forecast: The TES forecast (purple line) shows fluctuations, attempting to
capture the seasonal patterns in the data.
 Poor Fit: The TES forecast also deviates significantly from the actual test data and doesn't
accurately capture the seasonal patterns.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Model Comparison:
 All Poor Performance: All three models exhibit poor performance and don't accurately
capture the actual fluctuations in the test data.

Simple Exponential Smoothing (SES - Green):


 Focuses solely on the level of the time series, ignoring trend and seasonality.
 With alpha = 1, it becomes a Naive Forecast, predicting the next value as the last observed
value.
 Results in a flat, horizontal forecast, completely missing the fluctuations in the test data.
 Performs the worst in capturing the dynamic behavior of the time series.
Double Exponential Smoothing (DES - Red):
 Attempts to capture both the level and trend of the time series.
 With alpha = 0.99 and beta = 0.001, it prioritizes recent observations and gives very little
weight to the trend.
 Produces a linear trend forecast, which is still a poor fit for the fluctuating test data.
 Performs slightly better than SES by attempting to capture the overall direction, but fails to
capture the detailed variations.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Triple Exponential Smoothing (TES - Purple):
 Attempts to capture level, trend, and seasonality.
 With alpha = 0.25, beta = 0.0, and gamma = 0.74, it focuses on seasonality and recent
observations, while ignoring the trend.
 Produces a fluctuating forecast, indicating an attempt to capture seasonality, but the
fluctuations don't align well with the actual test data.
 Fails to provide accurate forecasts, as the seasonality it captures is not a good representation
of the true pattern.
Model Limitations: Exponential smoothing models are based on weighted averages and struggle to
capture complex patterns like sudden changes, non-linear trends, or intricate seasonality.

SES Performs Best: The Simple Exponential Smoothing (SES) model with alpha = 0.99 has the
lowest RMSE (109.515017) among the three models. This indicates that it provides the most accurate
forecasts on the test data.
DES Performs Worst: The Double Exponential Smoothing (DES) model with alpha = 1 and beta =
0.0189 has the highest RMSE (20949.171963). This suggests that it's performing very poorly and is
not capturing the patterns in the data effectively.
TES Performance is Intermediate: The Triple Exponential Smoothing (TES) model with alpha =
0.25, beta = 0.0, and gamma = 0.74 has an RMSE of 8625.626132. It performs better than the DES
model but worse than the SES model.
Model Comparison:
 SES (Best): The SES model provides the most accurate forecasts.
 DES (Worst): The DES model performs the poorest.
 TES (Intermediate): The TES model's performance is in between the other two.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Simple Exponential Smoothing (SES) with Alpha = 1 (Green Line):
 High Alpha Value: As discussed previously, an alpha of 1 makes the forecast essentially a
Naive Forecast.
 Constant Forecast: The forecast (green line) is a flat, horizontal line.
 Poor Fit: The SES forecast doesn't capture the fluctuations in the test data.
Double Exponential Smoothing (DES) with Alpha = 0.99 and Beta = 0.001 (Red Line):
 High Alpha, Low Beta: Prioritizes recent observations and smooths the trend too much.
 Linear Trend: The forecast (red line) shows a linear trend.
 Poor Fit: The DES forecast still deviates significantly from the actual test data.
Triple Exponential Smoothing 1 (TES1) with Alpha = 0.25, Beta = 0.0, and Gamma = 0.74 (Purple
Line):
 Moderate Alpha, Zero Beta, High Gamma: Focuses on seasonality and recent observations,
ignoring the trend.
 Fluctuating Forecast: The forecast (purple line) shows fluctuations.
 Poor Fit: The TES1 forecast doesn't accurately capture the seasonal patterns.
Triple Exponential Smoothing 2 (TES2) with Alpha = 0.74, Beta = 2.73e-06, and Gamma = 5.2e-07
(Brown Line):
 High Alpha, Very Low Beta and Gamma: Prioritizes recent observations and heavily smooths
trend and seasonality.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Nearly Flat Forecast: The forecast (brown line) is nearly flat, resembling the SES forecast, but
slightly more responsive.
 Poor Fit: The TES2 forecast doesn't capture the fluctuations well.
Model Comparison:
 All Poor Performance: All four models exhibit poor performance and don't accurately
capture the actual fluctuations in the test data.
 TES2 Closest to SES: The TES2 forecast is very similar to the SES forecast, indicating that with
the chosen parameters, it behaves like a Naive Forecast.
 DES and TES1 Attempt Trend and Seasonality: The DES and TES1 models attempt to capture
trend and seasonality, respectively, but fail to provide accurate forecasts.

SES Performs Best: The Simple Exponential Smoothing (SES) model with alpha = 0.99 has the
lowest RMSE (109.515017) among all four models. This indicates that it provides the most accurate
forecasts on the test data.
DES Performs Worst: The Double Exponential Smoothing (DES) model with alpha = 1 and beta =
0.0189 has the highest RMSE (20949.171963). This suggests that it's performing very poorly and is
not capturing the patterns in the data effectively.
TES Performance Varies: The two Triple Exponential Smoothing (TES) models have different RMSE
values:
 TES (Alpha = 0.25, Beta = 0.0, Gamma = 0.74) RMSE: 8625.626132
 TES (Alpha = 0.74, Beta = 2.73e-06, Gamma = 5.2e-07) RMSE: 5251.999169
TES with Higher Alpha Performs Better: The TES model with alpha = 0.74, beta = 2.73e-06, and
gamma = 5.2e-07 performs better than the TES model with alpha = 0.25, beta = 0.0, and gamma =
0.74. This indicates that the parameter choices significantly impact the performance of the TES
model.
Model Comparison (Overall):
 SES (Best): Provides the most accurate forecasts.
 TES (Variable): Performance depends on parameter choices. The TES with higher alpha
performs better.
 DES (Worst): Performs the poorest.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Problem 4

Check for Stationarity- Check for stationarity - Make the data stationary (if needed)

Non-Stationary: The p-value (0.4222) is greater than the typical significance level of 0.05.. This
means we conclude that the time series is non-stationary.

Performing differencing ( d=1 ) as the data is non-stationary

Stationarity Improvement: The differenced series appears to be more stationary than the original
series. The trend component, which was evident in the original series, has been removed.
Fluctuations Around Zero: The differenced series fluctuates around zero, indicating that there's no
clear upward or downward trend.
Volatility: The differenced series still exhibits volatility. The magnitude of fluctuations varies over
time.

log transformation of the data.

Logarithmic Scale: The y-axis represents the logarithm of "No_Shoe_Sales," not the raw sales
values.
Trend and Level Shift (Log Scale):
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Upward Trend: There's still an upward trend, but it appears to be more linear in the log scale
compared to the original scale.
 Level Shift: The level shift around 1986-1988 is still present, but it now represents a
proportional change rather than an absolute change.
Volatility: The volatility seems to be more consistent across the series in the log scale. This
suggests that the log transformation has helped stabilize the variance.

Performing differencing (d=1) on the log transformed time series

Stationarity: The series appears to be stationary. It fluctuates around zero with no clear trend.
Volatility: The volatility seems relatively consistent across the series, indicating that the log
transformation has helped stabilize the variance.
Random Fluctuations: The series shows random fluctuations, suggesting that the trend and level
shift have been effectively removed.

Problem 5

Model Building - Stationary Data- Generate ACF & PACF Plot and find the AR, MA values. - Build
different ARIMA models - Auto ARIMA - Manual ARIMA - Build different SARIMA models - Auto
SARIMA - Manual SARIMA - Check the performance of the models built

Auto Regressive(AR) Models

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
ARIMA(2, 0, 0) Model: The model fitted is an ARIMA(2, 0, 0) model. This means it includes two
autoregressive (AR) terms, no differencing (I), and no moving average (MA) terms.
Significant AR Terms: Both AR terms (ar.L1 and ar.L2) are statistically significant (p-value = 0.000).
This suggests that past values of the "No_Shoe_Sales" variable have a significant impact on the
current values.
Significant Constant: The constant term is also statistically significant (p-value = 0.000). This
indicates that there's a non-zero mean level in the time series after accounting for the AR terms.
Significant Residual Variance: The variance of the residuals (sigma2) is statistically significant (p-
value = 0.000). This suggests that the residuals are not simply random noise.

Calculating RMSE for best AR model

Relatively Low RMSE: An RMSE of 111.48 suggests that the best AR model is providing relatively
accurate forecasts on the test data.
Model Fit: The low RMSE indicates that the AR model is capturing the patterns in the data
reasonably well and is producing forecasts that are close to the actual values.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Training Data (Blue Line):
 Upward Trend: The training data shows an upward trend, particularly from the early 1980s
to the late 1980s.
 Level Shift: There's a noticeable jump in sales around 1986-1988, indicating a level shift.
 Higher Volatility: The training data exhibits higher volatility, particularly in the later part of
the training period (around 1986-1990).
Test Data (Orange Line):
 Post Level Shift Behavior: The test data starts after the level shift, showing a more stable
pattern with fluctuations around a mean level.
 Lower Volatility: The test data generally shows lower volatility compared to the training
data.
Forecasted Sales (Green Line):
 Level Capture: The forecasted sales (green line) capture the general level of the test data.
 Poor Fluctuation Capture: The forecast doesn't accurately capture the fluctuations and
variations present in the test data.
 Potential Model Limitations: The model used for forecasting might not be capturing the
underlying patterns in the data effectively.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
RMSE Value: The RMSE of 111.480284 indicates the average magnitude of the errors between the
forecasted values and the actual values in the test set.
Model Fit: The RMSE suggests that the ARIMA(2, 0, 0) model is providing forecasts that are, on
average, about 111.48 units away from the actual values.

ARMA Model building to estimate best 'p' , 'q' ( Lowest AIC Approach )

ARIMA(1, 0, 1) Model Fit: The AIC value of -270.11436 represents the goodness of fit of the
ARIMA(1, 0, 1) model to the data, taking into account the model's complexity.
Model Comparison: To determine if this AIC value is good, it needs to be compared with the AIC
values of other ARIMA models fitted to the same dataset.

ARIMA(3, 0, 3) Model: The model fitted is an ARIMA(3, 0, 3) model. This means it includes three
autoregressive (AR) terms, no differencing (I), and three moving average (MA) terms.
Significant AR and MA Terms: All the AR and MA terms are statistically significant (p-value =
0.000), except for the constant term. This suggests that past values of the "No_Shoe_Sales" variable
and past forecast errors have a significant impact on the current values.
Insignificant Constant: The constant term is not statistically significant (p-value = 0.904). This
might suggest that there's no significant overall mean level in the time series after accounting for the
AR and MA terms.
Significant Residual Variance: The variance of the residuals (sigma2) is statistically significant (p-
value = 0.000). This suggests that the residuals are not simply random noise.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Calculating RMSE for best MA model

The Root Mean Squared Error of our forecasts is 100.969

RMSE Value: The RMSE of 100.969 indicates the average magnitude of the errors between the
forecasted values and the actual values in the test set.
Model Fit: The RMSE suggests that the model used for forecasting is providing forecasts that are,
on average, about 100.969 units away from the actual values.

Training Data (Blue Line):


 Upward Trend: The training data shows an upward trend, particularly from the early 1980s
to the late 1980s.
 Level Shift: There's a noticeable jump in sales around 1986-1988, indicating a level shift.
 Higher Volatility: The training data exhibits higher volatility, particularly in the later part of
the training period (around 1986-1990).
Test Data (Orange Line):
 Post Level Shift Behavior: The test data starts after the level shift, showing a more stable
pattern with fluctuations around a mean level.
 Lower Volatility: The test data generally shows lower volatility compared to the training
data.
Forecasted Sales (Green Line):
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Level Capture: The forecasted sales (green line) capture the general level of the test data.
 Poor Fluctuation Capture: The forecast doesn't accurately capture the fluctuations and
variations present in the test data.

RMSE Value: The RMSE of 100.968926 indicates the average magnitude of the errors between the
forecasted values and the actual values in the test set.
Model Fit: The RMSE suggests that the ARIMA(3, 0, 3) model is providing forecasts that are, on
average, about 100.97 units away from the actual values.

ARIMA Model building to estimate best 'p' , 'd' , 'q' paramters ( Lowest AIC Approach )

ARIMA(1, 0, 1) Model Fit: The AIC value of -270.11436 represents the goodness of fit of the
ARIMA(1, 0, 1) model to the data, taking into account the model's complexity

Building ARIMA model with best parameters p,d,q

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
ARIMA(3, 0, 3) Model: The model fitted is an ARIMA(3, 0, 3) model. This means it includes three
autoregressive (AR) terms, no differencing (I), and three moving average (MA) terms.
Significant AR and MA Terms: All the AR and MA terms are statistically significant (p-value =
0.000), except for the constant term. This suggests that past values of the "No_Shoe_Sales" variable
and past forecast errors have a significant impact on the current values.
Insignificant Constant: The constant term is not statistically significant (p-value = 0.904). This
might suggest that there's no significant overall mean level in the time series after accounting for the
AR and MA terms.
Significant Residual Variance: The variance of the residuals (sigma2) is statistically significant (p-
value = 0.000). This suggests that the residuals are not simply random noise.
Calculating RMSE for best ARIMA model
The Root Mean Squared Error of our forecasts is 100.969

Training Data (Blue Line):


 Upward Trend: The training data shows an upward trend, particularly from the early 1980s
to the late 1980s.
 Level Shift: There's a noticeable jump in sales around 1986-1988, indicating a level shift.
 Higher Volatility: The training data exhibits higher volatility, particularly in the later part of
the training period (around 1986-1990).
Test Data (Orange Line):
 Post Level Shift Behavior: The test data starts after the level shift, showing a more stable
pattern with fluctuations around a mean level.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 Lower Volatility: The test data generally shows lower volatility compared to the training
data.
Forecasted Sales (Green Line):
 Level Capture: The forecasted sales (green line) capture the general level of the test data.
 Poor Fluctuation Capture: The forecast doesn't accurately capture the fluctuations and
variations present in the test data.

ARIMA(3, 0, 3) is Better: The ARIMA(3, 0, 3) model has a lower RMSE (100.968926) compared to
the ARIMA(2, 0, 0) model (111.480284). This indicates that the ARIMA(3, 0, 3) model provides more
accurate forecasts on the test data.
RMSE Difference: The difference in RMSE values is approximately 10.51 units (111.480284 -
100.968926). This suggests a noticeable improvement in forecast accuracy with the ARIMA(3, 0, 3)
model.
Model Complexity: The ARIMA(3, 0, 3) model is more complex than the ARIMA(2, 0, 0) model, as it
includes more AR and MA terms. However, the lower RMSE justifies the increased complexity.

SARIMA MODEL

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Significant Lags: Several lags are statistically significant (bars extending beyond the shaded region).
This indicates that past values of the time series have a strong influence on the current values.
Gradual Decay: The ACF plot shows a gradual decay in the magnitude of the autocorrelation as the
lag increases. This suggests that there might be an autoregressive (AR) component in the time series.

SARIMA(1, 0, 1)x(1, 0, 1, 12) - AIC:-334.88446529793055

Model Fit: The AIC value of -334.88446529793055 represents the goodness of fit of the SARIMA(1, 0,
1)x(1, 0, 1, 12) model to the data, taking into account the model's complexity.

Building SARIMA model with the best parameters

SARIMAX(1, 0, 1)x(1, 0, 1, 12) Model: The model fitted is a Seasonal ARIMA model with:
 Non-seasonal components: AR(1), I(0), MA(1)
 Seasonal components: Seasonal AR(1) at lag 12, Seasonal I(0), Seasonal MA(1) at lag 12
 Seasonal period: 12 (likely monthly data with yearly seasonality).
Significant Parameters: All the AR and MA terms (both non-seasonal and seasonal) are statistically
significant (p-value = 0.000). This indicates that both past values and past forecast errors, including
seasonal lags, have a significant impact on the current values.
Significant Residual Variance: The variance of the residuals (sigma2) is statistically significant (p-
value = 0.000). This suggests that the residuals are not simply random noise.
Model Fit:
 AIC, BIC, HQIC: The AIC (-358.169), BIC (-342.204), and HQIC (-351.696) are used to assess
the model fit. Lower values generally indicate a better fit.
 Log Likelihood: The Log Likelihood (184.085) measures how well the model fits the data.

The Root Mean Squared Error of our forecasts is 26.251

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Training Data (Blue Line):
 Upward Trend: The training data shows an upward trend, particularly from the early 1980s
to the late 1980s.
 Level Shift: There's a noticeable jump in sales around 1986-1988, indicating a level shift.
 Higher Volatility: The training data exhibits higher volatility, particularly in the later part of
the training period (around 1986-1990).
Test Data (Orange Line):
 Post Level Shift Behavior: The test data starts after the level shift, showing a more stable
pattern with fluctuations around a mean level.
 Lower Volatility: The test data generally shows lower volatility compared to the training
data.
Forecasted Sales (Green Line):
 Level Capture: The forecasted sales (green line) capture the general level of the test data.
 Poor Fluctuation Capture: The forecast doesn't accurately capture the fluctuations and
variations present in the test data.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
SARIMAX(1, 0, 1)x(1, 0, 1, 12) is the Best: The SARIMAX(1, 0, 1)x(1, 0, 1, 12) model has the lowest
RMSE (26.250536) among all the models. This indicates that the SARIMA model provides the most
accurate forecasts on the test data.
Significant Improvement with SARIMA: The RMSE of the SARIMA model is significantly lower than
the RMSE of the ARIMA models. This suggests that the seasonal component in the SARIMA model is
effectively capturing the patterns in the data and improving forecast accuracy.
Model Suitability:
 SARIMA(1, 0, 1)x(1, 0, 1, 12) is Best: The SARIMA model is the most suitable for forecasting
the "No_Shoe_Sales" time series based on the RMSE values.

Observed Data (Blue Line):


 Time Period: Covers approximately 1980 to 1996.
 Characteristics:
o Initial Fluctuations: Shows fluctuations in the early part of the time series.
o Level Shift: Experiences a significant level shift or jump around 1986-1988.
o Higher Volatility: Exhibits higher volatility, particularly in the later part of the training
period (around 1986-1990).
Forecasted Data (Orange Line):
 Time Period: Covers approximately 2014 to 2017.
 Characteristics:
o Stable Level: Shows a relatively stable level around 200 units.
o Uncertainty: The grey shaded area represents the uncertainty or confidence interval
of the forecast.
Gap in Data: There's a significant gap in the data between 1996 and 2014, indicating a missing
period.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Plot 1: Standardized Residual for "N"

Fluctuations Around Zero: The residuals fluctuate around zero, suggesting that the model has
captured the mean structure of the time series reasonably well.
No Clear Trend or Pattern: There's no clear trend or pattern in the residuals, indicating that the
model has captured the trend and seasonality (if present) effectively.
Outliers: There are a few outliers (points far from zero), especially around 1986-1988. This
suggests that the model might not have captured some unusual events or structural changes during
that period.
Constant Variance: The variance of the residuals appears to be relatively constant over time,
indicating that the model has captured the heteroscedasticity (if present) effectively.
Plot 2: Histogram Plus Estimated Density
Approximately Normal Distribution: The histogram and KDE are approximately bell-shaped and
centered around zero, suggesting that the residuals are approximately normally distributed.
Slight Deviations from Normality: There are some slight deviations from the standard normal
distribution, particularly in the tails. This suggests that the residuals might not be perfectly normally
distributed.
Skewness: The distribution appears to be slightly skewed to the left, indicating that there are more
negative residuals than positive residuals.

Model Adequacy: The plots suggest that the model is reasonably adequate for forecasting the time
series. The residuals are centered around zero, have no clear trend or pattern, and are approximately
normally distributed.

Plot 1: Normal Q-Q (Quantile-Quantile) Plot

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
Observations:
1. Approximately Linear Pattern: The data points follow the red line reasonably closely,
suggesting that the residuals are approximately normally distributed.
2. Deviations at Tails: There are some deviations from the red line at the tails, indicating that
the residuals might not be perfectly normally distributed in the extreme values.
3. Outliers: There are a few outliers (points far from the line), particularly at the lower tail. This
suggests that the model might not have captured some unusual events or structural changes
in the time series.
Plot 2: Correlogram (ACF Plot)
Insignificant Autocorrelations: All the autocorrelation values fall within the shaded confidence
interval, indicating that they are not statistically significant.
Random Pattern: The autocorrelation values show a random pattern around zero, suggesting that
there's no significant autocorrelation in the residuals.
No Clear Pattern: There's no clear pattern or trend in the autocorrelation values, indicating that
the model has captured the autocorrelation structure of the time series effectively.
Model Adequacy: The plots suggest that the model is reasonably adequate for forecasting the time
series. The residuals are approximately normally distributed and show no significant autocorrelation.

Problem 6

Compare the performance of the models- Compare the performance of all the models built - Choose the best
model with proper rationale - Rebuild the best model using the entire data - Make a forecast for the next 12
months

we have the following models and their RMSE values:


 ARIMA(2, 0, 0) RMSE: 111.480284
 ARIMA(3, 0, 3) RMSE: 100.968926
 SARIMAX(1, 0, 1)x(1, 0, 1, 12) RMSE: 26.250536
Analysis:
 SARIMAX(1, 0, 1)x(1, 0, 1, 12) is the Best: The SARIMAX model has the lowest RMSE,
indicating the most accurate forecasts among the models.
 Significant Improvement: The SARIMAX model's RMSE is significantly lower than the ARIMA
models, suggesting that the seasonal component effectively captures the data's patterns.
 ARIMA(3, 0, 3) is Better than ARIMA(2, 0, 0): The ARIMA(3, 0, 3) model has a lower RMSE
than ARIMA(2, 0, 0), but still performs significantly worse than the SARIMAX model.
Rationale for Choosing SARIMAX(1, 0, 1)x(1, 0, 1, 12):
 The seasonal part of the SARIMAX model, indicates that the time series has strong seasonal
patterns.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
 The significant reduction in the RMSE when compared to the ARIMA models validates the
presence and importance of the seasonal patterns.

Observed Data (Blue Line):


 Time Period: Covers approximately 1980 to 1996.
 Characteristics:
o Initial Fluctuations: Shows fluctuations in the early part of the time series.
o Level Shift: Experiences a significant level shift or jump around 1986-1988.
o Higher Volatility: Exhibits higher volatility, particularly in the later part of the training
period (around 1986-1990).
Forecasted Data (Orange Line):
 Time Period: Covers the next 12 months after the observed data (approximately 1996-1997).
 Characteristics:
o Stable Level: Shows a relatively stable level around 200 units.
o Uncertainty: The grey shaded area represents the uncertainty or confidence interval
of the forecast.

Problem 7

Actionable Insights & Recommendations- Conclude with the key takeaways (actionable insights and
recommendations) for the business

11. Significant Level Shift Impact:


o Insight: The "No_Shoe_Sales" time series exhibits a significant level shift around
1986-1988, indicating a structural change or event that dramatically impacted sales.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
o Action: Investigate the root cause of this level shift. Was it a change in marketing
strategy, a new product launch, economic factors, or a competitive event?
Understanding the cause can help inform future strategies and mitigate similar
impacts.
12. Higher Volatility in the Past:
o Insight: The training period (before 1996) showed higher volatility in sales,
suggesting periods of unpredictability.
o Action: Analyze the factors contributing to this volatility. Were there seasonal
factors, promotional campaigns, or external market fluctuations? Implement
strategies to mitigate volatility, such as inventory management, flexible production
schedules, or hedging against market fluctuations.
13. SARIMAX Model Superiority:
o Insight: The SARIMAX(1, 0, 1)x(1, 0, 1, 12) model significantly outperformed ARIMA
models, indicating the presence and importance of seasonality.
o Action: Use the SARIMAX model for forecasting future sales, as it captures the
seasonal patterns effectively. Monitor the model's performance and update it as
needed to maintain accuracy.
14. Stable but Uncertain Forecast:
o Insight: The 12-month forecast suggests a stable level of sales around 200 units, but
with a degree of uncertainty.
o Action: Plan for a range of possible sales outcomes based on the confidence intervals
of the forecast. Implement flexible strategies that can adapt to different sales
scenarios.
15. Residual Diagnostics:
o Insight: The residual analysis showed the residuals were normally distributed, and
had no auto correlation.
o Action: This indicates the model is a good fit. Continue to monitor residuals to
ensure the model remains a good fit for the data.
Recommendations for the Business:
1. Investigate the 1986-1988 Level Shift:
o Conduct a thorough analysis of internal and external factors that could have caused
the significant level shift.
o Document the findings and use them to develop strategies to prevent similar
disruptions in the future.
2. Implement Volatility Mitigation Strategies:
o Develop inventory management strategies to buffer against sales fluctuations.
o Explore flexible production schedules that can adapt to changes in demand.
o Consider hedging against market fluctuations if external factors significantly impact
sales.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.
3. Utilize the SARIMAX Model for Forecasting:
o Integrate the SARIMAX(1, 0, 1)x(1, 0, 1, 12) model into the company's forecasting
process.
o Regularly update the model with new data to maintain its accuracy.
4. Plan for Forecast Uncertainty:
o Develop contingency plans for different sales scenarios based on the confidence
intervals of the forecast.
o Implement flexible strategies that can adapt to changes in demand.
5. Monitor Residuals:
o Continue to monitor the model residuals to ensure the model is a good fit.
o Retrain the model if there are any changes to the residuals.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.

You might also like