Consider the quarterly Real Consumption Expenditures FRED/PCECC96.The data was collected from the Federal Reserve Economic Data Website,it is quarterly data from January 1947 to October 2015 and, It shows that personal consumption expenditures were increasing during the period besides a few exceptions.
RPrice <- read.csv (url("https://research.stlouisfed.org/fred2/data/PCECC96.csv"))
summary(RPrice)
## DATE VALUE
## 1947-01-01: 1 Min. : 1199
## 1947-04-01: 1 1st Qu.: 2212
## 1947-07-01: 1 Median : 4050
## 1947-10-01: 1 Mean : 5004
## 1948-01-01: 1 3rd Qu.: 7465
## 1948-04-01: 1 Max. :11319
## (Other) :270
str(RPrice)
## 'data.frame': 276 obs. of 2 variables:
## $ DATE : Factor w/ 276 levels "1947-01-01","1947-04-01",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ VALUE: num 1199 1219 1223 1224 1230 ...
head(RPrice)
## DATE VALUE
## 1 1947-01-01 1199.4
## 2 1947-04-01 1219.3
## 3 1947-07-01 1223.3
## 4 1947-10-01 1223.6
## 5 1948-01-01 1229.8
## 6 1948-04-01 1244.1
tail(RPrice)
## DATE VALUE
## 271 2014-07-01 10918.6
## 272 2014-10-01 11033.3
## 273 2015-01-01 11081.2
## 274 2015-04-01 11178.9
## 275 2015-07-01 11262.4
## 276 2015-10-01 11319.3
plot(RPrice, xlab="Years 1947-2015", ylab="Bn. of Chained 2005 $ Seasonally Adjusted Annual Rate", main="RealPersonalConsumption Expenditure, Quarterly")
dlogRPrice <- diff(log(RPrice[,2]))
plot(RPrice[2:276,1],dlogRPrice,xlab="Years 1947-2015",ylab="", main="Log-Difference in Real Personal Consumption Expenditures, Quarterly")
The Log-difference of the Real Personal Consumption expenditures is above zero, not a lot of the points are negative. As the years increase the log difference stays positive and closer to zero.
acf(dlogRPrice, type="correlation",lag=200, xlab="Quarterly Lag",ylab="Correlations", main="Sample ACF")
acf(dlogRPrice, type = "partial", lag=200, xlab= "Quarterly lags", ylab="Correlations", main="Sample PACF")
There is exponential decay of correlation towards zero for AR(P) model in the ACF plot and for the MA (q)model in the PACF plot.
ar1 <- arima(dlogRPrice, order=c(1,0,0))
ar1
##
## Call:
## arima(x = dlogRPrice, order = c(1, 0, 0))
##
## Coefficients:
## ar1 intercept
## 0.0893 0.0082
## s.e. 0.0601 0.0005
##
## sigma^2 estimated as 6.65e-05: log likelihood = 932.31, aic = -1858.62
tsdiag(ar1, gof.lag=12)
ar2 <- arima(dlogRPrice, order = c(2,0,0))
ar2
##
## Call:
## arima(x = dlogRPrice, order = c(2, 0, 0))
##
## Coefficients:
## ar1 ar2 intercept
## 0.0599 0.3187 0.0082
## s.e. 0.0571 0.0570 0.0007
##
## sigma^2 estimated as 5.969e-05: log likelihood = 947.06, aic = -1886.13
tsdiag(ar2, gof.lag=12)
ar3 <-arima(dlogRPrice, order = c(3,0,0))
ar3
##
## Call:
## arima(x = dlogRPrice, order = c(3, 0, 0))
##
## Coefficients:
## ar1 ar2 ar3 intercept
## 0.0545 0.3178 0.0166 0.0082
## s.e. 0.0604 0.0571 0.0603 0.0008
##
## sigma^2 estimated as 5.967e-05: log likelihood = 947.1, aic = -1884.2
tsdiag (ar3,gof.lag=12)
Conclusion:AR(2) model has the lowest AIC (-1888.16) and has the lowest p-value in the Ljung-Box and the highest ACF residual, hence the AR(2) will be the best model.
ma1<- arima(dlogRPrice, order=c(0,0,1))
ma1
##
## Call:
## arima(x = dlogRPrice, order = c(0, 0, 1))
##
## Coefficients:
## ma1 intercept
## 0.0546 0.0082
## s.e. 0.0472 0.0005
##
## sigma^2 estimated as 6.671e-05: log likelihood = 931.88, aic = -1857.76
tsdiag(ma1,gof.lag = 12)
ma2<- arima(dlogRPrice, order=c(0,0,2))
ma2
##
## Call:
## arima(x = dlogRPrice, 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.87, aic = -1889.74
tsdiag(ma2,gof.lag = 12)
ma3<- arima(dlogRPrice, order=c(0,0,3))
ma3
##
## Call:
## arima(x = dlogRPrice, 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.59, aic = -1889.18
tsdiag(ma3,gof.lag = 12)
Conclusion: MA(2) model has the lowest AIC (-1889.77) and has the lowest p-value in the Ljung-Box and the highest ACF residual, hence the MA(2) will be the best model.
AR(p) and MA(q), where p = q = 2, represent the best models