Docsity

Time series TD tutorial worksheet, Exercises of Time and Motion Studies

Toggle sidebar
bg1
TSAC, 2025/2026
Problem Sheet 4
1. Let {Yt}be a process that satisfies the equation
(1 →B)2Yt=(1→ωB)εt,→↑ <t<↑,
where Bis the backward shift operator and {εt}is a white noise process. Suppose that the process {Yt}has been
observed up to time Tand consider the minimum mean square error forecast for lead time h↓1, where HTrepresents
the history of the process up to time T:
ˆyT(h)=E(YT+h|HT).
(a) State to which member of the family of ARIMA processes {Yt}belongs.
(b) Expand the model equation to obtain an explicit expression for Ytin terms of previous process values and white
noise terms.
(c) By setting t=T+ 1 in the model equation, find an expression for ˆyT(1).
(d) Write down a simple expression for the forecast error as a white noise term:
YT+1 →ˆyT(1).
(e) By setting t=T+ 2 in the model equation, show that
ˆyT(2) = 3YT→2YT→1→2ωεT.
(f) Show that, for h↓3,
ˆyT(h)=2ˆyT(h→1) →ˆyT(h→2).
(g) Deduce that
ˆyT(h)=YT+bTh, h ↓1,
where
bT=YT→YT→1→ωεT.
(h) Show that the sequence {bT}satisfies the recurrence relation:
bT=(1→ω)(YT→YT→1)+ωbT→1.
2. A data set of durations until payment for 130 consecutive orders from a goods distributor are in the days object in the
TSA package. Type library(TSA); data(days); print(days) in R to see the data set.
(a) Fit an MA(2) model and write the code to estimate the parameters using the Method of Moments. Compare the
results with estimates using the least squares and the maximum likelihood methods.
# Fit MA(2) model using Least Squares
days.ma2.fit <- arima(days,order=c(0,0,1),method=’CSS’) ### Use ’ML’ for maximum likelihood
days.ma2.fit
(b) Forecast the next 10 values of the series, and list the forecasted values. Also plot the series along with the
forecasted values and 95% prediction limits for the next ten values of the series.
Use the code below
1
pf2

Partial preview of the text

Download Time series TD tutorial worksheet and more Exercises Time and Motion Studies in PDF only on Docsity!

TSAC, 2025/

Problem Sheet 4

  1. Let {Y (^) t } be a process that satisfies the equation

(1 → B) 2 Y (^) t = (1 → ωB)ε (^) t , →↑ < t < ↑,

where B is the backward shift operator and {ε (^) t } is a white noise process. Suppose that the process {Y (^) t } has been observed up to time T and consider the minimum mean square error forecast for lead time h ↓ 1, where H (^) T represents the history of the process up to time T : yˆ (^) T (h) = E(Y (^) T +h |H (^) T ).

(a) State to which member of the family of ARIMA processes {Y (^) t } belongs. (b) Expand the model equation to obtain an explicit expression for Y (^) t in terms of previous process values and white noise terms. (c) By setting t = T + 1 in the model equation, find an expression for ˆy (^) T (1). (d) Write down a simple expression for the forecast error as a white noise term:

Y (^) T +1 → yˆ (^) T (1).

(e) By setting t = T + 2 in the model equation, show that

ˆy (^) T (2) = 3Y (^) T → 2 Y (^) T → 1 → 2 ωε (^) T.

(f) Show that, for h ↓ 3, ˆy (^) T (h) = 2ˆy (^) T (h → 1) → ˆy (^) T (h → 2).

(g) Deduce that ˆy (^) T (h) = Y (^) T + b (^) T h, h ↓ 1 , where b (^) T = Y (^) T → Y (^) T → 1 → ωε (^) T.

(h) Show that the sequence {b (^) T } satisfies the recurrence relation:

b (^) T = (1 → ω)(Y (^) T → Y (^) T → 1 ) + ωbT → 1.

  1. A data set of durations until payment for 130 consecutive orders from a goods distributor are in the days object in the TSA package. Type library(TSA); data(days); print(days) in R to see the data set.

