An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090311/5bd77284/attachment-0002.pl>
Forecasting with dlm
2 messages · Michael Pearmain, Giovanni Petris
Hi Michael, There was a bug in dlmForecast that I have fixed. While the new version of the package makes its way to CRAN, you can source the attached file, which contains the amended version of dlmForecast. Best, Giovanni Petris
Date: Wed, 11 Mar 2009 13:39:36 +0000
From: Michael Pearmain <mpearmain at google.com>
Sender: r-help-bounces at r-project.org
Precedence: list
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;
t=1236778779; bh=FXcHfXd155+Rn9gFIVOikSMaQWI=;
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;
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 at 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.
Giovanni Petris <GPetris at uark.edu> Associate Professor Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) http://definetti.uark.edu/~gpetris/