The purpose of this assignment is to practice AR model and MA model by using Real Personal Consumption Expenditures.
library(Quandl)
y <- Quandl("FRED/PCECC96", type="zoo")
str(y)
## 'zooreg' series from 1947 Q1 to 2016 Q4
## Data: num [1:280] 1199 1219 1223 1224 1230 ...
## Index: Class 'yearqtr' num [1:280] 1947 1947 1948 1948 1948 ...
## Frequency: 4
A. I graph the time series data without transformation
plot(y, xlab="Years", ylab = "Real Personal Consumption Expenditures")
The graph has a steady increasing trend.
B. I construct the time series using:
\[
y_t = \Delta log_{c_t} = log_{c_t} - log_{c_{t-1}}
\]
where \(c_{t}\) is the original quarterly Real Personal Consumption Expenditures.
dly <- diff(log(y))
plot(dly,xlab="Time", ylab="yt")
The graph is approximately stationary.
library(forecast)
par(mfrow=c(2,1), cex=1, mar=c(3,4,3,3))
Acf(dly, type='correlation', lag=36)
Acf(dly, type='partial', lag=36)
In the results, the second lag in ACF and the second and fourth lag in PACF are significant.
Therefore, I will examine the following
- AR(2) Model
- MA(2) Model
- MA(4) Model
m1 <- Arima(dly, order=c(2,0,0))
m1
## Series: dly
## 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
tsdiag(m1, gof.lag=24)
plot.Arima(m1)
BIC(m1)
## [1] -1902.818
m2 <- Arima(dly, order=c(0,0,2))
m2
## Series: dly
## 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
tsdiag(m2, gof.lag=24)
plot.Arima(m2)
BIC(m2)
## [1] -1906.397
m3 <- Arima(dly, order=c(0,0,4))
m3
## Series: dly
## ARIMA(0,0,4) with non-zero mean
##
## Coefficients:
## ma1 ma2 ma3 ma4 intercept
## 0.0555 0.3671 0.0715 -0.0045 0.0082
## s.e. 0.0600 0.0605 0.0575 0.0742 0.0007
##
## sigma^2 estimated as 5.887e-05: log likelihood=965.23
## AIC=-1918.46 AICc=-1918.15 BIC=-1896.68
tsdiag(m3, gof.lag=24)
plot.Arima(m3)
BIC(m3)
## [1] -1896.676
A. AIC: MA(2) has the smallest value(AIC=-1920.92). B. BIC: MA(2) has the smallest value(BIC=-1906.397). C. P-value for Ljung-Box statistic: MA(4) has many significant lag(lag 1 to lag 7) but MA(2) and AR(2) also have significant lags. D. Adequacy : In AR(2), MA(2), and MA(4) model, all roots are in the unit circle. Thus, all model are stationary and invertible
Therefore, MA(2) model is the best among models.