ETW3420 Principles of Forecasting and Applications
Principles of Forecasting and Applications
Copyright By PowCoder代写 加微信 powcoder
Topic 6 Post-Tutorial Activity Part 2
Instructions
• Perform and complete the following tasks before answering the Quiz questions on
Question 1
Use R to simulate and plot some data from simple ARIMA models.
(a) Use the following R code to generate data from an AR(1) model with φ1 = 0.6 and
σ2 = 1. Let T = 500. The process starts with y1 = 0.
#Set sample size
#Create a time series vector to store the 500 values of the data set
y <- ts(numeric(T))
#Setting y_1 = 0
#Set the value of phi_1
#Simulate vector of error terms from a standard normal distribution
set.seed(123) #set seed number; to ensure we all have the same simulated values
e <- rnorm(T)
#Simulate AR(1) process
for (i in 2:T) {
y[i] = phi*y[i-1]+ e[i]
(b) Produce a time plot along with its ACF and PACF for the series. How do the plots
change as you change the value of φ1?
(c) Use the following R code to generate data from an MA(1) model with θ1 = 0.6 and
σ2 = 1. Let T = 500.
#Set sample size
#Create a time series vector to store the 500 values of the data set
y <- ts(numeric(T))
#Setting y_1 = 0
#Set the value of theta
theta = 0.6
#Simulate vector of error terms from a standard normal distribution
set.seed(123) #set seed number; to ensure we all have the same simulated values
e <- rnorm(T)
#Simulate MA(1) process
for (i in 2:T) {
y[i] = theta*e[i-1]+ e[i]
(d) Produce a time plot along with its ACF and PACF for the series. How do the plots
change as you change the value of θ1?
(e) Generate data from an ARMA(1,1) model with φ1 = 0.6, θ1 = 0.6 and σ2 = 1. Let
T = 500. The process starts with y1 = 0.
#Set sample size
#Create a time series vector to store the 500 values of the data set
y <- ts(numeric(T))
#Setting y_1 = 0
#Set the value of phi and theta
theta = 0.6
#Simulate vector of error terms from a standard normal distribution
set.seed(123) #set seed number; to ensure we all have the same simulated values
e <- rnorm(T)
#Simulate ARMA(1,1) process
for (i in 2:T) {
y[i] = phi*y[i-1] + theta*e[i-1]+ e[i]
(f) Plot the ACF and PACF of the simulated ARMA(1,1) process. Consider which other
possible data generating processes these plots resemble.
Question 2
(a) Plot the annual bituminous coal production in the United States from 1920 to 1968
(data set bicoal). Also plot its ACF and PACF.
(b) You decide to fit the following model to the series:
yt = c+ φ1yt−1 + φ2yt−2 + φ3yt−3 + φ4yt−4 + et
where yt is the coal production in year t and et is a white noise series. What sort of
ARIMA model is this (i.e., what are p, d, and q)?
(c) Explain why this model was chosen using the ACF and PACF.
Instructions
Question 1
Question 2
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com