(a) Fit an MA(2) model and write the code to estimate the parameters using the Method of Moments. Compare the results with estimates using the least squares and the maximum likelihood methods.

Fit MA(2) model using Least Squares

days.ma2.fit <- arima(days,order=c(0,0,1),method=’CSS’) ### Use ’ML’ for maximum likelihood days.ma2.fit

(b) Forecast the next 10 values of the series, and list the forecasted values. Also plot the series along with the forecasted values and 95% prediction limits for the next ten values of the series. Use the code below

TSAC, 2025/

n=length(days)

Obtain MMSE forecasts

days.ma2.predict <- predict(days.ma2.fit,n.ahead=10) round(days.ma2.predict$pred,3) round(days.ma2.predict$se,3)

Create lower and upper prediction interval bounds

lower.pi<-days.ma2.predict$pred-qnorm(0.975,0,1)days.ma2.predict$se upper.pi<-days.ma2.predict$pred+qnorm(0.975,0,1)days.ma2.predict$se

Display prediction intervals (2007-2026)

n1=n+ n10=n+ data.frame(Year=c(n1:n10),lower.pi,upper.pi)

Note: Argument pch=16 produces a small black circle (for MMSE forecasts)

plot(days.ma2.fit,n.ahead=10,col=’red’,type=’b’,pch=16,ylab="Deviations (in inch)",xlab="Time")

Put horizontal line at ML estimate of overall mean

abline(h=coef(days.ma2.fit)[names(coef(days.ma2.fit))==’intercept’]) (c) There are three clear outliers (at times 63, 106, and 129) which can be seen from the time series plot. Replace these outliers with a “typical duration” value of 35. To do this, you can use the code days.adj=days days.adj[c(63,106,129)]= print(days.adj) Fit an MA(2) model to this adjusted series using the three methods of estimation and compare the results. (d) Forecast the next 10 values of the adjusted series, and list the forecasted values. Also plot the series along with the forecasted values and 95% prediction limits for the next ten values of the series. (e) Comment on any di!erences between the forecasts based on the original data and the forecasts based on the adjusted data.

  1. For the seasonal model: Y (^) t = ”Y (^) t→ 4 + e (^) t → ωe (^) t→ 1 , with |”| < 1 , (1) find ϑ 0 and ϖk.
  2. Identify the following as certain multiplicative seasonal ARIMA models:

(a) Y (^) t = 0. 5 Y (^) t→ 1 + Y (^) t→ 4 → 0. 5 Y (^) t→ 5 + e (^) t → 0. 3 e (^) t→ 1. (b) Y (^) t = Y (^) t→ 1 + Y (^) t→ 12 → Y (^) t→ 13 + e (^) t → 0. 5 e (^) t→ 1 → e (^) t→ 12 + 0. 5 e (^) t→ 13.

  1. The quarterly earnings per share for 1960-1980 are in the JJ object in the TSA package. To load and print the dataset in R, use:

library(TSA) data(JJ) print(JJ)

(a) Plot the original time series and the (natural) logarithm of the series. Explain why the log transformation is useful when modeling this series. (b) Explain why the log-transformed series is clearly not stationary. Plot the first di!erences of the log-transformed series. Could the di!erenced logged series be viewed as stationary? (c) Graph the sample ACF of the di!erenced logged data. What does this plot suggest? (d) Take both the first di!erences and the (lag-4) seasonal di!erences of the logged data. Plot this di!erenced and seasonally di!erenced series. Interpret what the plot indicates. (e) Plot the sample ACF of the di!erenced and seasonally di!erenced logged series. Interpret what the plot tells you. (f) Fit an ARIMA(0,1,1) ↔ (0,1,1) 4 model to the logged series, and assess the significance of the estimated coe#cients. (g) Perform model diagnostics, based on the residuals. (h) Calculate the forecasts for the next 8 quarters of the series. Plot the forecasts along with 95% prediction intervals.