程序代写 ETW3420 Principles of Forecasting and Applications

ETW3420 Principles of Forecasting and Applications

Principles of Forecasting and Applications

Copyright By PowCoder代写 加微信 powcoder

Topic 6 Exercises – Part 2

Question 1

Consider the following AR(1) process

yt = c+ φ1yt−1 + et (1)

et ∼ WN(0, σ2).

(a) Prove that

E(yt) = µ =

Hint: Take expectations on both sides of (1) and use the fact that yt is stationary.

(b) Prove that

V ar(yt) = γ0 =

Note: Since yt is stationary,

Cov(yt−1, et) = 0.

(c) Prove that

Cov(yt, yt−j) = γj =

1, ∀ t and ∀ j (4)

Hint: From (2) we have

c = µ(1− φ1). (5)

Substituting (5) into (1) and rearranging, we obtain:

yt − µ = φ1(yt−1 − µ) + et (6)

Multiplying both sides of (6) by (yt−j − µ), we obtain:

(yt − µ)(yt−j − µ) = φ1(yt−1 − µ)(yt−j − µ) + et(yt−j − µ). (7)

Take expectations on both sides of (7) and use the following information:

i) cov(yt, yt−j) = E[(yt − µ)(yt−j − µ)]

ii) Fact that E(etyt−j) = 0 for any j 6= 0.

iii) Consider pattern that emerges when we set j = 1, j = 2, …

(d) Prove that

= φj1 ∀ j (8)

Question 2

Consider the following MA(1) process

yt = et + θet−1 (9)

et ∼ WN(0, σ2).

(a) Prove that

E(yt) = µ = 0 ∀ t (10)

Hint: Take expectations on both sides of (9).

(b) Prove that

V ar(yt) = γ0 = (1 + θ2)σ2 ∀ t (11)

Hint: Take variance on both sides of (9).

(c) Prove that

Cov(yt, yt−1) = θσ2

Cov(yt, yt−j) = 0 ∀ j > 1

Hint: Use the following information:

i) cov(yt, yt−j) = E[(yt − µ)(yt−j − µ)] = E(ytyt−j)

ii) Express E(ytyt−j) in terms of et

iii) E(etet−j) = 0 ∀ j > 0

iv) Consider pattern that emerges when we set j = 1, j = 2, …

Question 3

Consider wmurders, the number of women murdered each year (per 100,000 standard popu-

lation) in the United States.

(a) By studying appropriate graphs of the series in R, find an appropriate ARIMA(p, d, q)

model for these data.

(b) Should you include a constant in the model? Explain.

(c) Write this model in terms of the backshift operator.

(d) Fit the model using R and examine the residuals. Is the model satisfactory?

(e) Forecast three times ahead. Check your forecasts by hand to make sure that you know

how they have been calculated.

(f) Create a plot of the series with forecasts and prediction intervals for the next three

periods shown.

Question 4

Consider austa, the total international visitors to Australia (in millions) for the period

1980-2015. Produce a ggtsdisplay of the data and note its features.

ggtsdisplay(austa)

(a) Use auto.arima() to find an appropriate ARIMA model. What model was selected.

Check that the residuals look like white noise. Plot forecasts for the next 10 periods.

#Auto fit an ARIMA model

(fit <- auto.arima(austa)) #Check residuals checkresiduals(fit) #Plot forecasts fit %>% forecast(h=10) %>% autoplot()

(b) Execute the following codes. Can you explain the difference in results?

(Arima(austa, order = c(0,1,1)))

(Arima(austa, order = c(0,1,1), include.constant = T))

It boils down to whether an intercept, c, should be included/specified in the

ARIMA model. In the context of R’s parameterisation, it is whether the parameter µ is

to be included. Recall that c = µ(1− φ1 − …φp). In the R output, µ̂ = 0.173. Since no AR

coefficients were estimated, then ĉ = µ̂ = 0.173.

• In the model specification, we have already decided that d = 1.

• If combined with c = 0, it implies that the long-term forecasts will go to a non-zero

• If combined with c 6= 0, then the long term forecasts will follow a straight slope. (Refer

to Slide 60 of lecture notes).

As austa displays an (upward) trend, we would expect the forecasts to also trend upwards,

instead of being a non-zero constant. So we want to specify a constant in the ARIMA model,

i.e. c 6= 0.

• Using help(Arima), we read that there is an argument specification for include.constant.

• By default, the Arima() function sets c = µ = 0 when d > 0, and provides an estimate

of µ when d = 0.

• If include.constant = T, it will set include.mean = T if d = 0 and include.drift

= T when d > 0. For the former, R labels the constant in the estimation output as

mean. R labels the constant in the estimation output as drift for the latter.

• For d > 1, no constant is allowed by Arima() as a quadratic or higher order trend is

particularly dangerous when forecasting.

• Referring back to our codes, Arima(austa, order = c(0,1,1)) imposes a default

setting of c = µ = 0 when d > 0. This is not what we want because if c = 0 and d = 1,

the long term forecasts is just a horizontal line.

• We want c 6= 0. Therefore, we need to specify include.constant = TRUE so that the

parameter µ is estimated by R.

(c) Plot forecasts from an ARIMA(0,1,1) model with no drift and compare these to part

a. Comment.

austa %>% Arima(order=c(0,1,1), include.constant = FALSE) %>%

forecast() %>% autoplot()

(d) Self-practice: Plot forecasts of austa from the following models and reconcile the plots

with Slide 60 of your lecture notes. Be sure to take note of the values of d.

• ARIMA(0,0,1) with a constant

• ARIMA(0,0,0) with a constant

• ARIMA(0,2,1) with no constant.

Question 1
Question 2
Question 3
Question 4

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com