Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dlmBSample

Draw from the posterior distribution of the state vectors


Description

The function simulates one draw from the posterior distribution of the state vectors.

Usage

dlmBSample(modFilt)

Arguments

modFilt

a list, typically the ouptut from dlmFilter, with elements m, U.C, D.C, a, U.R, D.R (see the value returned by dlmFilter), and mod The latter is an object of class "dlm" or a list with elements GG, W and, optionally, JGG, JW, and X

Details

The calculations are based on singular value decomposition.

Value

The function returns a draw from the posterior distribution of the state vectors. If m is a time series then the returned value is a time series with the same tsp, otherwise it is a matrix or vector.

Author(s)

Giovanni Petris GPetris@uark.edu

References

Giovanni Petris (2010), An R Package for Dynamic Linear Models. Journal of Statistical Software, 36(12), 1-16. http://www.jstatsoft.org/v36/i12/.
Petris, Petrone, and Campagnoli, Dynamic Linear Models with R, Springer (2009).
West and Harrison, Bayesian forecasting and dynamic models (2nd ed.), Springer (1997).

See Also

See also dlmFilter

Examples

nileMod <- dlmModPoly(1, dV = 15099.8, dW = 1468.4)
nileFilt <- dlmFilter(Nile, nileMod)
nileSmooth <- dlmSmooth(nileFilt) # estimated "true" level
plot(cbind(Nile, nileSmooth$s[-1]), plot.type = "s",
     col = c("black", "red"), ylab = "Level",
     main = "Nile river", lwd = c(2, 2)) 
for (i in 1:10) # 10 simulated "true" levels 
    lines(dlmBSample(nileFilt[-1]), lty=2)

dlm

Bayesian and Likelihood Analysis of Dynamic Linear Models

v1.1-5
GPL (>= 2)
Authors
Giovanni Petris [aut, cre], Wally Gilks [ctb] (Author of original C code for ARMS)
Initial release
2018-05-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.