DEMAND FORECASTING ANALYSIS
-PROTTUSH DAS (2133118)
-BHAKTI JHAVERI (2133122)
-AADHYA GARG (2133144)
-AKSHAT ARYAN (2133156)
-MANYA GUPTA ( 2133160)
ABOUT THE DATA
The daily demand forecasting data is taken
from UCI. Structure and first six rows of
the dataset are extracted using R software.
First six rows of the dataset are as follows.
The data contains 13 attributes and 60
[Link] target variable is Total
orders which we are forecasting.
Apply MLRM, by taking total orders as
dependent variables and different types of
orders as regressors.
PRE-PROCESSING OF THE DATA SET
•The dataset is first examined for the presence
of any null values. If any text is null, it is
converted to empty string.
•Correlation between different attributes is
observed using heat map.
•Sampling: Split the dataset in to two parts
according to thumb rule: 80% training data and
20% testing data. Then we create training label
and testing labels. Labels are “total orders”
attribute i.e., the target variable in the original
data. Training dataset is used to build model
and testing data is used to test the developed
model.
•Multiple linear regression model is fit to
predict the total orders.
Fig: HEAT MAP OF THE DATA
FITTING MULTIPLE LINEAR REGRESSION MODEL
● ´Total orders=1.163e-13 – 1.484e-15(non-urgent orders) – 2.116e-15 (urgent orders) + order type A
+order type B + order type C +4.582e-17 (fiscal sector orders) + 3.235e-19 (orders from traffic
controller sector) + 3.876e-19 (banking orders1)-5.108e-20(banking orders 2) – 6.902e-20(banking
orders 3)
● ´Partial Test to find significant regressors
● ´As suggested by MLRM model, total orders largely depends on non urgent orders, urgent orders, order
type A, order type B, order type C, as these are significant regressors.
● ´Backward Elimination:Total orders=6.654e-14 - 8.702e-16 (non urgent orders)-1.1994e-15(urgent
orders)+1(order type A)+order type B+ order type C
● ´Final Model building for prediction:
● ´Total orders=6.654e-14 - 8.702e-16 (non urgent orders)-1.1994e-15(urgent orders)+1(order type
A)+order type B+ order type C
Week of the month Day of the week predicted_mlrm(yt) Actual [Link](given data)
1 4 402.607 539.577
1 5 255.061 224.675
1 6 342.606 129.412
2 2 268.64 317.12
2 3 188.601 210.517
2 4 202.022 207.364
2 5 213.509 263.043
2 6 316.849 248.958
3 2 286.412 344.291
3 3 303.447 248.428
TREND COMPONENT OF TIME SERIES
Initially, our attempt to model the data using a quadratic curve proved
unsuccessful, as it did not provide a satisfactory fit. Subsequently, we
explored fitting the model to Exponential curve, Modified
Exponential,logistic,and Gompertz curve, but encountered similar challenges
with achieving a suitable fit.
So, we conclude that we are unable to analyse the fitting of trends in our data
and hence, there is no presence TREND component in our data.
MEASUREMENT OF CYCLIC TREND
It's reasonable to assume that our time series data, which
is collected at weekly and monthly intervals, doesn't
exhibit a cyclical component. This is because cyclical
patterns typically manifest over longer time frames, often
requiring several years of data to be adequately observed.
Hence, it's safe to assert that our model doesn't include a
cyclical component.
MEASUREMENT OF SEASONAL COMPONENT
USING SIMPLE AVERAGE METHOD
Column1 d2 d3 d4 d5 d6 Yt
w1 0 316.849 689.019 558.508 916.196 496.1144
w2 789.141 793.23 670.592 872.964 871.901 799.5656
w3 778.46 810.419 850.359 1051.356 657.668 829.6524
w4 597.667 897.658 760.688 695.573 747.431 739.8034
w5 932.965 541.473 646.053 304.95 331.9 551.4682
Total 3098.233 3359.629 3616.711 3483.351 3525.096 17083.02
seasonal avg 619.6466 671.9258 723.3422 696.6702 705.0192 683.3208
seasonal index 90.68165 98.33240844 105.8569 101.9536 103.1754
using mult model
SI using additive -63.6742 -11.395 40.0214 13.3494 21.6984
model
ANALYSIS OF RANDOM COMPONENT
-VARIATE DIFFERENCE METHOD
n 60 59 58 57 56
k 0 1 2 3 4
Sum sq 5081607. 291235.6 796219.2 2591350. 8851477.
333 871 764 276 184
mu2 84693.45 4936.198 13727.91 45462.28 158062.0
555 086 856 554 926
2k C k 1 2 6 20 70
H(k,60) 7.619 15.401 20.845 25.011 28.237
84693.45 2468.099 2287.986 2273.114 2258.029
Est. var
555 043 427 277 894
Conclusion: There is no significant difference
between variance of 1st order difference and
Rk 7.396970 1.123907 0.135494 0.165972 -
2nd order difference time series data and
488 248 667 958
estimated variance is 2468.09904.
INFERENCE BASED ON TIME SERIES DECOMPOSITION
In these decomposed plot, we can see that:
1. There is a presence of seasonal component
2. The estimation of the random component is depicted under remainder .
NOTE:
Following our comprehensive analysis, we have arrived at the conclusion that
the data utilized in our analysis model does not exhibit a quadratic trend. This
implies that the relationship between variables might take on a quadratic
pattern in the future, but this pattern is not evident in the historical data used
for our analysis.
CHECKING STATIONARITY OF DATA:
> [Link](s$V1)
Augmented Dickey-Fuller Test
data: s$V1
Dickey-Fuller = -5.0572, Lag order = 3, p-value = 0.01
alternative hypothesis: stationary
As p-value is 0.01<0.05 , we reject null hypothesis.
Hence, our data is stationary .
Peaks above the confidence
limit in ACF plot suggest
positive autocorrelation i.e. past
values influence the future
values.
Conversely, troughs below the
confidence limit suggest the
negative autocorrelation.
MODEL FITTING :
1. ARIMA
> mymodel <- [Link](values)
> mymodel
Series: values
ARIMA(1,0,0) with non-zero mean
Coefficients:
ar1 mean
0.3129 285.9512
s.e. 0.1264 10.7192
sigma^2 = 3403: log likelihood = -328.14
AIC=662.28 AICc=662.71 BIC=668.57
> [Link](mymodel$resid, lag=5, type="Ljung-Box")
Box-Ljung test
data: mymodel$resid
X-squared = 8.2, df = 5, p-value = 0.1456
Looking at the lower p values, we can say that our model is relatively accurate,
and we can conclude that from the ARIMA model, that the parameters (1,0,0)
adequately fit the data.
FORECASTING
DAYWISE FORECASTING
Weekly Forecast
Week Values Forecast(Values) Lower Confidence Upper Confidence Bound(Values)
Bound(Values)
1 496.1144
2 799.5656
3 829.6524
4 739.8034
5 551.4682 551.4682 551.47 551.47
6 636.0331804 281.94 990.13
7 631.1572719 235.11 1027.20
8 626.2813634 192.17 1060.39
9 621.4054549 152.18 1090.63
10 616.5295464 114.51 1118.55
CONCLUSION:
1. Backward elimination removes fiscal order, order from traffic controller sector, banking order
1,2,3. Therefore, it is again confirmed that these are insignificant regressors. Therefore, The
model is
2. Total orders=6.654e-14 - 8.702e-16 (non urgent orders)-1.1994e-15(urgent orders)+1(order type
A)+order type B+ order type C
3. On checking the presence of various components of time series-Trend, Seasonalise
component,Cyclic Component, and Random Component, We find that there is an absence of
Trend, and Cyclic Component.
4. We find that our data consist of only random component and seasonalised component.
5. On checking the stationarity of the data, we find that our data is stationary.
6. On Looking at the lower p values, we can say that our model is relatively accurate, and we can
conclude that from the ARIMA model, that the parameters (1,0,0) adequately fit the data.
7. The weekly and day-wise forecasting of the data is shown.
THANK YOU !!!