| particle_filter_state | R Documentation |
Particle filter internal state. This object is not
ordinarily constructed directly by users, but via the
$run_begin method to particle_filter. It provides
an advanced interface to the particle filter that allows
partially running the particle filter over part of the time
trajectory.
This state object has a number of public fields that you can read but must not write (they are not read-only so you could write them, but don't).
modelThe dust model being simulated
historyThe particle history, if created with
save_history = TRUE. This is an internal format subject to
restart_stateFull model state at a series of points in
time, if the model was created with non-NULL save_restart.
This is a 3d (or greater) array as described in
particle_filter
log_likelihoodThe log-likelihood so far. This starts at 0 when initialised and accumulates value for each step taken.
log_likelihood_stepThe log-likelihood attributable to the
last step (i.e., the contribution to log_likelihood made on the
last call to $step().
current_time_indexThe index of the last completed step.
new()Initialise the particle filter state. Ordinarily this should not be called by users, and so arguments are barely documented.
particle_filter_state$new( pars, generator, model, data, data_split, times, n_particles, has_multiple_parameters, n_threads, initial, index, compare, constant_log_likelihood, gpu_config, seed, min_log_likelihood, save_history, save_restart, stochastic_schedule, ode_control )
parsParameters for a single phase
generatorA dust generator object
modelIf the generator has previously been initialised
dataA particle_filter_data data object
data_splitThe same data as data but split by step
timesA matrix of time step beginning and ends
n_particlesNumber of particles to use
has_multiple_parametersCompute multiple likelihoods at once?
n_threadsThe number of threads to use
initialInitial condition function (or NULL)
indexIndex function (or NULL)
compareCompare function
constant_log_likelihoodConstant log likelihood function
gpu_configGPU configuration, passed to generator
seedInitial RNG seed
min_log_likelihoodEarly termination control
save_historyLogical, indicating if we should save history
save_restartVector of time steps to save restart at
stochastic_scheduleVector of times to perform stochastic updates
ode_controlTuning control for stepper
run()Run the particle filter to the end of the data. This is
a convenience function around $step() which provides the correct
value of time_index
particle_filter_state$run()
step()Take a step with the particle filter. This moves the particle filter forward one step within the data (which may correspond to more than one step with your model) and returns the likelihood so far.
particle_filter_state$step(time_index, partial = FALSE)
time_indexThe step index to move to. This is not the same as the model step, nor time, so be careful (it's the index within the data provided to the filter). It is an error to provide a value here that is lower than the current step index, or past the end of the data.
partialLogical, indicating if we should return the partial likelihood, due to this step, rather than the full likelihood so far.
fork_multistage()Create a new particle_filter_state object based on
this one (same model, position in time within the data) but with
new parameters, to support the "multistage particle filter".
Unlike fork_smc2, here the parameters may imply a different
model shape and arbitrary transformations of the state are
allowed. The model is not rerun to the current point, just
transformed at that point.
particle_filter_state$fork_multistage(model, pars, transform_state)
modelA model object (or NULL)
parsNew model parameters
transform_stateA function to transform the model state
from the old to the new parameter set. See
multistage_epoch() for details.
fork_smc2()Create a new particle_filter_state object based
on this one (same model, position in time within the data) but
with new parameters, run up to the date, to support the smc2()
algorithm. To do this, we create a new
particle_filter_state with new parameters at the beginning of
the simulation (corresponding to the start of your data or the
initial argument to particle_filter) with your new
pars, and then run the filter foward in time until it reaches
the same step as the parent model.
particle_filter_state$fork_smc2(pars)
parsNew model parameters
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.