blockpfGaussianOpt
function provides a simple example for
RcppSMC. It is based on a block sampling particle filter for a linear
Gaussian model. This is intended only to illustrate the potential of block
sampling; one would not ordinarily use a particle filter for a model in
which analytic solutions are available. The 'optimal' block sampler in the
sense of Doucet, Briers and Senecal (2006) can be implemented in this case. The simGaussian
function simulates data from the associated linear
Gaussian state space model.
blockpfGaussianOpt(data, particles=1000, lag=5, plot=FALSE) simGaussian(len)
blockpfGaussianOpt
function returns a matrix containing the final
sample paths and a vector containing their weights.The simGaussian
function returns a list containing the state and data
sequences.
blockpfGaussianOpt
function provides a simple example for
RcppSMC. It is based on a simple linear Gaussian state space model in
which the state evolution and observation equations are:
x(n) = x(n-1) + e(n) and
y(n) = x(n) + f(n)
where e(n) and f(n) are mutually-independent standard normal random
variables. The 'optimal' block-sampling proposal described by Doucet
et al (2006) is employed. The simGaussian
function simulates from the same model returning both
the state and observation vectors.
sim <- simGaussian(len=250)
res <- blockpfGaussianOpt(sim$data,lag=5,plot=TRUE)
Run the code above in your browser using DataLab