Question

In: Statistics and Probability

- Create a plot of the variable "fortw" (fortified wine sales). - Create a plot of...

- Create a plot of the variable "fortw" (fortified wine sales).

- Create a plot of the ACF function for the same variable.

- create a naive and exponential smoothing forecast for the variable "fortw". makw sure to take into account the attricutes that yous aw fromthe above plots. make sure to produce plots with the actual data and forecasts overlaid (one graph per forecasting technique)

- Using the Mean Absolute Percentage Error (MAPE) measure of error, which of the forecasting techniques perform best?

- create a forecast for 1 period ahead (i.e. outside fo the sample).

- Compare the 1 period ahead forecasts for the 2 different basic forecasting techniques. Hint: the predict() functio will be helpful for the exponetial smoothing method.

Repeat the entirety of the above analysis but with the variable x.

Can someone aswer this Using R Script? What are the fuctions and steps to writing this script?

winet fortw dryw sweetw red rose spark
1 2585 1954 85 464 112 1686
2 3368 2302 89 675 118 1591
3 3210 3054 109 703 129 2304
4 3111 2414 95 887 99 1712
5 3756 2226 91 1139 116 1471
6 4216 2725 95 1077 168 1377
7 5225 2589 96 1318 118 1966
8 4426 3470 128 1260 129 2453
9 3932 2400 124 1120 205 1984
10 3816 3180 111 963 147 2596
11 3661 4009 178 996 150 4087
12 3795 3924 140 960 267 5179
13 2285 2072 150 530 126 1530
14 2934 2434 132 883 129 1523
15 2985 2956 155 894 124 1633
16 3646 2828 132 1045 97 1976
17 4198 2687 91 1199 102 1170
18 4935 2629 94 1287 127 1480
19 5618 3150 109 1565 222 1781
20 5454 4119 155 1577 214 2472
21 3624 3030 123 1076 118 1981
22 2898 3055 130 918 141 2273
23 3802 3821 150 1008 154 3857
24 2369 4001 163 1063 226 4551
25 2369 2529 101 544 89 1510
26 2511 2472 123 635 77 1329
27 3079 3134 127 804 82 1518
28 3728 2789 112 980 97 1790
29 4151 2758 108 1018 127 1537
30 4326 2993 116 1064 121 1449
31 5054 3282 153 1404 117 1954
32 5138 3437 163 1286 117 1897
33 3310 2804 128 1104 106 1706
34 3508 3076 142 999 112 2514
35 3790 3782 170 996 134 3593
36 3446 3889 214 1015 169 4524
37 2127 2271 134 615 75 1609
38 2523 2452 122 722 108 1638
39 3017 3084 142 832 115 2030
40 3265 2522 156 977 85 1375
41 3822 2769 145 1270 101 1320
42 4027 3438 169 1437 108 1245
43 4420 2839 134 1520 109 1600
44 5255 3746 165 1708 124 2298
45 4009 2632 156 1151 105 2191
46 3074 2851 111 934 95 2511
47 3465 3871 165 1159 135 3440
48 3718 3618 197 1209 164 4923
49 1954 2389 124 699 88 1609
50 2604 2344 124 830 85 1435
51 3626 2678 139 996 112 2061
52 2836 2492 137 1124 87 1789
53 4042 2858 127 1458 91 1567
54 3584 2246 134 1270 87 1404
55 4225 2800 136 1753 87 1597
56 4523 3869 171 2258 142 3159
57 2892 3007 112 1208 95 1759
58 2876 3023 110 1241 108 2504
59 3420 3907 147 1265 139 4273
60 3159 4209 196 1828 159 5274
61 2101 2353 112 809 61 1771
62 2181 2570 118 997 82 1682
63 2724 2903 125 1164 124 1846
64 2954 2910 122 1205 93 1589
65 4092 3782 120 1538 108 1896
66 3470 2759 118 1513 75 1379
67 3990 2931 281 1378 87 1645
68 4239 3641 344 2083 103 2512
69 2855 2794 366 1357 90 1771
70 2897 3070 362 1536 108 3727
71 3433 3576 580 1526 123 4388
72 3307 4106 523 1376 129 5434
73 1914 2452 348 779 57 1606
74 2214 2206 246 1005 65 1523
75 2320 2488 197 1193 67 1577
76 2714 2416 306 1522 71 1605
77 3633 2534 279 1539 76 1765
78 3295 2521 280 1546 67 1403
79 4377 3093 358 2116 110 2584
80 4442 3903 431 2326 118 3318
81 2774 2907 448 1596 99 1562
82 2840 3025 433 1356 85 2349
83 2828 3812 504 1553 107 3987
84 3758 4209 579 1613 141 5891
85 1610 2138 384 814 58 1389
86 1968 2419 335 1150 65 1442
87 2248 2622 320 1225 70 1548
88 3262 2912 496 1691 86 1935
89 3164 2708 448 1759 93 1518
90 2972 2798 377 1754 74 1250
91 4041 3254 523 2100 87 1847
92 3402 2895 468 2062 73 1930
93 2898 3263 428 2012 101 2638
94 2555 3736 520 1897 100 3114
95 3056 4077 493 1964 96 4405
96 3717 4097 662 2186 157 7242
97 1755 2175 304 966 63 1853
98 2193 3138 308 1549 115 1779
99 2198 2823 313 1538 70 2108
100 2777 2498 328 1612 66 2336
101 3076 2822 354 2078 67 1728
102 3389 2738 338 2137 83 1661
103 4231 4137 483 2907 79 2230
104 3118 3515 355 2249 77 1645
105 2524 3785 439 1883 102 2421
106 2280 3632 290 1739 116 3740
107 2862 4504 352 1828 100 4988
108 3502 4451 454 1868 135 6757
109 1558 2550 306 1138 71 1757
110 1940 2867 303 1430 60 1394
111 2226 3458 344 1809 89 1982
112 2676 2961 254 1763 74 1650
113 3145 3163 309 2200 73 1654
114 3224 2880 310 2067 91 1406
115 4117 3331 379 2503 86 1971
116 3446 3062 294 2141 74 1968
117 2482 3534 356 2103 87 2608
118 2349 3622 318 1972 87 3845
119 2986 4464 405 2181 109 4514
120 3163 5411 545 2344 137 6694
121 1651 2564 268 970 43 1720
122 1725 2820 243 1199 69 1321
123 2622 3508 273 1718 73 1859
124 2316 3088 273 1683 77 1628
125 2976 3299 236 2025 69 1615
126 3263 2939 222 2051 76 1457
127 3951 3320 302 2439 78 1899
128 2917 3418 285 2353 70 1605
129 2380 3604 309 2230 83 2424
130 2458 3495 322 1852 65 3116
131 2883 4163 362 2147 110 4286
132 2579 4882 471 2286 132 6047
133 1330 2211 198 1007 54 1902
134 1686 3260 253 1665 55 2049
135 2457 2992 173 1642 66 1874
136 2514 2425 186 1518 65 1279
137 2834 2707 185 1831 60 1432
138 2757 3244 105 2207 65 1540
139 3425 3965 228 2822 96 2214
140 3006 3315 214 2393 55 1857
141 2369 3333 189 2306 71 2408
142 2017 3583 270 1785 63 3252
143 2507 4021 277 2047 74 3627
144 3168 4904 378 2171 106 6153
145 1545 2252 185 1212 34 1577
146 1643 2952 182 1335 47 1667
147 2112 3573 258 2011 56 1993
148 2415 3048 179 1860 53 1997
149 2862 3059 197 1954 53 1783
150 2822 2731 168 2152 55 1625
151 3260 3563 250 2835 67 2076
152 2606 3092 211 2224 52 1773
153 2264 3478 260 2182 46 2377
154 2250 3478 234 1992 51 3088
155 2545 4308 305 2389 58 4096
156 2856 5029 347 2724 91 6119
157 1208 2075 203 891 33 1494
158 1412 3264 217 1247 40 1564
159 1964 3308 227 2017 46 1898
160 2018 3688 242 2257 45 2121
161 2329 3136 185 2255 41 1831
162 2660 2824 175 2255 55 1515
163 2923 3644 252 3057 57 2048
164 2626 4694 319 3330 54 2795
165 2132 2914 202 1896 46 1749
166 1772 3686 254 2096 52 3339
167 2526 4358 336 2374 48 4227
168 2755 5587 431 2535 77 6410
169 1154 2265 150 1041 30 1197
170 1568 3685 280 1728 35 1968
171 1965 3754 187 2201 42 1720
172 2659 3708 279 2455 48 1725
173 2354 3210 193 2204 44 1674
174 2592 3517 227 2660 45 1693
175 2714 3905 225 3670 46 2031
176 2294 3670 205 2665 44 1495
177 2416 4221 259 2639 46 2968
178 2016 4404 254 2226 51 3385
179 2799 5086 275 2586 63 3729
180 2467 5725 394 2684 84 5999
181 1153 2367 159 1185 30 1070
182 1482 3819 230 1749 39 1402
183 1818 4067 188 2459 45 1897
184 2262 4022 195 2618 52 1862
185 2612 3937 189 2585 28 1670
186 2967 4365 220 3310 40 1688
187 3179 4290 274 3923 62 2031

