-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Load greybox in order to do lags and leads of an explanatory variable:
library(greybox)
Prepare the data for the example
ourData <- vector("list")
ourData$y <- BJsales
ourData <- cbind(ourData,as.data.frame(xregExpander(BJsales.lead,c(-7:7))))
- Run mapa with explanatory variables:
mapa(ourData$y, ppy=12, fh=10, outplot=1, type="es", xreg=ourData[,2:3])
And end up with an error, which does not make much sense:
Error in mapaest(y = y, ppy = ppy, minimumAL = minimumAL, maximumAL = maximumAL, :
Number of observations of xreg must be equal of exceed the length of y.
- The following stuff also gives an error:
mapa(ourData$y, ppy=12, fh=10, outplot=1, type="es", xreg=as.matrix(ourData[,2:3]))
This one:
Error in mapacalc(y, mapafit, fh, comb, outplot = 0, hybrid, xreg = xreg) :
Number of observations of xreg must be equal of exceed the length of y + fh.
- If you run this
mapa(ourData$y[1:140], ppy=12, fh=10, outplot=1, type="es", xreg=as.matrix(ourData[,2:3]))
you get:
Error in `[.default`(fit$states, (q + 1 + init.obs):(q + ppyA + init.obs), : subscript out of bounds
Overall, I cannot figure out how to construct MAPAx and produce forecasts. This could be one of the issues of the smooth I use (it's github version, 2.5.0), or I could be doing something wrong...