create_particle: Create a particle object

View source: R/importance_sampling_functions.R

create_particleR Documentation

Create a particle object

Description

Creates an R environment to contain the particles for SMC Fusion

Usage

create_particle(samples, multivariate, number_of_steps = 2)

Arguments

multivariate

logical value indicating if the samples are multivariate (TRUE) or not (FALSE)

number_of_steps

integer value for number of steps in the Fusion algorithm (default is 2 for Monte Carlo Fusion)

samples_to_fuse

a list of samples (vector if univariate, matrix is multivariate) that you wish to perform fusion with

Value

A particle environment with components

y_samples

samples for y in particle set (initialised as the samples given)

x_samples

a list where x_samples[[i]] is the ith x sample for in particle set (all initialised as NA)

x_mean

the corresponding means for x_samples (initialised as NA)

log_weights

associated logarithm of the weights (initialised as the logarithm of 1/number of samples)

normalised_weights

associated normalised weights (initialised as 1/number of samples)

ESS

effective sample size of particles (initialised as the number of samples)

CESS

conditional effective sample size of particles after each step of the algorithm (initialised as NA for each step)

resampled

logical value to indicate if particles have been resampled after each step (initialised as FALSE for each step besides the last step, which is set to TRUE)

number_of_steps

number of steps in the Fusion algorithm (initialised as the number_of_steps provided)

N

Number of particles

Examples

p <- create_particle(samples = rnorm(10, 0, 1), multivariate = FALSE)


rchan26/hierarchicalFusion documentation built on Sept. 11, 2022, 10:30 p.m.