Professional Documents
Culture Documents
tugas pertemuan
tugas pertemuan
NIM : 223303010255
KELAS : Semester 4 Pagi B
Tugas:
1. Coba buat SSE, dari alpha
Alpha1=0,12
a 81.90525
Alpha2= 0,14
a 81.73084
Alpha3= 0,16
a 81.53147
Jadi nilai error yang paling kecil adalah 0,14 yang terdapat d nomor 2
Console
> ##instal packages untuk melakukan pengolahan forecasting
> install.packages("forecast")
WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of
Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/user/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository
https://cran.rstudio.com/src/contrib:
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
package ‘forecast’ is not available for this version of R
A version of this package for your version of R might be available
elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-
admin.html#Installing-packages
Warning in install.packages :
unable to access index for repository
https://cran.rstudio.com/bin/windows/contrib/4.4:
cannot open URL
'https://cran.rstudio.com/bin/windows/contrib/4.4/PACKAGES'
> install.packages("readxl")##untuk memanggil data versi XL
WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of
Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/user/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository
https://cran.rstudio.com/src/contrib:
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
package ‘readxl’ is not available for this version of R
A version of this package for your version of R might be available
elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-
admin.html#Installing-packages
Warning in install.packages :
unable to access index for repository
https://cran.rstudio.com/bin/windows/contrib/4.4:
cannot open URL
'https://cran.rstudio.com/bin/windows/contrib/4.4/PACKAGES'
> ##Memanggil packages yg sudah diinstal
> library("forecast")
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
This is forecast 8.22.0
Want to meet other forecasters? Join the International Institute of
Forecasters:
http://forecasters.org/
> library("readxl")
> ##Memanggil data yang diperlukan
> library(readxl)
> data_jual_adi <- read_excel("C:/Users/user/Downloads/data jual
adi.xlsx")
> View(data_jual_adi)
> ###### ANALISIS DATA #####
> ## membuat data ke dalam bentuk time series
> data.adi<-ts(data_jual_adi)
> data.adi
Time Series:
Start = 1
End = 170
Frequency = 1
Penjualan
[1,] 64
[2,] 84
[3,] 62
[4,] 66
[5,] 87
[6,] 70
[7,] 69
[8,] 100
[9,] 73
[10,] 69
[11,] 61
[12,] 80
[13,] 67
[14,] 87
[15,] 91
[16,] 98
[17,] 89
[18,] 89
[19,] 65
[20,] 96
[21,] 89
[22,] 74
[23,] 67
[24,] 87
[25,] 85
[26,] 79
[27,] 87
[28,] 87
[29,] 71
[30,] 96
[31,] 92
[32,] 69
[33,] 65
[34,] 96
[35,] 60
[36,] 64
[37,] 85
[38,] 76
[39,] 77
[40,] 83
[41,] 70
[42,] 86
[43,] 86
[44,] 98
[45,] 70
[46,] 79
[47,] 81
[48,] 64
[49,] 70
[50,] 92
[51,] 95
[52,] 62
[53,] 98
[54,] 91
[55,] 75
[56,] 61
[57,] 61
[58,] 60
[59,] 83
[60,] 78
[61,] 74
[62,] 69
[63,] 76
[64,] 89
[65,] 74
[66,] 87
[67,] 71
[68,] 66
[69,] 61
[70,] 87
[71,] 98
[72,] 71
[73,] 82
[74,] 87
[75,] 87
[76,] 92
[77,] 74
[78,] 68
[79,] 93
[80,] 87
[81,] 91
[82,] 81
[83,] 97
[84,] 99
[85,] 87
[86,] 92
[87,] 96
[88,] 78
[89,] 77
[90,] 98
[91,] 68
[92,] 97
[93,] 75
[94,] 70
[95,] 77
[96,] 61
[97,] 63
[98,] 61
[99,] 66
[100,] 67
[101,] 60
[102,] 73
[103,] 100
[104,] 60
[105,] 60
[106,] 94
[107,] 83
[108,] 88
[109,] 96
[110,] 66
[111,] 89
[112,] 97
[113,] 76
[114,] 91
[115,] 93
[116,] 98
[117,] 65
[118,] 68
[119,] 64
[120,] 70
[121,] 60
[122,] 99
[123,] 94
[124,] 80
[125,] 95
[126,] 71
[127,] 99
[128,] 91
[129,] 87
[130,] 61
[131,] 64
[132,] 94
[133,] 82
[134,] 98
[135,] 62
[136,] 92
[137,] 84
[138,] 65
[139,] 100
[140,] 64
[141,] 80
[142,] 74
[143,] 80
[144,] 96
[145,] 86
[146,] 91
[147,] 61
[148,] 97
[149,] 83
[150,] 79
[151,] 63
[152,] 87
[153,] 78
[154,] 80
[155,] 81
[156,] 61
[157,] 97
[158,] 85
[159,] 89
[160,] 97
[161,] 94
[162,] 94
[163,] 91
[164,] 64
[165,] 87
[166,] 68
[167,] 84
[168,] 88
[169,] 77
[170,] 78
> ## membuat plot time series
> ts.plot(data.adi, xlab="Periode", ylab="Jumlah Penjualan", main=
"Time Series Data Penjualan")
> points (data.adi)
> ## pemulusan data dengan fungsi Holtwinters
> ## alpha 0.16##
> # pemulusan
> ses2 <- HoltWinters(data.adi, alpha= 0.16, beta= F, gamma= F)
> ses2
Holt-Winters exponential smoothing without trend and without seasonal
component.
Call:
HoltWinters(x = data.adi, alpha = 0.16, beta = F, gamma = F)
Smoothing parameters:
alpha: 0.16
beta : FALSE
gamma: FALSE
Coefficients:
[,1]
a 81.53147
> ses2fit <- fitted(ses2)
> ses2fit # melihat hasil pemulusan
Time Series:
Start = 2
End = 170
Frequency = 1
xhat level
2 64.00000 64.00000
3 67.20000 67.20000
4 66.36800 66.36800
5 66.30912 66.30912
6 69.61966 69.61966
7 69.68052 69.68052
8 69.57163 69.57163
9 74.44017 74.44017
10 74.20974 74.20974
11 73.37618 73.37618
12 71.39600 71.39600
13 72.77264 72.77264
14 71.84901 71.84901
15 74.27317 74.27317
16 76.94946 76.94946
17 80.31755 80.31755
18 81.70674 81.70674
19 82.87366 82.87366
20 80.01388 80.01388
21 82.57166 82.57166
22 83.60019 83.60019
23 82.06416 82.06416
24 79.65390 79.65390
25 80.82927 80.82927
26 81.49659 81.49659
27 81.09713 81.09713
28 82.04159 82.04159
29 82.83494 82.83494
30 80.94135 80.94135
31 83.35073 83.35073
32 84.73462 84.73462
33 82.21708 82.21708
34 79.46234 79.46234
35 82.10837 82.10837
36 78.57103 78.57103
37 76.23967 76.23967
38 77.64132 77.64132
39 77.37871 77.37871
40 77.31811 77.31811
41 78.22722 78.22722
42 76.91086 76.91086
43 78.36512 78.36512
44 79.58670 79.58670
45 82.53283 82.53283
46 80.52758 80.52758
47 80.28317 80.28317
48 80.39786 80.39786
49 77.77420 77.77420
50 76.53033 76.53033
51 79.00548 79.00548
52 81.56460 81.56460
53 78.43426 78.43426
54 81.56478 81.56478
55 83.07442 83.07442
56 81.78251 81.78251
57 78.45731 78.45731
58 75.66414 75.66414
59 73.15788 73.15788
60 74.73262 74.73262
61 75.25540 75.25540
62 75.05453 75.05453
63 74.08581 74.08581
64 74.39208 74.39208
65 76.72935 76.72935
66 76.29265 76.29265
67 78.00583 78.00583
68 76.88489 76.88489
69 75.14331 75.14331
70 72.88038 72.88038
71 75.13952 75.13952
72 78.79720 78.79720
73 77.54965 77.54965
74 78.26170 78.26170
75 79.65983 79.65983
76 80.83426 80.83426
77 82.62078 82.62078
78 81.24145 81.24145
79 79.12282 79.12282
80 81.34317 81.34317
81 82.24826 82.24826
82 83.64854 83.64854
83 83.22477 83.22477
84 85.42881 85.42881
85 87.60020 87.60020
86 87.50417 87.50417
87 88.22350 88.22350
88 89.46774 89.46774
89 87.63290 87.63290
90 85.93164 85.93164
91 87.86258 87.86258
92 84.68456 84.68456
93 86.65503 86.65503
94 84.79023 84.79023
95 82.42379 82.42379
96 81.55599 81.55599
97 78.26703 78.26703
98 75.82430 75.82430
99 73.45241 73.45241
100 72.26003 72.26003
101 71.41842 71.41842
102 69.59148 69.59148
103 70.13684 70.13684
104 74.91495 74.91495
105 72.52855 72.52855
106 70.52399 70.52399
107 74.28015 74.28015
108 75.67532 75.67532
109 77.64727 77.64727
110 80.58371 80.58371
111 78.25032 78.25032
112 79.97026 79.97026
113 82.69502 82.69502
114 81.62382 81.62382
115 83.12401 83.12401
116 84.70417 84.70417
117 86.83150 86.83150
118 83.33846 83.33846
119 80.88431 80.88431
120 78.18282 78.18282
121 76.87357 76.87357
122 74.17380 74.17380
123 78.14599 78.14599
124 80.68263 80.68263
125 80.57341 80.57341
126 82.88166 82.88166
127 80.98060 80.98060
128 83.86370 83.86370
129 85.00551 85.00551
130 85.32463 85.32463
131 81.43269 81.43269
132 78.64346 78.64346
133 81.10050 81.10050
134 81.24442 81.24442
135 83.92532 83.92532
136 80.41727 80.41727
137 82.27050 82.27050
138 82.54722 82.54722
139 79.73967 79.73967
140 82.98132 82.98132
141 79.94431 79.94431
142 79.95322 79.95322
143 79.00070 79.00070
144 79.16059 79.16059
145 81.85490 81.85490
146 82.51811 82.51811
147 83.87522 83.87522
148 80.21518 80.21518
149 82.90075 82.90075
150 82.91663 82.91663
151 82.28997 82.28997
152 79.20358 79.20358
153 80.45100 80.45100
154 80.05884 80.05884
155 80.04943 80.04943
156 80.20152 80.20152
157 77.12928 77.12928
158 80.30859 80.30859
159 81.05922 81.05922
160 82.32974 82.32974
161 84.67698 84.67698
162 86.16867 86.16867
163 87.42168 87.42168
164 87.99421 87.99421
165 84.15514 84.15514
166 84.61032 84.61032
167 81.95266 81.95266
168 82.28024 82.28024
169 83.19540 83.19540
170 82.20414 82.20414
> #peramalan
> ramal2 <- forecast(ses2, h=5) #h=periode ramalan
> df2ramal <- data.frame(ramal2) # memasukkan ke dalam frame
> df2ramal#print hasil frame
Point.Forecast Lo.80 Hi.80 Lo.95 Hi.95
171 81.53147 64.89296 98.16999 56.08506 106.9779
172 81.53147 64.68133 98.38162 55.76140 107.3015
173 81.53147 64.47233 98.59062 55.44176 107.6212
174 81.53147 64.26585 98.79710 55.12599 107.9370
175 81.53147 64.06182 99.00113 54.81395 108.2490
> ## membuat plot time series
> ts.plot(data.adi, xlab="Periode", ylab="Jumlah Penjualan", main=
"Time Series Data Penjualan")
> points (data.adi)
>
>
> # Membuat plot gabungan dari data aktual, pemulusan, dan ramalan
> plot(1:length(data.ses[, "aktual"]), data.ses[, "aktual"], type="l",
col="black", xlab="Periode", ylab="Penjualan", main="Time Series Data
Penjualan")
Error: object 'data.ses' not found
> ## menggabungkan data aktual,pemulusan data ramalan##
> #dari data aktual kita sediakan 5 baris akhir dengan nilai NA
> #dari pemulihan kita ambil dari kolom 1 (xhat)
> #dari ramalan kita ambil kolom 1 (point.forecast)
> data.ses <- cbind(aktual = c (data.adi,rep(NA,5)),
+ pemulusan = c(NA,ses2fit[,1],
+ rep(NA,5)),
+ ramalan = c(NA ,
ses2fit[,1],df2ramal$point.Forecast))
Warning message:
In cbind(aktual = c(data.adi, rep(NA, 5)), pemulusan = c(NA, ses2fit[,
:
number of rows of result is not a multiple of vector length (arg 3)
> data.ses
aktual pemulusan ramalan
[1,] 64 NA NA
[2,] 84 64.00000 64.00000
[3,] 62 67.20000 67.20000
[4,] 66 66.36800 66.36800
[5,] 87 66.30912 66.30912
[6,] 70 69.61966 69.61966
[7,] 69 69.68052 69.68052
[8,] 100 69.57163 69.57163
[9,] 73 74.44017 74.44017
[10,] 69 74.20974 74.20974
[11,] 61 73.37618 73.37618
[12,] 80 71.39600 71.39600
[13,] 67 72.77264 72.77264
[14,] 87 71.84901 71.84901
[15,] 91 74.27317 74.27317
[16,] 98 76.94946 76.94946
[17,] 89 80.31755 80.31755
[18,] 89 81.70674 81.70674
[19,] 65 82.87366 82.87366
[20,] 96 80.01388 80.01388
[21,] 89 82.57166 82.57166
[22,] 74 83.60019 83.60019
[23,] 67 82.06416 82.06416
[24,] 87 79.65390 79.65390
[25,] 85 80.82927 80.82927
[26,] 79 81.49659 81.49659
[27,] 87 81.09713 81.09713
[28,] 87 82.04159 82.04159
[29,] 71 82.83494 82.83494
[30,] 96 80.94135 80.94135
[31,] 92 83.35073 83.35073
[32,] 69 84.73462 84.73462
[33,] 65 82.21708 82.21708
[34,] 96 79.46234 79.46234
[35,] 60 82.10837 82.10837
[36,] 64 78.57103 78.57103
[37,] 85 76.23967 76.23967
[38,] 76 77.64132 77.64132
[39,] 77 77.37871 77.37871
[40,] 83 77.31811 77.31811
[41,] 70 78.22722 78.22722
[42,] 86 76.91086 76.91086
[43,] 86 78.36512 78.36512
[44,] 98 79.58670 79.58670
[45,] 70 82.53283 82.53283
[46,] 79 80.52758 80.52758
[47,] 81 80.28317 80.28317
[48,] 64 80.39786 80.39786
[49,] 70 77.77420 77.77420
[50,] 92 76.53033 76.53033
[51,] 95 79.00548 79.00548
[52,] 62 81.56460 81.56460
[53,] 98 78.43426 78.43426
[54,] 91 81.56478 81.56478
[55,] 75 83.07442 83.07442
[56,] 61 81.78251 81.78251
[57,] 61 78.45731 78.45731
[58,] 60 75.66414 75.66414
[59,] 83 73.15788 73.15788
[60,] 78 74.73262 74.73262
[61,] 74 75.25540 75.25540
[62,] 69 75.05453 75.05453
[63,] 76 74.08581 74.08581
[64,] 89 74.39208 74.39208
[65,] 74 76.72935 76.72935
[66,] 87 76.29265 76.29265
[67,] 71 78.00583 78.00583
[68,] 66 76.88489 76.88489
[69,] 61 75.14331 75.14331
[70,] 87 72.88038 72.88038
[71,] 98 75.13952 75.13952
[72,] 71 78.79720 78.79720
[73,] 82 77.54965 77.54965
[74,] 87 78.26170 78.26170
[75,] 87 79.65983 79.65983
[76,] 92 80.83426 80.83426
[77,] 74 82.62078 82.62078
[78,] 68 81.24145 81.24145
[79,] 93 79.12282 79.12282
[80,] 87 81.34317 81.34317
[81,] 91 82.24826 82.24826
[82,] 81 83.64854 83.64854
[83,] 97 83.22477 83.22477
[84,] 99 85.42881 85.42881
[85,] 87 87.60020 87.60020
[86,] 92 87.50417 87.50417
[87,] 96 88.22350 88.22350
[88,] 78 89.46774 89.46774
[89,] 77 87.63290 87.63290
[90,] 98 85.93164 85.93164
[91,] 68 87.86258 87.86258
[92,] 97 84.68456 84.68456
[93,] 75 86.65503 86.65503
[94,] 70 84.79023 84.79023
[95,] 77 82.42379 82.42379
[96,] 61 81.55599 81.55599
[97,] 63 78.26703 78.26703
[98,] 61 75.82430 75.82430
[99,] 66 73.45241 73.45241
[100,] 67 72.26003 72.26003
[101,] 60 71.41842 71.41842
[102,] 73 69.59148 69.59148
[103,] 100 70.13684 70.13684
[104,] 60 74.91495 74.91495
[105,] 60 72.52855 72.52855
[106,] 94 70.52399 70.52399
[107,] 83 74.28015 74.28015
[108,] 88 75.67532 75.67532
[109,] 96 77.64727 77.64727
[110,] 66 80.58371 80.58371
[111,] 89 78.25032 78.25032
[112,] 97 79.97026 79.97026
[113,] 76 82.69502 82.69502
[114,] 91 81.62382 81.62382
[115,] 93 83.12401 83.12401
[116,] 98 84.70417 84.70417
[117,] 65 86.83150 86.83150
[118,] 68 83.33846 83.33846
[119,] 64 80.88431 80.88431
[120,] 70 78.18282 78.18282
[121,] 60 76.87357 76.87357
[122,] 99 74.17380 74.17380
[123,] 94 78.14599 78.14599
[124,] 80 80.68263 80.68263
[125,] 95 80.57341 80.57341
[126,] 71 82.88166 82.88166
[127,] 99 80.98060 80.98060
[128,] 91 83.86370 83.86370
[129,] 87 85.00551 85.00551
[130,] 61 85.32463 85.32463
[131,] 64 81.43269 81.43269
[132,] 94 78.64346 78.64346
[133,] 82 81.10050 81.10050
[134,] 98 81.24442 81.24442
[135,] 62 83.92532 83.92532
[136,] 92 80.41727 80.41727
[137,] 84 82.27050 82.27050
[138,] 65 82.54722 82.54722
[139,] 100 79.73967 79.73967
[140,] 64 82.98132 82.98132
[141,] 80 79.94431 79.94431
[142,] 74 79.95322 79.95322
[143,] 80 79.00070 79.00070
[144,] 96 79.16059 79.16059
[145,] 86 81.85490 81.85490
[146,] 91 82.51811 82.51811
[147,] 61 83.87522 83.87522
[148,] 97 80.21518 80.21518
[149,] 83 82.90075 82.90075
[150,] 79 82.91663 82.91663
[151,] 63 82.28997 82.28997
[152,] 87 79.20358 79.20358
[153,] 78 80.45100 80.45100
[154,] 80 80.05884 80.05884
[155,] 81 80.04943 80.04943
[156,] 61 80.20152 80.20152
[157,] 97 77.12928 77.12928
[158,] 85 80.30859 80.30859
[159,] 89 81.05922 81.05922
[160,] 97 82.32974 82.32974
[161,] 94 84.67698 84.67698
[162,] 94 86.16867 86.16867
[163,] 91 87.42168 87.42168
[164,] 64 87.99421 87.99421
[165,] 87 84.15514 84.15514
[166,] 68 84.61032 84.61032
[167,] 84 81.95266 81.95266
[168,] 88 82.28024 82.28024
[169,] 77 83.19540 83.19540
[170,] 78 82.20414 82.20414
[171,] NA NA NA
[172,] NA NA 64.00000
[173,] NA NA 67.20000
[174,] NA NA 66.36800
[175,] NA NA 66.30912
> ## membuat plot time series
> ts.plot(data.adi, xlab="Periode", ylab="Jumlah Penjualan", main=
"Time Series Data Penjualan")
> points (data.adi)
>
>
> # Membuat plot gabungan dari data aktual, pemulusan, dan ramalan
> plot(1:length(data.ses[, "aktual"]), data.ses[, "aktual"], type="l",
col="black", xlab="Periode", ylab="Penjualan", main="Time Series Data
Penjualan")
> lines(1:length(data.ses[, "pemulusan"]), data.ses[, "pemulusan"],
col="green", lty=2)
> lines(1:length(data.ses[, "ramalan"]), data.ses[, "ramalan"],
col="red", lty=2)
>
> # Menambahkan legenda
> legend("topleft", legend=c("Data Aktual", "Pemulusan", "Ramalan"),
col=c("black", "green", "red"), lty=1:2)
> ##Menghitung Nilai keakuratan MAD,MSE, MAPE
> ##nilai error
> error.ses <- data.ses[,1] - data.ses[,3]
> error.ses
[1] NA 20.00000000 -5.20000000 -0.36800000 20.69088000
0.38033920
[7] -0.68051507 30.42836734 -1.44017143 -5.20974401 -12.37618496
8.60400463
[13] -5.77263611 15.15098567 16.72682796 21.05053549 8.68244981
7.29325784
[19] -17.87366341 15.98612273 6.42834309 -9.60019180 -15.06416111
7.34610467
[25] 4.17072792 -2.49658855 5.90286562 4.95840712 -11.83493802
15.05865206
[31] 8.64926773 -15.73461510 -17.21707669 16.53765558 -22.10836931
-14.57103022
[37] 8.76033461 -1.64131892 -0.37870790 5.68188537 -8.22721629
9.08913832
[43] 7.63487618 18.41329600 -12.53283136 -1.52757835 0.71683419
-16.39785928
[49] -7.77420180 15.46967049 15.99452321 -19.56460050 19.56573558
9.43521789
[55] -8.07441698 -20.78251026 -17.45730862 -15.66413924 9.84212304
3.26738335
[61] -1.25539798 -6.05453431 1.91419118 14.60792059 -2.72934670
10.70734877
[67] -7.00582703 -10.88489471 -14.14331155 14.11961829 22.86047937
-7.79719733
[73] 4.45035424 8.73829756 7.34016995 11.16574276 -8.62077608
-13.24145191
[79] 13.87718040 5.65683153 8.75173849 -2.64853967 13.77522668
13.57119041
[85] -0.60020006 4.49583195 7.77649884 -11.46774097 -10.63290242
12.06836197
[91] -19.86257595 12.31543620 -11.65503359 -14.79022821 -5.42379170
-20.55598503
[97] -15.26702742 -14.82430304 -7.45241455 -5.26002822 -11.41842371
3.40852409
[103] 29.86316023 -14.91494540 -12.52855414 23.47601452 8.71985220
12.32467585
[109] 18.35272771 -14.58370872 10.74968467 17.02973513 -6.69502249
9.37618110
[115] 9.87599213 13.29583339 -21.83149995 -15.33845996 -16.88430637
-8.18281735
[121] -16.87356657 24.82620408 15.85401143 -0.68263040 14.42659046
-11.88166401
[127] 18.01940223 7.13629787 1.99449021 -24.32462822 -17.43268771
15.35654233
[133] 0.89949556 16.75557627 -21.92531594 11.58273461 1.72949708
-17.54722246
[139] 20.26033314 -18.98132017 0.05569106 -5.95321951 0.99929561
16.83940831
[145] 4.14510298 8.48188651 -22.87521533 16.78481912 0.09924806
-3.91663163
[151] -19.28997057 7.79642472 -2.45100323 -0.05884272 0.95057212
-19.20151942
[157] 19.87072369 4.69140790 7.94078263 14.67025741 9.32301623
7.83133363
[163] 3.57832025 -23.99421099 2.84486277 -16.61031528 2.04733517
5.71976154
[169] -6.19540030 -4.20413626 NA NA NA
NA
[175] NA
>
> #MAD: mean absolute deviation
> mad.ses <- mean(abs(error.ses), na.rm = T)
> mad.ses
[1] 11.02139
>
> #MSE: MEAN SQUARED ERROR
> mse.ses <- mean(error.ses^2,na.rm= T)
> mse.ses
[1] 167.984
>
> ## MAPE
> r.error.ses <-(error.ses/data.ses[,1])*100 # relative error
> mape.ses <- mean(abs(r.error.ses), na.rm = T)
> mape.ses
[1] 14.22748
>
> #masukkan hasil ke dalam frame
> data.frame("ukuran keakuratan" = c("MAD","MSE", "MAPE"),
+ "Nilai" = c(mad.ses,mse.ses,mape.ses))
ukuran.keakuratan Nilai
1 MAD 11.02139
2 MSE 167.98399
3 MAPE 14.22748