Is Miss Stagflation coming to visit?

The Misery index is the sum of inflation and unemployment rate. We would like them both to stay naturally low, and we are miserable when they are not. The index is currently floating in it’s record scratching levels. In this post I demonstrate the use of the nice *FitAR* package in R to fit an AR model and see what we can expect accordingly. Inflation and unemployment numbers concerning the Eurozone (17 countries) can be found here.

Have a look at the index over time:

An autoregressive model seems to be a reasonable idea and the

*FitAR*package in R is quite flexible so lets use that one. Among the many options you can specify, you can select which lags are more influential according to some criterion. Our data is of monthly frequency so a maximum lag of 12 is a reasonable choice. Once we specify the maximum number of lags we can search for the best subset, according for example to AIC or BIC. The obvious advantage of such a model is its flexibility. We don’t need to model all 12 lags if, say, lag numbers 2 and 4 are not important. In that case, they will be omitted in the selection stage. On the downside, we lose the interpretation, go figure what is the meaning of a selection process which ends up with lags number 4,5 and 10.

A nice feature of the *FitAR* package is that the function *SelectModel* selects the lags in a smart way (according to some algorithm). So we do not scan all possibilities which will take forever, see reference below. The next two figures outline the number of variables and lag order chosen for the two most common criteria, *BIC *and *AIC*. There are four graphs corresponding with the maximum number of lags allowed, 6,12,18,24. The three different results correspond with the best three lag structures. You can see how much more likely is the best selection relative to its first runner-up on the right axis, this provides some confident when the difference is large. The left axis is just the value of the criterion, lower is better.

We can see that the BIC criterion is much more restrictive. We can see lag number one is important, as well as lag number two, though to a lesser extent according to Mr. BIC.

Next is to see what these models tell us about the future. The following figure present the forecast for the next 24 months (BIC only):

The short memory models in the upper half predict that things will get better. However, the “grownup” models, which have longer memory and can tell you something about life, predict that Miss Stagflation is here to stay. Time will tell, I might have a look at the index in the future to see how these forecasts fare. Code and references are below. Thanks for reading.

**Notes**:

1. ARz means I used standard OLS for the lag structure selection. ARp will give you an ARIMA style which makes interpretation even harder.

2. there is also a good movie called Misery.

**Code**:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
options(digits = 4) ; library(FitAR) y = ts(rev(read.table("/mindex1.txt",sep = "\t",header = F)[,2]) ,frequency = 12, start = c(1995,1) ) par(mfrow=c(1,1)) plot(y, main = "Misery Index over Time", ylab = "Index", lwd = 2,ty = "b",cex.main = 2) # Function to plot according to Criterion critfun = function(crit){ ff = list() s <<- seq(6,24,6) par(mfrow = c(2,2)) for (i in 1:4){ ff[[i]] = SelectModel(y,lag.max = s[i], ARModel="ARz", Criterion = crit,Best = 3,Candidates = 5) plot(ff[[i]]) } list(ff = ff) } ff2 = critfun("BIC") # or "AIC", and there are more options #ARp models the R function arima is used #ARz algorithm of McLeod & Zhang (2006) ## Create forecasts - 2 years ahead ff3 = list() ; prediction = matrix(nrow = 24,ncol = 4) ; ycon = list() for (i in 1:4){ ff3[[i]] <- FitAR(y, ff2$ff[[i]][[1]]$p, ARModel="ARz") prediction[,i] = ts(as.numeric(predict(ff3[[i]], n.ahead=24)$Forecasts),start = c(2012,4), frequency = 12) ycon[[i]] = cts(y, prediction[,i]) # concatenate the original with the forecats plot(window(ycon[[i]], start = c(1995,1)), type = "n" , ylab = "Misery Index", main = paste("24 months ahead forecasts, Max.lag is",s[i] )) ycon2 = window(ycon[[i]],start = c(1995,1), end = c(2012,3)) ycon3 = window(ycon[[i]],start = c(2012,4) ) lines.ts(ycon2,col= 1,type="o", lwd=2, pch=16) lines.ts(ycon3,col= (i+1),type="o",lwd=2, pch=16) } |

**Resources:**

PARTIAL AUTOCORRELATION PARAMETERIZATION FOR SUBSET AUTOREGRESSION

Time Series Analysis: Forecasting and Control

**Price:** $116.00

(10 customer reviews)

**46 used & new** available from $47.00