search for: dlmforecast

Displaying 4 results from an estimated 4 matches for "dlmforecast".

2009 Mar 11
1
Forecasting with dlm
...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]]
2013 Mar 08
0
using dlmModPoly in library dlm
Hi Group, I'm trying to build a model to predict a product's sale price. I'm researching the dlm package. Looks like I should use dlmModPoly, dlmMLE, dlmFilter, dlmSmooth, and finally dlmForecast. I'm looking at the Nile River example and I have a few questions: 1. If I only want to predict future sale price based on observed sale price, I should use a univariate model, correct? 2. how do I initiate value for dV and dW? In the example code: dlmModPoly(1, dV = exp(pa...
2014 Jan 08
0
Strange behaviour of `dlm` package
...r 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(tsdataForecast$R, function(x) sqrt(x[1,1])) pl <- tsdataForecast$a[,1] + qnorm(0.05, sd= sqrtR) pu <- tsdataForecast$a[,1] + qnorm(0.95, sd= sqrtR) x <- ts.union(tsdata,tsdataSmooth$s[,1],tsdataForecast$a[,1],pl,pu) plot(x, plot.type="singl...
2011 Jul 23
2
How to solve ergodic density/distribution using R
May I have a question on how to solve the following problem by R code? Mainly we want to solve the equation show in the attached image. The equation is a continuous version of Markov process. In the equation, we have been able to achieve two things using R code: [1] From year-2009 sample data, we can estimate the marginal density ?f(x ; 2009)? by using R function ?density()? [2] From