#### 您當前位置：首頁 >> Web作業Web作業

###### 日期：2019-10-08 07:21

Last name ________________ First name___________ Section number (40 or 60)_______

Home Work 1 Total marks are 10 which provide 10% to the total assessment. Students must

implement the homework using R language, cut-and-paste of outputs from text book are not

permitted (and easily detectable).

The Steps of this homework should be implemented using RStudio and printouts inserted in this

document after each step.

Forecaster toolbox

Step 1 Create a directory on your computer where the home work will be implemented. That means all

input files should be placed there and R will create the output files in this directory.

Step 2 Open R-studio. In the command prompt select “Session” then “Set working directory” and

“Choose directory”. Using the command prompt with file manager select the directory you created

in Step 1.

Step 3 Install fpp2 library if it is not installed yet and connect this library by command library(‘fpp2’). Do

the same for fpp if you use it.

Problem set 1 For each of the following series, make a graph of the data with forecasts using the most

appropriate of the four benchmark methods:

mean, naive, seasonal naive or drift.

Provide plots for time series. Implement the autocorrelation analysis including correlogram of the

residuals and the Ljung-Box test with lag 8. Answer the question if autocorrelation, and seasonality

exists. Marking rules for a) to c): 0.25 for each step (0.25 for forecast plot, 0.25 for autocorrelation

plot, 0.25 for portmanteaux test, and 0.25 for correct conlusion).

(a) Annual bituminous coal production (1920–1968). Data set bicoal. Use na?ve. (1 mark)

(b) Price of chicken (1924–1993). Data set chicken. Use seasonal na?ve. (1 mark)

(c) Monthly total of people on unemployed benefits in Australia (January 1956–July 1992). Data set

dole. Use drift (1 mark)

(d) Plot residuals for this forecast and compare them with the residuals of seasonal naive forecast. (1

mark, no partial marks)

(e) Monthly total of accidental deaths in the United States (January 1973–December 1978). Data set

usdeaths. Use seasonal na?ve. (1 mark)

(f) Quarterly production of bricks (in millions of units) at Portland, Australia (March 1956–September

1994). Data set bricksq. Use mean method. (1 mark)

(g) What is the more appropriate method of forecast for this data? Implement it and justify your answer.

(1 mark, no partial marks)

(h) Annual Canadian lynx trappings (1821–1934). Data set lynx. Choose the optimal method.

Implement for it the same autocorrelation analysis as above. (1 mark)

Problem set 2 For the data set bricksq:

(a) Split the data into two parts using

> bricks1 <- window(bricksq, end=1987.99)

> bricks2 <- window(bricksq, start=1988)

(b) Check that your data have been split appropriately by producing plots of these two data sets. (0.5

marks)

(c) Calculate forecasts using each of the mean, na?ve, and seasonal naive benchmark methods applied

to bricks1. Compare the accuracy of your forecasts against the actual values stored in bricks2.

Which method does best? Why? (1 mark)

(d) For the best method, compute the residuals and plot them. (0.5 marks)