# 程序代写案例-STATS 786

STATS 786: Solutions
Department of Statistics
07/05/2021
QUESTION 1
a FALSE.
Consider the given model:
yt = β0 + β1t2 + yt−12 + εt, <
/br>If we apply both seasonal and first differencing:
(1−B)(1−B12)yt = (1−B)(yt − yt−12) = (1−B)(β0 + β1t2 + εt)
= β1t2 − β1(t− 1)2 + εt − εt−1
= −β1 + 2β1t+ εt − εt−1,
then we can see that after applying the differences, the series still contains a linear
trend. Therefore, these two differences are not sufficient to make the series stationary.
We should apply another first difference to get a stationary time series.
b FALSE.
The approximate sampling distribution for the autocorrelations (rk) from a white noise
series is
rk ∼ N
(
0, 1
T
)
, k = 1, 2, . . . ,
where T is the length of the time series.
The 95% confidence interval for the autocorrelations are given by
±1.96 1√
T
= ±1.96 1√
500
= (−0.0877, 0.0877).
The first three sample autocorrelations are outside this confidence interval.
c TRUE.
1
The moving average models are always stationary. For an MA(2) model to be invertible:
θ1 + θ2 > −1, θ1 − θ2 < 1, |θ2| < 1,
where yt = c + θ1εt−1 + θ2εt−2 + εt, and c, θ1 and θ2 are constants, and εt is a white
noise series.
For the given example, θ1 = 1.2, θ2 = 0.8.
θ1 + θ2 = 2 > −1
θ1 − θ2 = 0.4 < 1
|θ2| = 0.8 < 1
All there parameter restrictions are fulfilled by this model. Hence it is a stationary and
invertible model.
d FALSE.
AIC represents a trade-off between the error sum of squares and the no. of parameters
in the model (a penalty for the complexity of the model). If the error sum of squares
decreases by a small amount when a new term is included in the model, the value of
AIC will increase.
e FALSE.
The forecast function for the ETS(A,N,N) model is
yˆT+h|T = lT , h = 1, 2, . . . ,
where lT is the level estimated at time T . Hence the forecast function for the ETS(A,N,N)
model is flat. The h-step ahead forecast variance for ETS(A,N,N) is given by σ2[1 +
α2(h − 1)]. Hence the width of the prediction interval increases with the forecast
horizon.
f TRUE
The time plot shows monthly data having a strong seasonal pattern. Therefore, we
expect to see spikes in the ACF plot at lags which are multiples of 12. However, the
given ACF plot shows spikes roughly at multiples of 10.
2
QUESTION 2
a • The series has an upward trend.
• There is a strong seasonal pattern. The seasonal variation increases proportionately
to the level of the series (i.e., multiplicative seasonality).
• There is a sudden drop in 2020 Q2 due to the COVID-19 lockdown in New Zealand.
• The sales are highest in Q4 due to Christmas, and the lowest seems to be around
Q2–Q3.
• The sudden drop in 2020 Q2 is also visible in the seasonal and subseries plots.
• The average sales and growth rates are similar in Q1–Q3. The average sales for
Q2 can be impacted slightly due to the COVID-19 lockdown.
b • An STL decomposition has been performed on the sales data where the panels of
Figure 4 show the estimated trend-cycle, seasonal and remainder components.
• STL is an additive decomposition method. A log transformation has been applied
before the decomposition to account for the multiplicative seasonality.
Setting 1:
• The trend component shows a drop towards the end of the time series.
• The seasonal component changes slightly with time until 2015. The shape of the
seasonal pattern has changed after 2015.
Setting 2:
• The trend component has a smooth upward trend.
• The seasonal component changes slightly with time, and the seasonal pattern has
not changed much compared to setting 1.
• The remainder component in both settings shows a large drop in 2020 Q1 due to
the COVID-19 lockdown.
• Setting robust = TRUE has completely moved the impact of this extreme observa-
tion to the remainder component.
For analyzing the long-term trend, I would prefer setting 2. Even though there is
some uncertainty about future COVID-19 lockdowns, the trend towards the end
of the series is quite unlikely to decrease, as shown in setting 1.
3
QUESTION 3
a • The time series contains non-linear trend, seasonal and cyclic patterns.
• There are drops around 1991, 2001, 2007 due to recessions and 2020 due to
COVID-19.
b i Both models have additive seasonality and additive trends. For the damped model,
a damped trend is fitted. For the additive model, the error is additive and for
the damped model, the error is multiplicative.
ii ETS(A,A,A) model
• αˆ is moderately large. The level often changes with time.
• βˆ is quite small. Even though the slope changes with time, it changes slightly.
• γˆ is very small. The seasonal component hardly changes with time.
• The remainder component shows a large residual due to the disruption of the
COVID-19 outbreak.
iii fit %>% select(additive) %>% gg_tsresiduals()
fit %>%
augment() %>%
features(.resid, ljung_box, lag = 24, dof = 16)
iv fit %>% select(damped) %>% gg_tsresiduals()
fit %>%
select(damped) %>%
augment() %>%
features(.innov, ljung_box, lag = 24, dof = 17)
v I would choose the damped model.
• The forecasts from the additive model show an estimated upward trend,
although the series seems to flatten out towards the end. In contrast, the
damped model generates forecasts with a damping trend.
• The shape of the seasonal patterns is quite different in both models. The
forecasts from the additive model have one seasonal spike, whereas the
damped model has two spikes. The latter is more aligned with the seasonal
pattern that we can observe towards the end of the time series.
• The prediction intervals are also wider for the damped model. It indicates that
there is a lot of uncertainty present in these forecasts. It is more realistic with
the current COVID-19 outbreak.
4
vi
yt = (lt−1 + 0.879bt−1 + st−12)(1 + εt)
lt = lt−1 + 0.879bt−1 + 0.754(lt−1 + 0.879bt−1 + st−12)εt
bt = 0.879bt−1 + 0.217(lt−1 + 0.879bt−1 + st−12)εt
st = st−12 + 0.24(lt−1 + 0.879bt−1 + st−m)εt
where εt ∼ N (0, σˆ2) and σˆ2 is small and shown in the output as zero due to
rounding.
5
QUESTION 4
a • I would apply both a seasonal and first differencing to obtain a stationary time
series.
• The time plot of seasonally differenced series show changes in level with time, and
the ACF plot decays slowly as the lags increase.
• The plot of the non-seasonally differenced series shows a strong seasonal pattern,
and the autocorrelations computed at lags which are multiples of 12 decay, slowly.
• Due to these features, the seasonally differenced series and non-seasonally differ-
enced series appear to be non-stationary.
b i The partial autocorrelations at lags which are multiples of 12 are decaying, slowly.
The autocorrelations at seasonal lags show a sharp-cut off after lag 24. These
features resemble a ARIMA(0,1,0)(0,1,2)12 model.
ii Define employees time series by yt.
(1−B)(1−B12)yt = (1− 0.5482B12 − 0.1959B24)εt,
where εt ∼ N (0, 6.721e− 05).
iii
yt = yt−1 + yt−12 − yt−13 − 0.5482εt−12 − 0.1959εt−24 + εt
yˆT+1|T = yT + yT−11 − yT−12 − 0.5482εˆT−11 − 0.1959εˆT−23
= 3.13 + 3.01− 3.03 + (0.5482× 0.0259)− (0.1959× 0)
= 3.124198.
The forecast for April 2021 is 3.12.
Assuming that the forecast errors are Gaussian:
yˆT+1|T ± 1.96σˆ
3.12± 1.96√6.721e− 05
(3.10,3.14)
6

Email:51zuoyejun

@gmail.com