1. From a series of length 100, we have computed r1 = 0.8, r2 = 0.5, r3 = 0.4, Y ̄ = 2, and a sample variance of 5. If we assume that an AR(2) model with a constant term is appropriate, how can we get (simple) estimates of φ1, φ2, θ0 and σhate2 ?

  2. Simulate an MA(1) series with θ = 0.8 and n = 48.

  1. Find the method-of-moments estimate of θ.
set.seed(12345)
series = arima.sim(n = 48, list(ma = -0.8))
plot(series)

estimate.ma1.mom=function(x)
{
  r=acf(x,plot=F)$acf[2]
  if (abs(r)<0.5)
    return((-1+sqrt(1-4*r^2))/(2*r)) else return(NA)
}
estimate.ma1.mom(series)
## [1] 0.7100616
  1. Find the conditional least squares estimate of θ and compare it with part (a).
arima(series,order=c(0,0,1),method='CSS')
## 
## Call:
## arima(x = series, order = c(0, 0, 1), method = "CSS")
## 
## Coefficients:
##           ma1  intercept
##       -0.8552     0.0407
## s.e.   0.0953     0.0253
## 
## sigma^2 estimated as 1.188:  part log likelihood = -72.25
  1. Find the maximum likelihood estimate of θ and compare it with parts (a) and (b).
arima(series,order=c(0,0,1),method='ML')
## 
## Call:
## arima(x = series, order = c(0, 0, 1), method = "ML")
## 
## Coefficients:
##           ma1  intercept
##       -1.0000     0.0552
## s.e.   0.0719     0.0104
## 
## sigma^2 estimated as 1.063:  log likelihood = -71.53,  aic = 149.06
  1. Display the sample ACF of the series. Is an MA(1) model suggested?
acf(series)

  1. Repeat parts (a), (b), and (c) with a new simulated series for 500 times by using the same parameters and same sample size. Take the average results of 500 iteration, and then compare your results with your results from the first simulation.
for (i in 1:500){
    newma1 = arima.sim(n = 48, list(ma = -0.8))
}
#
mean(newma1)
## [1] 0.01284371
estimate.ma1.mom(newma1)
## [1] 0.6955597
arima(newma1,order=c(0,0,1),method='CSS')
## 
## Call:
## arima(x = newma1, order = c(0, 0, 1), method = "CSS")
## 
## Coefficients:
##           ma1  intercept
##       -0.7425     0.0113
## s.e.   0.1235     0.0442
## 
## sigma^2 estimated as 1.272:  part log likelihood = -73.89
arima(newma1,order=c(0,0,1),method='ML')
## 
## Call:
## arima(x = newma1, order = c(0, 0, 1), method = "ML")
## 
## Coefficients:
##           ma1  intercept
##       -0.7161     0.0086
## s.e.   0.1229     0.0490
## 
## sigma^2 estimated as 1.272:  log likelihood = -74.24,  aic = 154.47
  1. Calculate the variance of your sampling distribution and compare it with the large-sample result in Equation (7.4.11), page 161.
sd(newma1)^2
## [1] 1.899679
(1-(-0.8)^2)/48
## [1] 0.0075
  1. Simulate an ARMA(1, 1) series with φ = 0.7, θ = 0.4, and n = 72.
arma11 = arima.sim(n=72,list(ar=0.7,ma=-0.4))
plot(arma11)

  1. Find the method-of-moments estimates of φ and θ.
acf(arma11)$acf

## , , 1
## 
##               [,1]
##  [1,]  1.000000000
##  [2,]  0.496035630
##  [3,]  0.463073959
##  [4,]  0.290734384
##  [5,]  0.243550600
##  [6,]  0.164816557
##  [7,]  0.127885306
##  [8,]  0.154014332
##  [9,]  0.174231440
## [10,]  0.211617589
## [11,]  0.106714906
## [12,]  0.095302818
## [13,] -0.003369514
## [14,]  0.018707781
## [15,] -0.114159660
## [16,] -0.008877741
## [17,] -0.017601514
## [18,] -0.045015734
## [19,] -0.017762854
  1. Find the conditional least squares estimates of φ and θ and compare them with part (a).
arima(arma11,order=c(1,0,1),method='CSS')
## 
## Call:
## arima(x = arma11, order = c(1, 0, 1), method = "CSS")
## 
## Coefficients:
##          ar1      ma1  intercept
##       0.7976  -0.4060     0.1365
## s.e.  0.1154   0.1675     0.3145
## 
## sigma^2 estimated as 0.8066:  part log likelihood = -94.42

The estimate is larger for least squares

  1. Find the maximum likelihood estimates of φ and θ and compare them with parts (a) and (b).
arima(arma11,order=c(1,0,1),method='ML')
## 
## Call:
## arima(x = arma11, order = c(1, 0, 1), method = "ML")
## 
## Coefficients:
##          ar1      ma1  intercept
##       0.8067  -0.4338     0.1865
## s.e.  0.1182   0.1825     0.2952
## 
## sigma^2 estimated as 0.7921:  log likelihood = -93.97,  aic = 195.95
  1. Display the sample EACF of the series. Is an ARMA(1,1) model suggested?
library(tseries)
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
library(ggplot2)
library(TSA)
## 
## Attaching package: 'TSA'
## The following objects are masked from 'package:stats':
## 
##     acf, arima
## The following object is masked from 'package:utils':
## 
##     tar
eacf(arma11)
## AR/MA
##   0 1 2 3 4 5 6 7 8 9 10 11 12 13
## 0 x x x x o o o o o o o  o  o  o 
## 1 x o o o o o o o o o o  o  o  o 
## 2 o o o o o o o o o o o  o  o  o 
## 3 x o o o o o o o o o o  o  o  o 
## 4 o o o o o o o o o o o  o  o  o 
## 5 x o o o o o o o o o o  o  o  o 
## 6 o o x o o o o o o o o  o  o  o 
## 7 x o x o o o o o o o o  o  o  o
  1. The data file named robot contains a time series obtained from an industrial robot. The robot was put through a sequence of maneuvers, and the distance from a desired ending point was recorded in inches. This was repeated 324 times to form the time series.
data(robot)
  1. Estimate the parameters of an AR(1) model for these data.
arima(robot,order=c(1,0,0))
## 
## Call:
## arima(x = robot, order = c(1, 0, 0))
## 
## Coefficients:
##          ar1  intercept
##       0.3074     0.0015
## s.e.  0.0528     0.0002
## 
## sigma^2 estimated as 6.482e-06:  log likelihood = 1475.54,  aic = -2947.08
  1. Estimate the parameters of an IMA(1,1) model for these data.
arima(robot,order=c(0,1,1))
## 
## Call:
## arima(x = robot, order = c(0, 1, 1))
## 
## Coefficients:
##           ma1
##       -0.8713
## s.e.   0.0389
## 
## sigma^2 estimated as 6.069e-06:  log likelihood = 1480.95,  aic = -2959.9
  1. Compare the results from parts (a) and (b) in terms of AIC.