Several methods of calculating
, the number of times
appears in the sample, are available:
-
•Multinomial Resampling:
The vector of counts; is drawn from a multinomial distribution with probabilities given by the normalised weights, .
-
•Systematic Resampling:
where are the normalised weights, , , for and is defined to be zero.
In other words, is the number of shifted and scaled uniform variates contained in bins defined by the partial sums of normalised weights.
-
•Residual Resampling:
,
where (i.e. the integer part of ), and the vector of residual counts, is drawn from a multinomial distribution with probabilities given by .
See
g05tgc for more information on the multinomial distribution and
Douc et al. (2005) for more details on the resampling methods.
One of the initialization functions
g05kfc (for a repeatable sequence if computed sequentially) or
g05kgc (for a non-repeatable sequence) must be called prior to the first call to
g05nfc.
Douc R,
Cappe O, and
Moulines E
(2005)
Comparison of resampling schemes for particle filtering
Proceedings of the 4th International Symposium on Image and Signal Processing and Analysis
64–69
https://dx.doi.org/10.1109/ISPA.2005.195385
Li T,
Bolic M, and
Djuric P M
(2015)
Resampling Methods for Particle Filtering: Classification, implementation, and strategies
IEEE Signal Processing Magazine
vol. 32, no. 3
70–86
https://dx.doi.org/10.1109/MSP.2014.2330626
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
- NE_ARRAY_SIZE
-
On entry, ,
and .
Constraint: .
On entry, ,
and .
Constraint: .
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: or .
On entry, .
Constraint: , or .
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
- NE_INVALID_STATE
-
On entry,
state vector has been corrupted or not initialized.
- NE_NEG_WEIGHT
-
On entry, and .
Constraint: .
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library CL Interface for further information.
- NE_NON_ZERO_WEIGHTS
-
On entry, all the weights are zero.
Constraint: at least one weight must be nonzero.
- NW_POTENTIAL_PROBLEM
-
There was no random component to the sample. Check the sample size and weights are as expected.
Specifically, check that more than one weight is nonzero.
If
, also check the combination of
m and weights.
Not applicable.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
It should be noted that whilst a given sample is a random selection from
, the ordering of the sample within
isampl may not be. For example, when
the values returned are likely to be in the same order that the values appear in
. If it is important that the returned values represent a random sample from
rather than a ordered random sample then each sample should be randomly permuted via a subsequent call to
g05ncc. The same applies to the order in which multiple samples are returned. One consequence of this is that if you call
g05nfc once with
, say, and then again (using the same initial values for
state), with
the first column of
ISAMPL may not be the same in both cases since, on the second call, the sample from the first call may be returned in the second column rather than the first.
See also
g05ndc,
g05nec and
g05tlc for other types of sampling.
This example draws five samples of twenty five from a population of the same length and prints out the values.