Time-Series Analysis on Sales Demand

Kuo Sheng Ang
5 min readAug 23, 2021

--

Time-Series analysis can be presented either in line graphs, bar chart or stacked bar-charts either in software applications such as Microsoft Excel, Tableau, Cognos Business Analytics, SAS/JMP or Power BI as a form of data visualization for S&OP resource planning together with other dimensions of data (ie: production capacity, capital expenditure) based on the customer order quantity (ie: Sales Order booking).

Automate generation of Bar Chart in Time-Series using Python in Jupyter notebook before building customized UI/UX app
Automate generation of Line Graph in Time-Series using Python in Jupyter notebook before building customized UI/UX app

Line charts representation in time-series for a single parameter (ie: product category) having multiple-values.

Automate generation of multiple Lines Graph in Time-Series for the respective product categories/types
Pivot Table to present 3 dimensions data (ie: DateTime, Product Package, Sum of Quantity) typically can be realized in Microsoft Excel
Statistical analysis of Order/Shipment quantity for each product category/package type using Python

The above time-series analysis presented in Bar Chart, Line Graph and Pivot Table can be realized using Microsoft Excel.

However, to compute Dickey–Fuller to test/determine if null hypothesis that is present in an autoregressive time series model, it cannot be realizing using Microsoft Excel. It can be achieved using stats package imported from libraries and customized function to perform the statistical computation either in R or Python languages.

Plot time series & compute Dickey–Fuller to test/determine if null hypothesis that is present in an autoregressive time series model for each respective group of product type/category/package
Plot time series & compute Dickey–Fuller to test/determine if null hypothesis that is present in an autoregressive time series model for each respective group of product type/category/package

The scope of this article will be on based on the 3 dimensions of data available (ie: shipment dates, product category (ie: package type, product line) & customer order quantity/sales order quantity) to explore various forms of time-series analysis. I approach this philosophy on Occam’s razor liberally in modeling efforts and always seek the simpler model when all else is the same is because for time-series Models with large number of parameters will tend to overfit the data in order management, in forecasting, they tend to produce poor forecasts and larger forecast variances.

In other context such as DOE (Design of Experiments) to address manufacturing process variability or defects issues, then using feature selections or PCA (Principle Component Analysis) to determine the relevant key parameters would be essential when building the model for prediction & prescription.

  • Descriptive Analytics
  • Predictive Analytics

Prescriptive analytics gathers data from a variety of both descriptive and predictive sources for its models and applies them to the process of decision-making for resource planning (ie: S&OP subjected to firm’s production capacity resource constraints), as such this will not be within the scope of this article.

  • Firm’s demand volume in the future as time-series/horizon would typically be the driving factor for resource planning such as firm’s production capacity expansion which could be addressing some of firm’s resource constraints as a linear problem by using tools such as IBM Cplex Optimization Studio.
  • Predictive Analysis using Facebook — fbprohet plot_components method

product_Category_model = Prophet(interval_width=0.95, growth=’linear’,
daily_seasonality=False,
weekly_seasonality=False,
yearly_seasonality=False,
seasonality_mode=’multiplicative’)
product_Category_model.fit(product_Category_df)

product_Category_model.plot_components(product_Category_model_forecast)

Using fbprophet plot_components method, the trend for each product category could be generated

Using fbprophet plot_components method to generate the trend for each product category/package
Using fbprophet plot_components method to generate the trend for each product category/package
  • Predictive Analysis using Facebook — fbprohet plot method

Similarly, Using fbprophet plot method, the prediction values for each product category could be generated across the defined time-horizon — in this case it was defined for future period =6.

product_Category_model.plot(product_Category_model_forecast, xlabel = ‘GI Date’, ylabel = ‘GI Quantity’)

Using fbprophet plot method to generate the prediction values for each product category/package across the time-horizon
  • Time Series Model Evaluation for suitability & Comparison

Using autoregressive integrated moving average (ARIMA) model can support making predictions on the gross requirements for MRP (Material Requirement Planning) especially when BOM components (ie: raw materials) has long lead-time in order not to minimize the effects of production delay. Of course, it’s is not fool-proof as these prediction of demand numbers still need to be subjected to other considerations (ie: production consumption or material usage pattern) before issuing purchase requisitions for BOM Components (ie: raw materials) to support manufacturing/production .

ARIMA have rigid assumptions such that to use ARIMA model, trends should have regular periods, as well as constant mean and variance. For instance, when analyzing an increasing trend, we have to first apply a transformation to the trend so that it is no longer increasing but stationary. Moreover, ARIMA cannot work if there is missing data.

To avoid having to squeeze our data into a mould, we could consider an alternative such as neural networks. Long short-term memory (LSTM) networks are a type of neural networks that builds models based on temporal dependence. While highly accurate, neural networks suffer from a lack of interpretability — it is difficult to identify the model components that lead to specific predictions.

Model comparison for each respective product category/package
Input source data-frame transformation into Pivot Table

Based on above PivotTable as the input data-source & certain assumption on parameters inputs into the model, ARIMA was evaluated to be the most suitable model for time-series analysis based on lowest RMSE (root mean square error).

  • ARIMA’s model prediction dataframe
ARIMA model prediction for each product category/package and export ARIMA’s prediction dataframe to Excel worksheet

--

--

No responses yet