xuebaunion@vip.163.com

3551 Trousdale Rkwy, University Park, Los Angeles, CA

留学生论文指导和课程辅导

无忧GPA：https://www.essaygpa.com

工作时间：全年无休-早上8点到凌晨3点

微信客服：xiaoxionga100

微信客服：ITCS521

R代写-MAS8382

时间：2021-01-18

MAS8382 Summative Practical Report

Summative Practical Report

Submit your solutions to all questions via NESS by

11:45pm on Monday 18th January 2021.

For any questions where you use R, include your R code and any relevant plots and R output.

Marks for each question are indicated. These marks should be used as a rough guide to the relative

weight of individual questions. The final marks for the assignment may be slightly different from

those indicated.

You should submit your work as a single electronic file in PDF or Word format. If you would prefer

not to type your solutions to Questions 3 and 5, you can scan or photograph handwritten answers.

The resulting file(s) can then be embedded in, or appended to, the rest of the report.

Week 2

You should work on the three questions in this section during the Practical for Week 2 and, if

necessary, finish it during your independent study time.

Chapter 3: ARIMA models

1. Consider the general ARIMA(p, d, q) process.

(a) In the solutions to the formative practical report, Question 3(a) gives a function which

simulates from an ARMA(p, q) process. Study this function and then use it to give a new

function which simulates from an ARIMA(p, d, q) process. This function should have d,

the parameter vectors, and the length of the time series as arguments, and it should

return the simulated time series. If you can, allow your function to handle any d. If not,

write a function which handles the d = 0, d = 1 and d = 2 cases and returns with an

error if d > 2.1

(b) Simulate three realisations of an ARIMA(1, 1, 2) process of length 1000 with µ = 0,

φ1 = 0.8, θ1 = 0.8, θ2 = −0.5 and σ

2 = 0.5. Produce two plots: one with each of the

three realisations superimposed and another with the corresponding three series of first

differences superimposed. Comment on your plots.

[7 marks]

2. For an AR(p) model:

(a) Write a function which estimates the model parameters via the Yule-Walker equations.

(b) Test this function by simulating various AR processes and ensuring the original param-

eters are (approximately) recovered. Report the results of your tests. To simulate the

AR processes, you may like to use the function from Question 3(a) in the solutions to

the formative practical report.

[10 marks]

1This second option will be marked for reduced credit.

1

MAS8382 Summative Practical Report

3. An ARIMA(2,1,0) process is given by

Xt −Xt−1 = φ1(Xt−1 −Xt−2) + φ2(Xt−2 −Xt−3) + εt

where {εt} is a white noise process with εt ∼ N(0, σ

2). Suppose that φ1 = 0.7, φ2 = −0.1 and

σ2 = 0.09. Suppose further that data are observed up to time n with xn = 17.2, xn−1 = 16.5

and xn−2 = 15.1.

(a) Calculate the forecasts and forecast error variances for times n+ 1, n+ 2 and n+ 3.

(b) Give a 95% prediction interval for the forecasts at these times.

[10 marks]

Week 3

You should work on the three questions in this section during the Practical for Week 3 and, if

necessary, finish it during your independent study time.

Chapter 5: Dynamic linear models

4. Consider a univariate (i.e. scalar Yt) DLM with time-invariant Ft = F, Gt = G, Wt = W

and Vt = V = σ

2

v .

(a) Write an R function which simulates from a DLM of this form. This function should

have F, G, W and V , the length of the time series, and the mean m0 and variance C0

of ϑ0 as arguments, and it should return the simulated time series.

(b) Simulate a long realisation of a linear growth model with m0 = (0, 0)

T , C0 = 10I2,

Wt = diag(0.5, 0.1) and V = 50. For the first 100 samples, generate two separate plots:

one of the simulated data and one of the series of second differences. Using the whole time

series of second differences, report the sample estimates of the mean and autocovariance

function for k = 0, 1, . . . , 5.

[8 marks]

5. Let ϑt = (ϑt1, ϑt2)

