Skip to content

A weird errors in MAPAx #6

@config-i1

Description

@config-i1

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))))

  1. 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.

  1. 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.

  1. 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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions