summaryrefslogtreecommitdiff
path: root/331/CH10/EX10.5/Example_10_5.sce
diff options
context:
space:
mode:
Diffstat (limited to '331/CH10/EX10.5/Example_10_5.sce')
-rwxr-xr-x331/CH10/EX10.5/Example_10_5.sce56
1 files changed, 56 insertions, 0 deletions
diff --git a/331/CH10/EX10.5/Example_10_5.sce b/331/CH10/EX10.5/Example_10_5.sce
new file mode 100755
index 000000000..5bc572925
--- /dev/null
+++ b/331/CH10/EX10.5/Example_10_5.sce
@@ -0,0 +1,56 @@
+//Caption: Forecasting
+//Simple Moving Average Method
+//Example10.5
+//Page381
+clear;
+clc;
+Dt = [24,30,27,24,39,45,42,51];//Demand Di
+n = length(Dt);//Month (t)
+//Three months moving average
+for i = 3:n
+ Mt(i-2) = mean(Dt([(i-2):i]));
+end
+disp(Mt,'Three Months moving average Mt=')
+for i = 1:length(Mt)-1
+ Ft(i) = Mt(i);
+ et(i) = Dt(i+3)-Ft(i);
+end
+disp(Ft,'Forecast Ft=')
+disp(et,'Error et=')
+MAD = sum(abs(et(:)))/length(et);
+disp(MAD,'Mean Absolute Deviation MAD=')
+MFE = sum(et(:))/length(et);
+disp(MFE,'Mean Forecast Error MFE=')
+//Result
+// Three Months moving average Mt=
+//
+// 27.
+// 27.
+// 30.
+// 36.
+// 42.
+// 46.
+//
+// Forecast Ft=
+//
+// 27.
+// 27.
+// 30.
+// 36.
+// 42.
+//
+// Error et=
+//
+// - 3.
+// 12.
+// 15.
+// 6.
+// 9.
+//
+// Mean Absolute Deviation MAD=
+//
+// 9.
+//
+// Mean Forecast Error MFE=
+//
+// 7.8