T . The linear growth model has observation equation:

Yt = Fϑt + vt where F = (1, 0) and vt ∼ N(0, σ

2

v)

and system equation:

ϑt = Gϑt−1 +wt where G =

(

1 1

0 1

)

and wt =

(

wt1

wt2

)

∼ N2(0,W)

in which

W =

(

σ2w,1 0

0 σ2w,2

)

.

Suppose that we have observed data up to time n. As usual, we denote the conditional

expectation of ϑn as mn = (mn1, mn2)

T and the conditional variance as

Cn =

(

Cn11 Cn12

Cn12 Cn22

)

.

2

MAS8382 Summative Practical Report

(a) Derive the mean fn(1) and variance Qn(1) of the one-step ahead forecast of Yt in terms

of the quantities in mn and Cn.

(b) Derive the mean fn(k) of the k-step ahead forecast of Yt in terms of the quantities in mn

and comment on your result.

[10 marks]

Chapter 6: Additional time series models

6. Consider the VARMA(p, q) process.

(a) In the solutions to the formative practical report, Question 3(a) gives a function which

simulates from an ARMA(p, q) process. Study this function and then modify it to give

a new function which simulates from a VARMA(p, q) process. This function should have

the parameters, the length of the time series, and a set of initial values as arguments,

and it should return the simulated time series. Tricky: make this function check if the

entered parameters are such that the process is stationary and/or invertible.

(b) Simulate a long realisation of the process for a VARMA(2, 1) model with µ = (0, 0)T ,

φ1 =

(

0.65 0.1

0.15 0.65

)

, φ2 =

(

0.3 −0.1

0.0 0.3

)

, θ1 =

(

0.6 0.2

0.15 0.5

)

, Σ =

(

1 0.4

0.4 1.2

)

.

Report the sample mean vector, sample variance matrix and sample covariance matrix

between Xt and Xt−1. Hint: in R, to compute the sample covariance matrix between

the n× p data matrix X and the n×m data matrix Y, you can use cov(X, Y). This will

return a p×m matrix whose (i, j)-th entry is the sample covariance between X[,i] and

Y[,j] – this will not be symmetric!

[10 marks]

3

Summative Practical Report

Submit your solutions to all questions via NESS by

11:45pm on Monday 18th January 2021.

For any questions where you use R, include your R code and any relevant plots and R output.

Marks for each question are indicated. These marks should be used as a rough guide to the relative

weight of individual questions. The final marks for the assignment may be slightly different from

those indicated.

You should submit your work as a single electronic file in PDF or Word format. If you would prefer

not to type your solutions to Questions 3 and 5, you can scan or photograph handwritten answers.

The resulting file(s) can then be embedded in, or appended to, the rest of the report.

Week 2

You should work on the three questions in this section during the Practical for Week 2 and, if

necessary, finish it during your independent study time.

Chapter 3: ARIMA models

1. Consider the general ARIMA(p, d, q) process.

(a) In the solutions to the formative practical report, Question 3(a) gives a function which

simulates from an ARMA(p, q) process. Study this function and then use it to give a new

function which simulates from an ARIMA(p, d, q) process. This function should have d,

the parameter vectors, and the length of the time series as arguments, and it should

return the simulated time series. If you can, allow your function to handle any d. If not,

write a function which handles the d = 0, d = 1 and d = 2 cases and returns with an

error if d > 2.1

(b) Simulate three realisations of an ARIMA(1, 1, 2) process of length 1000 with µ = 0,

φ1 = 0.8, θ1 = 0.8, θ2 = −0.5 and σ

2 = 0.5. Produce two plots: one with each of the

three realisations superimposed and another with the corresponding three series of first

differences superimposed. Comment on your plots.

[7 marks]

2. For an AR(p) model:

(a) Write a function which estimates the model parameters via the Yule-Walker equations.

(b) Test this function by simulating various AR processes and ensuring the original param-

eters are (approximately) recovered. Report the results of your tests. To simulate the

