Package 'chopthin'

Title: The Chopthin Resampler
Description: Resampling is a standard step in particle filtering and in sequential Monte Carlo. This package implements the chopthin resampler, which keeps a bound on the ratio between the largest and the smallest weights after resampling.
Authors: Axel Gandy and F. Din-Houn Lau
Maintainer: Axel Gandy <[email protected]>
License: GPL-3
Version: 0.2.2
Built: 2024-11-20 03:49:37 UTC
Source: https://github.com/cran/chopthin

Help Index


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)