CS代考 ETW3420 Principles of Forecasting and Applications

ETW3420 Principles of Forecasting and Applications

Principles of Forecasting and Applications

Copyright By PowCoder代写 加微信 powcoder

Topic 2 Exercises

Question 1

Download the file tute1.csv from Moodle, open it in Excel and review its contents. You

should find four columns of information. Columns B through D each contain a quarterly

series, labelled Sales, AdBudget and GDP. Sales contains the quarterly sales for a small

company over the period 1981-2005. AdBudget is the advertising budget and GDP is the

gross domestic product. All series have been adjusted for inflation.

a. You can read the data into R with the following script:

tute1 <- read.csv("tute1.csv", header=TRUE) b. Convert the data to time series. mytimeseries <- ts(tute1[,-1], start=1981, frequency=4) (The [,-1] removes the first column which contains the quarters as we don’t need them now.) c. Construct time series plots of each of the three series autoplot(mytimeseries, facets=TRUE) Check what happens when you don’t include facets=TRUE. autoplot(mytimeseries) Question 2 Create time plots of the following time series: writing, a10, h02, goog • Use help() to find out about the data in each series. • For the goog plot, modify the axis labels and title. autoplot(writing) autoplot(a10) autoplot(h02) autoplot(goog) + xlab("Year") + ylab("Price ($)") + ggtitle("Google closing stock price") Question 3 Use the ggseasonplot and ggsubseriesplot functions to explore the seasonal patterns in the following time series: writing,a10, h02. • What can you say about the seasonal patterns? • Can you identify any unusual years? ggseasonplot(writing) ggsubseriesplot(writing) Question 4 Use the following graphics functions: autoplot, ggseasonplot, ggsubseriesplot, gglagplot, ggAcf and explore features from the following time series: hsales, usdeaths, • Can you spot any seasonality, cyclicity and trend? • What do you learn about the series? autoplot(hsales) ggseasonplot(hsales) ggsubseriesplot(hsales) gglagplot(hsales, do.lines =F) ggAcf(hsales) Question 5 The following time plots and ACF plots correspond to four different time series. Your task is to match each time plot in the first row with one of the ACF plots in the second row. 0 20 40 60 1. Daily temperature of cow 1974 1976 1978 2. Monthly accidental deaths 1950 1952 1954 1956 1958 1960 3. Monthly air passengers 1860 1880 1900 4. Annual mink trappings Question 6 dj contains 292 consecutive trading days of the Dow Jones Index. Use ddj <- diff(dj) to compute the daily changes in the index. Plot ddj and its ACF. Do the changes in the Dow Jones Index look like white noise? ddjt = djt − djt−1 ddj <- diff(dj) autoplot(ddj) ggAcf(ddj, lag.max=30) Question 1 Question 2 Question 3 Question 4 Question 5 Question 6 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com