simulate: Forwards filtering Backwards sampling

Description Usage Arguments Value Author(s) References See Also Examples

Description

Draws N samples from the conditional distribution of θ_1,…,θ_n given y_1,…,y_n in a Gaussian state space model.

Usage

1
ksimulate(ss, N = 1)

Arguments

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.

Value

An array of dimension n \times p \times N. The i'th simulated state vector at time t is located in [t,,i].

Author(s)

Claus Dethlefsen and Søren Lundbye-Christensen.

References

C.K. Carter and R. Kohn (1994). On Gibbs Sampling for State Space Models. Biometrika, 3, 541-553.

See Also

ssm, kfilter, smoother.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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)

ClausDethlefsen/sspir documentation built on May 6, 2019, 7 p.m.