Solutions

Expert Solution

solving first 4

use library forecast using

library(forecast)

load the data in t1

convert to time series using

t<-ts(t1$fortw)

plot t using

plot(t)

we see a downward trend in the time series so we try to detrend usingfirst differece

t.d<-diff(t)

plotting we get

now acf

acf(t.d)

now we create the models

for nsive we use rwf

m1<-rwf(t.d)
plot(forecast(m1))

for smoothing we use
m2<-HoltWinters(t.d , beta = F, gamma=F)
plot(forecast(m2))

from summary we get the MAPE

for naive we have:

infinity

this is due to a zero record in the t.d (differenced variable)

so we remove this and calulate MAPE maually

t.d<-t.d[-24]
m2.fitted<-m2$fitted[,1][-24]
m1.fitted<-m1$fitted[-24]
mape_exp<-(100/185)*sum((abs(m2.fitted-t.d[2:185])/t.d[2:185]))
mape_naive<-(100/187)*sum((abs(m1.fitted[2:185]-t.d[2:185])/t.d[2:185]))

we have naive mape ~ 81

exponential mape: 16

so exponential is better as it is lower


Related Solutions

So the problem is to create a plot of points and plot them using only 'o'...
So the problem is to create a plot of points and plot them using only 'o' and no lines then using the polyfit and polyval functions, find a first order equation to curve fit the points (and plot it on the existing plot). I got that part and have the following code clear clc %define measured data temp = [250 300 340 400 460 500 540 600 660 700 750 810 930 1000 1120] HC= [.791 .846 .895 .939 .978...
Which variable should be the dependent variable and which should be the independent variable? Why? Plot...
Which variable should be the dependent variable and which should be the independent variable? Why? Plot the points on the scatterplot graph. NOTE: In a scatterplot the x axis will always reflect 1, 2, 3… not the Quarters specifically. Label both axes with words. In order to analyze the data we will use the line of best fit. Answer with 1-3 complete sentences. Does the line seem to fit the data? Why? Calculate the following use excel trendline: y-intercept to...
1. What types of foods are fortified? Give an example. 2. In order for fortified foods...
1. What types of foods are fortified? Give an example. 2. In order for fortified foods to have their intended impact, what conditions are required? 3. Do consumers need to be aware that a food is fortified in order to receive benefits? 4. Are fortified foods necessarily good for us? Give an example of a fortified food that could also be high in added sugars, saturated fat, and sodium 5. Do you think food fortification is still necessary in the...
1. What types of foods are fortified? Give an example. 2. In order for fortified foods...
1. What types of foods are fortified? Give an example. 2. In order for fortified foods to have their intended impact, what things are necessary? 3. Do consumers need to be aware that a food is fortified in order to receive benefits? 4. Are fortified foods necessarily good for us? Give an example of a fortified food that could also be high in added sugars, saturated fat, and sodium 5. Do you think food fortification is still necessary in the...
Create a histogram of this data with 15 bins. Create a box plot of this data.
7, 9, 8, 11, 14, 7, 11, 17, 18, 12, 10, 9, 16, 17, 15, 13, 7, 12, 7, 8, 14, 16, 20, 12, 11, 14, 22, 8, 10, 14, 15, 20, 17, 14, 12, 22, 12, 15, 17, 16, 9, 11, 16, 18, 11, 12, 11, 9, 11, 9, 13, 7, 12, 9, 19, 9, 8, 15, 12, 16, 16, 20, 21, 9, 11, 17, 17, 8, 11, 7, 10, 17, 13, 15, 14, 11, 19,10, 11, 11, 9,...
How do you create the dot plot?
How do you create the dot plot?
Sandhill Bottle Shop has two divisions, Wine and Beer. The sales mix is 70% Wine and...
Sandhill Bottle Shop has two divisions, Wine and Beer. The sales mix is 70% Wine and 30% Beer. Sandhill’s annual fixed costs are estimated at $342000. The average selling price in the Wine division is $45 with a variable cost of $18. The average selling price in the Beer division is $18 with a variable cost of $9. What is Sandhill’s sales revenue at the break-even point? a. $194940 b. $600000 c. $942000 d. $342000
v Create a graph (either a histogram, box plot or stem and leaf plot … pick...
v Create a graph (either a histogram, box plot or stem and leaf plot … pick just one). Your graph could have either 5, 6 or 7 classes, depending on how you set it up. Create a table and list the class boundaries and the frequency in each class. You must explain to me in detail if you used fewer than 5 classes or more than 7 classes.
a. Develop a scatter plot with income as the dependent variable and age as the independent...
a. Develop a scatter plot with income as the dependent variable and age as the independent variable. Include the estimated regression equation and the coefficient of determination on your scatter plot. Briefly comment on the relationship between the two variables, and fully interpret the coefficient of determination. b. Using the Excel’s Regression Tool, develop the estimated regression equation to show how income (y annual income in $1000s) is related to the independent variables education (?_1level of education attained in number...
Sales Tax: If the purchase price of a bottle of California wine is $24 and the...
Sales Tax: If the purchase price of a bottle of California wine is $24 and the sales tax is $1.50, what is the sales tax rate? The sales tax rate is %. A tire salesperson has a 14% commission rate. If he sells a set of radial tires for $800, what is his commission? His commission is $. If an appliance salesperson gets 7% commission on all the appliances she sells, what is the price of a refrigerator if her...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT