**Eran Raviv » R**, and kindly contributed to R-bloggers)

Five months ago I generated forecasts for the Eurozone Misery index. I used the built-in “FitAR” package in R. Using different models differing in their memory length (how many lags were considered for each model) 24 months ahead forecasts were generated. Might be interesting to see how accurate are the forecasts. The previous post is updated and few bugs corrected in the code. The updated data is public and can be found here. It is the sum of inflation rate and unemployment rate in the Euro-zone area.

To preview the results, last post showed that the short memory models predict the index to decline while the long memory models predict it to stay at current relatively high levels. Five months later..

Well, (1) both models were surprised by the April jump in the index. (2) longer memory performed uniformly better. The July forecast could not be more accurate and it seems that indeed the econometric model captures Euro-zone issues quite well. The model does not let the index revert to its historical mean yet, which is consistent with the issues at hand (Greek debt etc.) as well as with Okun’s law, which is that output and employment commonly move together.

Empirically, unemployment tends to fall by 1 percentage point for every 3-percentage point rise in output. In the Euro-zone, output growth is weak these days. In accordance with the Keynesian multiplier, it draws us down, and will keep on doing so in the near future. Implicitly, the claim here is that the index is struggling due to unemployment rate, and not because price level (inflation) is rising. See that it is the case:

We are looking at the very end of these curves. You can see the black line (inflation) declines slightly while the red (unemployment) rise. From September 2011, the inflation rate declined from 3% to 2.5% while unemployment rate rose from 10.34 to 11.44. Sticky unemployment indeed. As always, code is given below, for the data scroll up to the link made public. Thanks for reading.

^{?}View Code RSPLUS

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) act = head(read.table("https://dl.dropbox.com/u/9409065/mindex-08-12.txt", sep = "\t",header = F)[,2] ,5) # Only 5 months past wid = 3.5 plot(act , ty = "b", ylim = c(13.4,14.2), lwd = wid, x axt = "n", main = "Forecasts and actual values", xlab = " ",ylab = "Value") axis(side = 1,at = c(1:5), labels = c("Apr", "May","Jun", "July","Aug") ) points(prediction[1:5,1],col = 4, lwd = wid, ty = "b") #short memory model points(prediction[1:5,4],col = 2, lwd = wid, ty = "b") #long memory model legend("topright",c("Acutal", "Long memory model", "Short memory model"), bty = "n", col = c(1,2,4), lty = 1 , lwd = wid, text.col = c(1,2,4) ) ### Individual components plot mindexsep = read.table("https://dl.dropbox.com/u/9409065/mindexComp-08-12.txt",sep = "\t", header = T)[,2:3] # don't want to handle the dates so drop the first column. matplot(mindexsep, ty = "l", lwd = wid, main = "Misery Index components", ylab = "Value", xlab = "Time", cex.main = 1.5) legend(y = 6, x = 100, rev(c(names(mindexsep))), lty= c(2,1), col = c(2,1), bty = "n", lwd = wid , cex = 2) } |

**leave a comment**for the author, please follow the link and comment on his blog:

**Eran Raviv » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...