Hi All,
I have a problem trying to forecast using the dlm package, can anyone offer
any advise?

I setup my problem as follows, (following the manual as much as possible)

data for example to run code

CostUSD <- c(27.24031,32.97051, 38.72474, 22.78394, 28.58938, 49.85973,
42.93949, 35.92468)
library(dlm)

buildFun <- function(x) {
dlmModPoly(1, dV = exp(x[1]), dW = exp(x[2]))
}
fit <- dlmMLE(CostUSD, parm = c(0,0), build = buildFun)
fit$conv
dlmCostUSD <- buildFun(fit$par)
V(dlmCostUSD)
W(dlmCostUSD)
#For comparison
StructTS(CostUSD, "level")

CostUSDFilt <- dlmFilter(CostUSD, dlmCostUSD)
CostUSDFore <- dlmForecast(CostUSDFilt, nAhead = 1)

after which i return the error message:

Error in mod$m[lastObsIndex, ] : incorrect number of dimensions

Can anyone offer any insight to this problem?

Thanks in advance

Mike

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to