Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Grids and stochastic processes

A grid defines a variable’s numerical outcome space. A stochastic process defines both an outcome grid and its transition mechanism.

Lifecycle and categorical grids

The explicit ordered flag matters: interpolation and comparison may use ordering only when the economics declares it.

Continuous grids

ClassDeclaration
LinSpacedGrid(start, stop, n_points)Uniform linear spacing
LogSpacedGrid(start, stop, n_points)Uniform spacing after log transform
IrregSpacedGrid(points)Explicit sorted nodes
PiecewiseLinSpacedGrid(start, stop, breakpoints, points_per_segment)Linear segments with independently controlled density
PiecewiseLogSpacedGrid(start, stop, breakpoints, points_per_segment)Log-spaced segments
GridBreakpoint(value, owner=...)Interior boundary and which adjacent segment owns it

Piecewise grids control grid density at known locations. They do not declare an economic budget kink to a specialized solver. Use case pieces or a piecewise-affine schedule for that structure.

Stochastic processes

Place process instances in states and omit their names from state_transitions:

ProcessMeaning
UniformIIDProcessIID uniform draws
NormalIIDProcessIID normal draws
LogNormalIIDProcessIID log-normal draws
NormalMixtureIIDProcessIID normal-mixture draws
TauchenAR1ProcessAR(1) discretized by Tauchen
RouwenhorstAR1ProcessAR(1) discretized by Rouwenhorst
TauchenNormalMixtureAR1ProcessMixture innovation with Tauchen-style discretization

A process owns its transition mechanism. Adding a second law under state_transitions is an ambiguous declaration and is rejected.

StateConditioned lets process parameters depend on a categorical state. Use it when one named process changes distribution across observable states without changing the model’s state vocabulary. The conditioning categories and parameter leaves must align with the declared categorical grid.

Every IID process supports fold=True when used as a state. The solve still evaluates utility and the action choice at every shock node, then averages the process axis with its own weights before storing the period value. Simulation still draws and publishes the realized shock. Folding is a storage-topology optimization with a deliberately narrow contract: GridSearch, a singleton regime, fixed distribution parameters, linear expectation, and no taste shocks or node-dependent downstream transition/value gate. A state-conditioned folded shock additionally requires its conditioning state to remain fixed on the regime’s own and every incoming edge. See Folding an IID shock out of stored values for the complete boundary.

See Grids and Continuous stochastic processes for worked construction.