pypomp.Pomp.simulate

Pomp.simulate(key: jax.Array | None = None, theta: PompParameters | None = None, times: jax.Array | None = None, nsim: int = 1, as_pomp: bool = False) tuple[pd.DataFrame, pd.DataFrame] | Pomp

Simulate latent states and observations from the POMP model.

Propagates the latent state through time via rproc and draws synthetic observations from rmeas. JAX vectorises the computation across parameter sets and simulation replicates simultaneously.

Parameters:
  • key (jax.Array or None, optional) – JAX random key. Defaults to fresh_key.

  • theta (PompParameters or None, optional) – Parameter set(s) to simulate from. Defaults to theta.

  • times (jax.Array or None, optional) – Observation times at which to simulate. Defaults to the original ys index.

  • nsim (int, optional) – Number of independent simulation replicates per parameter set. Defaults to 1.

  • as_pomp (bool, optional) – If True, return a deep copy of this model with its ys replaced by one simulation from the first parameter set. Overrides nsim to 1. Defaults to False.

Returns:

If as_pomp=False (default): a (states_df, obs_df) tuple of long-format DataFrames. Each has columns theta_idx, sim, time, plus one column per state/observation variable.

If as_pomp=True: a new Pomp instance whose ys contains the simulated observations for the first parameter replicate.

Return type:

tuple of (pd.DataFrame, pd.DataFrame) or Pomp

See also

pypomp.functional.simulate

Pure-functional JAX simulation.

Examples

>>> model.fresh_key = jax.random.key(1)
>>> states, obs = model.simulate(nsim=50)
>>> obs.head()