chopthin {chopthin}R Documentation

The Chopthin Resampler

Description

A fast implementation of the Chopthin resampler. Can be used as the resampling step in particle filters and in sequential Monte Carlo.

Usage

chopthin(w, N, eta = 5.828427, normalise = TRUE, checks = TRUE)

Arguments

w

a vector of weights

N

target number of particles

eta

upper bound on the ratio between the weights. Must be >=4. If eta=Inf then only thinnig is performed, requiring the number of weights to be at least N.

normalise

Flag for controlling if the returned weights should be normalised. If TRUE (default) then the sum of the returned weights will sum to N. If FALSE then the returned weights have the same sum as the original weights (within the numerical precision).

checks

Flag controlling if checks on the input and the result should be performed. Default TRUE.

Value

A list with two elements: new weights and indices of the ancestors of the new particles. The weights are normalised to add up to N.

References

A Gandy and F. D-H Lau. The chopthin algorithm for resampling. IEEE Transactions on Signal Processing, 64(16):4273–4281, 2016

Examples

chopthin(runif(10),N=10)
chopthin(runif(10),N=20,4)
chopthin(runif(10),N=5)
chopthin(runif(10),N=1)

[Package chopthin version 0.2.2 Index]