Skip to content

Dolo+ Primitives

Built-in symbols, functions, distributions, and reserved keywords available in Dolo+/DDSL without explicit definition.

Brackets: Intervals vs Tuples/Lists

Context Meaning Example
After @def Interval (continuous range) x @def [0, 1] means \(x\in[0,1]\)
After @in Element of a tuple/vector [m, b] @in Xa means \((m,b)\in\mathsf X_{\prec}\)
Perch tag Measurability declaration V, c[>]
Plain list Collection of items parameters: [β, ρ, R]

Mathematical Domains

Symbol Meaning Usage Example Notes
R Real numbers x @def R All reals
R+ Positive real numbers assets @def R+ \(x\geq 0\)
R- Negative real numbers debt @def R- \(x\leq 0\)
R++ Strictly positive reals consumption @def R++ \(x>0\)
N Natural numbers periods @def N \(0,1,2,\ldots\)
Z Integers count @def Z \(\ldots,-1,0,1,\ldots\)
[a, b] Closed interval probability @def [0, 1] \(a\leq x\leq b\)
(a, b) Open interval growth_rate @def (-1, inf) \(a<x<b\)

Distribution Functions (IID)

Function Parameters Description Example
Normal(Σ, μ) Σ: covariance, μ: mean Multivariate normal W @def Normal(Sigma_w, Mu_w)
UNormal(σ, μ) σ: std dev, μ: mean Univariate normal w @def UNormal(sigma_w)
Uniform(a, b) a: lower, b: upper Uniform w @def Uniform(-0.5, 0.5)
LogNormal(σ, μ) σ, μ: of underlying normal Log-normal w @def LogNormal(sigma_w, mu_w)
Beta(α, β) α, β: shape Beta w @def Beta(alpha_w, beta_w)
Bernoulli(π) π: probability of 1 Bernoulli success @def Bernoulli(0.7)
Binomial(n, π) n: trials, π: success prob Binomial successes @def Binomial(10, 0.5)

Joint Distribution Declarations

When exogenous shocks are correlated, dolo-plus uses a joint vector declaration that mirrors vanilla dolo's !Normal syntax. The joint vector entry uses the same Μ/Σ keys as dolo's Normal class. The individual component variables are the other exogenous entries (declared with @in space).

Syntax:

exogenous:
    # Individual component spaces
    Ψ: "@in Rp"
    θ: "@in Θ"

    # Joint distribution (mirrors dolo !Normal structure)
    ζ:
      "@dist": Normal
      Μ: [μ_Ψ, μ_θ]
      Σ: [[σ_Ψ^2, ρ_ζ*σ_Ψ*σ_θ], [ρ_ζ*σ_Ψ*σ_θ, σ_θ^2]]
Key Meaning Notes
"@dist": Normal Distribution family of the underlying vector Mirrors dolo's !Normal YAML tag
Μ Mean vector of the underlying distribution Same key as dolo's Normal class (capital mu U+039C)
Σ Covariance matrix of the underlying distribution Same key as dolo's Normal class (capital sigma U+03A3). Entries can be parameter expressions (e.g. σ_Ψ^2)

The components are inferred: all other exogenous entries (those with @in declarations) are the variables generated by the joint distribution, in order. The mapping from the underlying Normal to the economic variables is determined by their @in spaces — e.g. Ψ: "@in Rp" (R++) with an underlying Normal implies \(\Psi = \exp(\xi_\Psi)\) (LogNormal).

Transform to vanilla dolo: The Μ and Σ copy directly to the output !Normal block. Component variables become log-space exogenous symbols, and equations use exp() to recover level-space values:

# Vanilla dolo output
symbols:
    exogenous: [logΨ, logθ]

exogenous: !Normal
    Μ: [μ_Ψ, μ_θ]
    Σ: [[σ_Ψ^2, ρ_ζ*σ_Ψ*σ_θ], [ρ_ζ*σ_Ψ*σ_θ, σ_θ^2]]

# Transition uses exp() to recover level-space:
#   k_d[t] = k_d[t-1]*(ς[t-1]*exp(logΨ[t]) + ...) + exp(logθ[t])

Stochastic Processes

Function Parameters Description Example
AR1(ρ, σ, μ) ρ: autocorr, σ: std dev, μ: mean AR(1) z @def AR1(rho_z, sigma_z, mu_z)
VAR1(ρ, Σ, μ) ρ: autocorr matrix, Σ: cov, μ: mean VAR(1) Z @def VAR1(Rho_z, Sigma_z, Mu_z)
MarkovChain(P, S) P: transition matrix, S: states Discrete Markov chain s @def MarkovChain(P_s, S_s)
ConstantProcess(μ) μ: constant value Deterministic c @def ConstantProcess(mu_c)
AggregateProcess(μ) μ: aggregate state Aggregate shock agg @def AggregateProcess(mu_agg)
Product(...) Variable args Product of processes shocks @def Product(AR1(...), UNormal(...))

