ksimulate {sspir} | R Documentation |
Draws N samples from the conditional distribution of theta_1,...,theta_n given y_1,...,y_n in a Gaussian state space model.
ksimulate(ss, N = 1)
ss |
an object of class SS with components m
and C obtained from running kfilter . |
N |
an integer giving the number of simulated realizations wanted. |
An array of dimension n times p times N. The i'th
simulated state vector at time t is located in [t,,i]
.
Claus Dethlefsen and Søren Lundbye-Christensen.
C.K. Carter and R. Kohn (1994). On Gibbs Sampling for State Space Models. Biometrika, 3, 541-553.
data(kurit) m1 <- SS(kurit) phi(m1) <- c(100,5) m0(m1) <- matrix(130) C0(m1) <- matrix(400) m1 <- kfilter(m1) m1.s <- smoother(m1) sim <- ksimulate(m1,10) plot(kurit) for (i in 1:10) lines(sim[,,i],lty=2,col=2) lines(smoother(m1)$m,lwd=2)