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
rprocand draws synthetic observations fromrmeas. 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
ysindex.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 itsysreplaced by one simulation from the first parameter set. Overridesnsimto1. Defaults toFalse.
- Returns:
If
as_pomp=False(default): a(states_df, obs_df)tuple of long-format DataFrames. Each has columnstheta_idx,sim,time, plus one column per state/observation variable.If
as_pomp=True: a newPompinstance whoseyscontains the simulated observations for the first parameter replicate.- Return type:
tuple of (pd.DataFrame, pd.DataFrame) or Pomp
See also
pypomp.functional.simulatePure-functional JAX simulation.
Examples
>>> model.fresh_key = jax.random.key(1) >>> states, obs = model.simulate(nsim=50) >>> obs.head()