AR processes, you may like to use the function from Question 3(a) in the solutions to

the formative practical report.

[10 marks]

1This second option will be marked for reduced credit.

1

MAS8382 Summative Practical Report

3. An ARIMA(2,1,0) process is given by

Xt −Xt−1 = φ1(Xt−1 −Xt−2) + φ2(Xt−2 −Xt−3) + εt

where {εt} is a white noise process with εt ∼ N(0, σ

2). Suppose that φ1 = 0.7, φ2 = −0.1 and

σ2 = 0.09. Suppose further that data are observed up to time n with xn = 17.2, xn−1 = 16.5

and xn−2 = 15.1.

(a) Calculate the forecasts and forecast error variances for times n+ 1, n+ 2 and n+ 3.

(b) Give a 95% prediction interval for the forecasts at these times.

[10 marks]

Week 3

You should work on the three questions in this section during the Practical for Week 3 and, if

necessary, finish it during your independent study time.

Chapter 5: Dynamic linear models

4. Consider a univariate (i.e. scalar Yt) DLM with time-invariant Ft = F, Gt = G, Wt = W

and Vt = V = σ

2

v .

(a) Write an R function which simulates from a DLM of this form. This function should

have F, G, W and V , the length of the time series, and the mean m0 and variance C0

of ϑ0 as arguments, and it should return the simulated time series.

(b) Simulate a long realisation of a linear growth model with m0 = (0, 0)

T , C0 = 10I2,

Wt = diag(0.5, 0.1) and V = 50. For the first 100 samples, generate two separate plots:

one of the simulated data and one of the series of second differences. Using the whole time

series of second differences, report the sample estimates of the mean and autocovariance

function for k = 0, 1, . . . , 5.

[8 marks]

5. Let ϑt = (ϑt1, ϑt2)

T . The linear growth model has observation equation:

Yt = Fϑt + vt where F = (1, 0) and vt ∼ N(0, σ

2

v)

and system equation:

ϑt = Gϑt−1 +wt where G =

(

1 1

0 1

)

and wt =

(

wt1

wt2

)

∼ N2(0,W)

in which

W =

(

σ2w,1 0

0 σ2w,2

)

.

Suppose that we have observed data up to time n. As usual, we denote the conditional

expectation of ϑn as mn = (mn1, mn2)

T and the conditional variance as

Cn =

(

Cn11 Cn12

Cn12 Cn22

)

.

2

MAS8382 Summative Practical Report

(a) Derive the mean fn(1) and variance Qn(1) of the one-step ahead forecast of Yt in terms

of the quantities in mn and Cn.

(b) Derive the mean fn(k) of the k-step ahead forecast of Yt in terms of the quantities in mn

and comment on your result.

[10 marks]

Chapter 6: Additional time series models

6. Consider the VARMA(p, q) process.

(a) In the solutions to the formative practical report, Question 3(a) gives a function which

simulates from an ARMA(p, q) process. Study this function and then modify it to give

a new function which simulates from a VARMA(p, q) process. This function should have

the parameters, the length of the time series, and a set of initial values as arguments,

and it should return the simulated time series. Tricky: make this function check if the

entered parameters are such that the process is stationary and/or invertible.

(b) Simulate a long realisation of the process for a VARMA(2, 1) model with µ = (0, 0)T ,

φ1 =

(

0.65 0.1

0.15 0.65

)

, φ2 =

(

0.3 −0.1

0.0 0.3

)

, θ1 =

(

0.6 0.2

0.15 0.5

)

, Σ =

(

1 0.4

0.4 1.2

)

.

Report the sample mean vector, sample variance matrix and sample covariance matrix

between Xt and Xt−1. Hint: in R, to compute the sample covariance matrix between

the n× p data matrix X and the n×m data matrix Y, you can use cov(X, Y). This will

return a p×m matrix whose (i, j)-th entry is the sample covariance between X[,i] and

Y[,j] – this will not be symmetric!

[10 marks]

3