View source: R/importance_sampling_functions.R
resample_particle_x_samples | R Documentation |
Resamples the particle set for the samples for x
resample_particle_x_samples( N = particle_set$N, particle_set, multivariate, step = 1, resampling_method = "multi", seed = NULL )
N |
number of samples (default is particle_set$N) |
particle_set |
particle object (see initialise_particle_set) |
multivariate |
logical value indicating if the particles are multivariate (TRUE) or not (FALSE) |
step |
the step of the algorithm is this is resampling for |
resampling_method |
method to be used in resampling, default is multinomial resampling ('multi'). Other choices are stratified resampling ('strat'), systematic resampling ('system'), residual resampling ('resid') |
seed |
seed number - default is NULL, meaning there is no seed |
resampled particle set. Returns the same set if it has already been resampled
samples_to_fuse <- lapply(1:2, function(i) rnorm(100, 0, 1)) particles_to_fuse <- initialise_particle_sets(samples_to_fuse = samples_to_fuse, multivariate = FALSE) precondition_values <- sapply(samples_to_fuse, var) particles <- rho_IS_univariate(particles_to_fuse = particles_to_fuse, N = 100, m = 2, time = 0.5, precondition_values = precondition_values) particles <- resample_particle_x_samples(particle_set = particles, multivariate = FALSE, resampling_method = 'resid', seed = 21)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.