Compute a log likelihood based on a dynamical model, either from particle filter (created with dust_filter_create) or a deterministic model (created with dust_unfilter_create).
Usage
dust_likelihood_run(
obj,
pars,
initial = NULL,
save_trajectories = FALSE,
adjoint = NULL,
index_state = NULL,
index_group = NULL
)
Arguments
- obj
A
dust_filter
object, created by dust_filter_create or adust_unfilter
object created by dust_unfilter_create- pars
Optional parameters to compute the likelihood with. If not provided, parameters are not updated
- initial
Optional initial conditions, as a matrix (state x particle) or 3d array (state x particle x group). If not provided, the system initial conditions are used.
- save_trajectories
Logical, indicating if the trajectories from the simulation history should be saved while the simulation runs; this has a small overhead in runtime and in memory. Particle trajectories will be saved at each time for which you have data. If
index_state
is non-NULL
, the trajectories are limited to these states.- adjoint
Optional logical, indicating if we should enable adjoint history saving. This is enabled by default if your model has an adjoint, but can be disabled or enabled even when your model does not support adjoints! But if you don't actually have an adjoint you will not be able to compute gradients. This has no effect for stochastic models.
- index_state
An optional vector of state indices to save where
save_trajectories
isTRUE
. If omitted all state is saved and ifsave_trajectories = FALSE
this has no effect.- index_group
An optional vector of group indices to run the calculation for. You can use this to run a subset of possible groups, once
obj
is initialised (this argument must beNULL
on the first call).