This assignment involves an analysis of real personal consumption expenditures, using actual historical data. An analysis will be done to see which AR, MA or ARMA model would be a best fit for the data.
Quarterly data of Real Personal Consumption Expenditures from 1947 to 2016 can be found on the FRED website. A graph of this data can be found below.
# import time series for Real Personal Consumption Expenditures
RPCE <- Quandl("FRED/PCECC96", type="ts")
plot(RPCE, main = "Real Personal Consumption Expenditures", sub = "Billions of 2005 Dollars - Seasonally Adjusted")
A time series plot of log changes involving Real Personal Consumption Expenditures $y_t = log c_t = log c_t - log c_{t-1} $ is shown below.
# construct log change in RPCE
RPCE_time <- diff(log(RPCE),lag=1)
plot(RPCE_time, main = "Real Personal Consumption Expenditures - Change of Logs")
In order to find the best model, both the ACF and PACF functions of this data were created. Both the ACF and the PACF for \(y_t\) are plotted below.
par(mfrow=c(2,1))
Acf(RPCE_time,type='correlation')
Acf(RPCE_time,type='partial')
The ACF function has a significant lag at 2 on the x-axis, indicating an MA(2) model. The PACF function has a significant lag at 2 on the x-axis, indicating an AR(2) model. Since there are lags on both models, their was a possibility that an ARMA model might be the best fit. Thus, an ARMA(2,2) model was included in the analysis. A model with one fewer AR and MA term could have been a better fit for the data, so an ARMA(2,1) and ARMA(1,2) model were also created. The MA(2) model had the lowest AIC and BIC scores, indicating that it is the best choice for modeling this data. Analyses for all of these models can be found below.
AR2 <- Arima(RPCE_time, order = c(2,0,0))
AR2
## Series: RPCE_time
## ARIMA(2,0,0) with non-zero mean
##
## Coefficients:
## ar1 ar2 intercept
## 0.0614 0.3185 0.0081
## s.e. 0.0566 0.0566 0.0007
##
## sigma^2 estimated as 5.955e-05: log likelihood=962.67
## AIC=-1917.34 AICc=-1917.2 BIC=-1902.82
MA2 <- Arima(RPCE_time, order = c(0,0,2))
MA2
## Series: RPCE_time
## ARIMA(0,0,2) with non-zero mean
##
## Coefficients:
## ma1 ma2 intercept
## 0.0277 0.3652 0.0082
## s.e. 0.0564 0.0581 0.0006
##
## sigma^2 estimated as 5.878e-05: log likelihood=964.46
## AIC=-1920.92 AICc=-1920.78 BIC=-1906.4
ARMA12 <- Arima(RPCE_time, order = c(1,0,2))
ARMA12
## Series: RPCE_time
## ARIMA(1,0,2) with non-zero mean
##
## Coefficients:
## ar1 ma1 ma2 intercept
## 0.1856 -0.1310 0.3617 0.0082
## s.e. 0.1516 0.1409 0.0598 0.0007
##
## sigma^2 estimated as 5.867e-05: log likelihood=965.21
## AIC=-1920.41 AICc=-1920.19 BIC=-1902.26
ARMA21 <- Arima(RPCE_time, order = c(2,0,1))
ARMA21
## Series: RPCE_time
## ARIMA(2,0,1) with non-zero mean
##
## Coefficients:
## ar1 ar2 ma1 intercept
## 0.0853 0.3164 -0.0267 0.0081
## s.e. 0.1345 0.0579 0.1360 0.0007
##
## sigma^2 estimated as 5.976e-05: log likelihood=962.69
## AIC=-1915.38 AICc=-1915.16 BIC=-1897.23
ARMA22 <- Arima(RPCE_time, order = c(2,0,2))
ARMA22
## Series: RPCE_time
## ARIMA(2,0,2) with non-zero mean
##
## Coefficients:
## ar1 ar2 ma1 ma2 intercept
## 0.1910 -0.0330 -0.1359 0.3911 0.0082
## s.e. 0.1572 0.1798 0.1442 0.1696 0.0007
##
## sigma^2 estimated as 5.888e-05: log likelihood=965.22
## AIC=-1918.45 AICc=-1918.14 BIC=-1896.66
The models were then tested for accuracy. This was done by checking for stationarity and invertibility using plot inverted AR and MA roots. The plots below show that all roots can be found inside of the unit circle, indicating that they pass the test.
plot.Arima(AR2)
plot.Arima(MA2)
plot.Arima(ARMA12)
plot.Arima(ARMA21)
plot.Arima(ARMA22)
The residuals for all of the models were diagnosed below. Based on the p-values for the residuals in the Ljung-Box statistic, only the MA(2), ARMA(1,2) and ARMA(2,2) models are acceptable.
tsdiag(AR2)
tsdiag(MA2)
tsdiag(ARMA12)
tsdiag(ARMA21)
tsdiag(ARMA22)
The quarterly data for Real Personal Consumption Expenditures found on the FRED website were analyzed to find the model that best fit this data. After plotting the ACF and PACF functions of this data, it was determined that five models should be tested to see which one would be chosen as the best fit. The MA(2), ARMA(1,2) and ARMA(2,2) models all seemed to fit the data well, though based on AIC and BIC statistics, it appears that the MA(2) model is the best fit for the data.