summaryrefslogtreecommitdiff
path: root/331/CH10/EX10.6
diff options
context:
space:
mode:
Diffstat (limited to '331/CH10/EX10.6')
-rwxr-xr-x331/CH10/EX10.6/Example_10_6.sce51
1 files changed, 51 insertions, 0 deletions
diff --git a/331/CH10/EX10.6/Example_10_6.sce b/331/CH10/EX10.6/Example_10_6.sce
new file mode 100755
index 000000000..29f4ebd59
--- /dev/null
+++ b/331/CH10/EX10.6/Example_10_6.sce
@@ -0,0 +1,51 @@
+//Caption:Weighted Moving Average Method
+//Example10.6
+//Page383
+clear;
+clc;
+Dt = [80,90,70,100,70,90];//Demand of a product
+t = length(Dt);// months
+W = [0.2,0.3,0.5];//weights
+//Three months weighted moving averages
+for i = 3:t
+ Wt(i-2) = W*Dt([(i-2):i])' ;
+ WtMA(i-2) = Wt(i-2)/sum(W)
+end
+disp(WtMA,'Three Months weighted moving average Mt=')
+for i = 1:length(Wt)-1
+ Ft(i) = WtMA(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 weighted moving average Mt=
+//
+// 78.
+// 89.
+// 79.
+// 86.
+//
+// Forecast Ft=
+//
+// 78.
+// 89.
+// 79.
+//
+// Error et=
+//
+// 22.
+// - 19.
+// 11.
+//
+// Mean Absolute Deviation MAD=
+//
+// 17.333333
+//
+// Mean Forecast Error MFE=
+//
+// 4.6666667 \ No newline at end of file