search for: nahead

Displaying 3 results from an estimated 3 matches for "nahead".

Did you mean: ahead
2011 Feb 22
0
Problem with forward prediction using StructTS output
I am having problems with forward prediction using the output of the Basic Structural Model from StructTS. The following snippet illustrates the problem: t_end <- 139 nahead <- 20 data(AirPassengers) ap <- log10(AirPassengers)-2 fit <- StructTS(ts(ap[1:t_end], freq=12), type="BSM") p <- stats:::predict.StructTS(fit, n.ahead=nahead) plot(1:t_end, ap[1:t_end], xlim=c(0,t_end+nahead), type="l", ylim=c(0,1.2)) points((t_end+1):(t_end+nahead)...
2014 Jan 08
0
Strange behaviour of `dlm` package
...- 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="single", type="l...
2009 Mar 11
1
Forecasting with dlm
...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]]