4. How-to Guides

TODO: provide worked examples of specific tasks.

4.1. Creating your own model

4.2. Creating your own observation model

4.3. Defining prior distributions

4.4. Provide models with lookup tables

4.5. Provide observation models with lookup tables

An observation model may allow some of its parameters to be defined in lookup tables, rather than as fixed values. This allows parameters to differ between particles and to vary over time.

Note

The observation model must support using lookup tables for parameter values. The example shown here uses the epifx.obs.PopnCounts observation model, which allows the observation probability to be defined in a lookup table.

To use a lookup table for an observation model parameter, the scenario must:

  • Define the lookup table by giving it a name (in this example, "pr_obs") and identifying the data file to use (in this example, "pr-obs.ssv");
  • Notify pypfilt that each particle should be associated with a column from this lookup table, by adding the table’s name to the "sample_lookup_tables" list; and
  • Notify the observation model that it should use this lookup table for the observation probability, by providing it as an argument to the observation model’s constructor (in this example, the argument name is "pr_obs_lookup").

These steps are illustrated in the following TOML excerpt, which shows only the relevant lines:

[scenario.test]
sample_lookup_tables = ["pr_obs"]

[scenario.test.lookup_tables]
pr_obs = "pr-obs.ssv"

[scenario.test.observations.cases]
model = "epifx.obs.PopnCounts"
init.pr_obs_lookup = "pr_obs"

4.6. Using lookup tables in your own models

4.7. Using lookup tables in your own observation models

4.8. Defining and using parameters

4.9. Particle filter: resampling

4.10. Particle filter: post-regularisation

4.11. Creating summary tables

4.12. Creating summary monitors