Problem 1

Construction of the time series with \(log\) changes in quarterly Real Personal Consumption Expenditures (\(c_t\)) based on following formula: \(y_t=\Delta logc_t=logc_t-logc_{t-1}\). The data for Real Personal Consumption is taken from FRED/PCECC96.

library(Quandl)
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric

At first we import the data for Real Personal Consumption Expenditures from Quandl website:

rPCE <- Quandl("FRED/PCECC96", type="ts")
plot(rPCE, xlab=" Years ", ylab="Billions of Chained 2005 US Dollars", main="Real Personal Consumption Expenditures")

Now we define the function for \(y_t\)

log_rPCE <- log(rPCE)
lag_diff <- diff(log_rPCE,1)

And plot the graph of it

plot(lag_diff,xlab="", ylab="")

ACF of the data is as following

acf(as.data.frame(lag_diff),type='correlation',lag=24)

acf(as.data.frame(lag_diff),type='correlation',lag=100)

And the PACF of the data is as following

acf(as.data.frame(lag_diff),type='partial',lag=24)

acf(as.data.frame(lag_diff),type='partial',lag=100)

From the above graphs of ACF and PACF, we can see that ACF start to fall exponentially to zero after total of three lags. While PACF exhibits oscilating decline.

If we were to choose AR model, then based on PACF of the series we should check AR(1), AR(2), AR(3), AR(4) and check the respective information criterion.

Let’s start with AR(2)

AR2 <- arima(lag_diff, order = c(2,0,0))
AR2
## 
## Call:
## arima(x = lag_diff, order = c(2, 0, 0))
## 
## Coefficients:
##          ar1     ar2  intercept
##       0.0599  0.3188     0.0082
## s.e.  0.0571  0.0570     0.0007
## 
## sigma^2 estimated as 5.968e-05:  log likelihood = 947.08,  aic = -1886.16

And AR(2) model residuals

tsdiag(AR2,gof.lag=12)

And the results for AR(4) will be

AR4 <- arima(lag_diff, order = c(4,0,0))
AR4
## 
## Call:
## arima(x = lag_diff, order = c(4, 0, 0))
## 
## Coefficients:
##          ar1     ar2     ar3      ar4  intercept
##       0.0570  0.3647  0.0244  -0.1444     0.0082
## s.e.  0.0597  0.0598  0.0598   0.0596     0.0007
## 
## sigma^2 estimated as 5.84e-05:  log likelihood = 950.02,  aic = -1888.03

And AR(4) model residuals

tsdiag(AR4,gof.lag=12)

Based on the information criterion (AIC), AR(4) model is more preferred as it has least AIC of (-1888.03). Before making final decision let’s look at the significance of the coefficients of the AR term and conduct adequecy test using Box-Ljung test.

 AR4$coef/sqrt(diag(AR4$var.coef))
##        ar1        ar2        ar3        ar4  intercept 
##  0.9554484  6.0975802  0.4076225 -2.4215870 12.3531993
Box.test(AR4$residuals, lag=12, type="Ljung")
## 
##  Box-Ljung test
## 
## data:  AR4$residuals
## X-squared = 13.95, df = 12, p-value = 0.3039

The P values of the test is high, therefore the use of AR(4) might indeed be suitable.

Now let’s continue our analysis with the MA model. From the ACF it seems that we need to check 3 cases MA(1), MA(2), MA(3):

MA(1):

MA1 <- arima(lag_diff, order=c(0,0,1))
MA1
## 
## Call:
## arima(x = lag_diff, order = c(0, 0, 1))
## 
## Coefficients:
##          ma1  intercept
##       0.0546     0.0082
## s.e.  0.0472     0.0005
## 
## sigma^2 estimated as 6.67e-05:  log likelihood = 931.89,  aic = -1857.78

MA(2):

MA2 <- arima(lag_diff, order=c(0,0,2))
MA2
## 
## Call:
## arima(x = lag_diff, order = c(0, 0, 2))
## 
## Coefficients:
##          ma1     ma2  intercept
##       0.0268  0.3660     0.0082
## s.e.  0.0567  0.0586     0.0006
## 
## sigma^2 estimated as 5.889e-05:  log likelihood = 948.88,  aic = -1889.77

MA(3):

MA3 <- arima(lag_diff, order=c(0,0,3))
MA3
## 
## Call:
## arima(x = lag_diff, order = c(0, 0, 3))
## 
## Coefficients:
##          ma1     ma2     ma3  intercept
##       0.0543  0.3687  0.0695     0.0082
## s.e.  0.0604  0.0580  0.0578     0.0007
## 
## sigma^2 estimated as 5.858e-05:  log likelihood = 949.6,  aic = -1889.21

Comparing the values for AIC (-1857.78, -1889.77, -1889.21) the MA(2) with lowest AIC is recommended.