econirl.Trajectory

class econirl.Trajectory(states, actions, next_states, individual_id=None, metadata=<factory>)[source]

Bases: object

A single individual’s observed decision trajectory.

Represents the sequence of states, actions, and next states observed for one decision-maker over time. This is the fundamental unit of observation in dynamic discrete choice estimation.

Variables:
  • states (jax.jaxlib._jax.Array) – Array of shape (T,) containing state indices at each period

  • actions (jax.jaxlib._jax.Array) – Array of shape (T,) containing chosen action at each period

  • next_states (jax.jaxlib._jax.Array) – Array of shape (T,) containing state after transition

  • individual_id (str | int | None) – Optional identifier for the individual

  • metadata (dict[str, Any]) – Optional dictionary for additional trajectory-level data

Parameters:
  • states (Array)

  • actions (Array)

  • next_states (Array)

  • individual_id (str | int | None)

  • metadata (dict[str, Any])

Example

>>> traj = Trajectory(
...     states=jnp.array([0, 5, 12, 18]),
...     actions=jnp.array([0, 0, 0, 1]),
...     next_states=jnp.array([5, 12, 18, 0]),
...     individual_id="bus_001"
... )
states: Array
actions: Array
next_states: Array
individual_id: str | int | None = None
property num_periods: int

Number of time periods observed.

__init__(states, actions, next_states, individual_id=None, metadata=<factory>)
Parameters:
  • states (Array)

  • actions (Array)

  • next_states (Array)

  • individual_id (str | int | None)

  • metadata (dict[str, Any])

Return type:

None