Mathematical Functions

Function Usage Description
exp(x) Exponential exp(z)
log(x) Natural logarithm log(c)
log10(x) Base-10 logarithm log10(y)
sqrt(x) Square root sqrt(variance)
abs(x) Absolute value abs(profit)
sign(x) Sign function (-1, 0, 1) sign(excess_demand)
^ or ** Exponentiation k^alpha or k**alpha

Trigonometric Functions

Function Usage Description
sin(x) Sine sin(theta)
cos(x) Cosine cos(theta)
tan(x) Tangent tan(angle)
asin(x) Arcsine asin(ratio)
acos(x) Arccosine acos(ratio)
atan(x) Arctangent atan(slope)

Comparison and Aggregation Functions

Function Usage Description
min(a, b, ...) Minimum min(c, c_bar)
max(a, b, ...) Maximum max(0, profit)
floor(x) Floor floor(n_periods)
ceil(x) Ceiling ceil(n_goods)
round(x) Rounding round(price, 2)

Operations (Special Computational Methods Required)

Operations differ from simple function compositions in that they require specific computational methods. All operators below use the _{...} convention: the content inside _{...} specifies with respect to what the operator acts. See symbols-conventions.md for disambiguation rules.

Differentiation Operators

Operator Mathematical Usage Description
d_{x} \(\partial_x\) d_{a}V Partial derivative of \(V\) wrt \(a\) (holding other arguments fixed)
D_{x} \(\mathrm{D}_x\) D_{a}V Total derivative (Jacobian / Fréchet) wrt \(a\) (includes indirect dependence)

These are used in values_marginal declarations and in mover sub-equations (MarginalBellman, ShadowBellman). Differentiation variables must be declared symbols. See open design question on whether d_{.} is a naming convention or a first-class operator.

Expectation Operations

Operator Mathematical Usage Description
E_{shock}(·) \(\mathbb{E}_\theta[\cdot]\) E_{θ}(V[>]) Expectation over named shock. Requires integration method.
E[·\|·] \(\mathbb{E}[\cdot \mid \cdot]\) E[V \| state] Conditional expectation. Requires conditional integration.
Var[·] \(\mathrm{Var}[\cdot]\) Var[returns] Variance operator. Requires second moment computation.

Optimization Operations

Operator Mathematical Usage Description
max_{c}{·} \(\sup_c\{\cdot\}\) max_{c}{u(c) + β*V[>]} Maximum value over control. Requires optimization algorithm.
argmax_{c}{·} \(\arg\sup_c\{\cdot\}\) c = argmax_{c}{...} Argument maximiser. Returns optimal control.

Implicit System Operator

Operator Mathematical Usage Description
solve_{x1, x2, ...}{·} Find \((x_1, x_2, \ldots)\) satisfying conditions solve_{c[>], h[>]}{...} Solve a system of equations for the listed unknowns. Requires root-finding or analytical method.

The solve_{...} operator declares that the enclosed conditions implicitly define the listed unknowns. The number of conditions must equal the number of unknowns.

operators #operators/solve #invEuler

Example (two FOCs defining consumption and housing choice):

InvEuler: |
  solve_{c[>], h_choice[>]}{
    alpha * c[>]^(-gamma_c) - beta * d_{a}V[>] = 0,
    (1 + tau) * alpha * c[>]^(-gamma_c)
      - (1 - alpha) * kappa^(1 - gamma_h) * h_prime^(-gamma_h)
      - beta * d_{h}V[>] = 0
  }

Single-control shorthand: when the system is a single explicit inversion, solve_{} can be written as a direct assignment. These are equivalent:

# Explicit (standard EGM shorthand):
c[>] = (beta * dV[>] / alpha)^(-1/gamma)

# Equivalent solve form:
solve_{c[>]}{alpha * c[>]^(-gamma) - beta * dV[>] = 0}

The methodization layer determines the solution method (analytical inversion, Newton, partial-EGM, etc.).

Grid Discretization Methods (as decorators)

Method Usage Best For
@method: gauss-hermite @n_points: 7 Normal distributions
@method: tauchen @n_points: 5, @m: 2 AR(1) with low persistence
@method: rouwenhorst @n_points: 5 AR(1) with high persistence
@method: equiprobable @n_points: 10 General distributions
@method: custom With values and probabilities User-defined discretization

Reserved Keywords

Keyword Context Meaning
symbols Top-level section Variable declarations
equations Top-level section Model equations
calibration Top-level section Parameter values
domain Top-level section State space bounds
grids Top-level section Discretization specs
exogenous In symbols or top-level Shock specification
prestate In symbols Arrival state variables
states In symbols Decision state variables
poststates In symbols Continuation state variables
controls In symbols Control/choice variables
parameters In symbols Model parameters (Υ-level)
settings In symbols Numerical configuration (Ρ-level)
values In symbols Value function objects
values_marginal In symbols Marginal value objects