Skip to contents

Create a particle filter object

Usage

dust_filter_create(
  generator,
  time_start,
  data,
  n_particles,
  n_groups = NULL,
  dt = 1,
  index_state = NULL,
  n_threads = 1,
  preserve_group_dimension = FALSE,
  seed = NULL
)

Arguments

generator

A system generator object, with class dust_system_generator. The system must support compare_data to be used with this function.

time_start

The start time for the simulation - this is typically before the first data point. Must be an integer-like value.

data

The data to fit to. This can be a data.frame, in which case it will be passed into dust_filter_data for validation, or it can be a dust_filter_data-augmented data.frame. The times for comparison will be taken from this, and time_start must be no later than than the earliest time.

n_particles

The number of particles to run. Larger numbers will give lower variance in the likelihood estimate but run more slowly.

n_groups

The number of parameter groups. If NULL, this will be taken from data. If given, then the number of groups in data will be checked against this number.

dt

The time step for discrete time systems, defaults to 1 if not given. It is an error to provide a non-NULL argument with continuous-time systems.

index_state

An optional index of states to extract. If given, then we subset the system state on return. You can use this to return fewer system states than the system ran with, to reorder states, or to name them on exit (names present on the index will be copied into the rownames of the returned array).

n_threads

Integer, the number of threads to use in parallelisable calculations. See Details.

preserve_group_dimension

Logical, indicating if state and output from the system should preserve the group dimension in the case where a single group is run. In the case where more than one group is run, this argument has no effect as the dimension is always preserved.

seed

Optionally, a seed. Otherwise we respond to R's RNG seed on initialisation.

Value

A dust_likelihood object, which can be used with dust_likelihood_run