Displaying 1 result from an estimated 1 matches for "tsdatafilt".
Did you mean:
msdatafile
2014 Jan 08
0
Strange behaviour of `dlm` package
...hotann)
buildfun <- function (x) {
dlmModPoly(order = 2, dV = exp(x[1]), dW = c(0,exp(x[2])))
}
fit <- dlmMLE(y=tsdata, parm=c(0,0), build=buildfun)
# Warning: a numerically singular 'V' has been slightly perturbed to make it
nonsingular
fit$conv
dlmTsdata <- buildfun(fit$par)
tsdataFilter <- dlmFilter(tsdata, mod=dlmTsdata)
tsdataSmooth <- dlmSmooth(tsdata, mod=dlmTsdata)
plot(tsdata, lwd=2)
for (i in 1:10)
lines(lty=6, col="blue", dropFirst(dlmBSample(tsdataFilter))[,1])
# looks ok!
tsdataForecast <- dlmForecast(tsdataFilter, nAhead=20)
sqrtR <- sapply(...