Skip to content
An Econ-ARK project

Methods

Summary

A method is the numerical procedure chosen for one operator of a stage: a quadrature rule for an expectation, an interpolant for the function an Evaluation stores, a solution method such as the endogenous grid method for the policy builder. It is named by a word with keyword arguments, !gauss_hermite(n_ψ=n_ψ_nodes), !Linear(extrapolate=extrap_policy), !egm, and written as the typing of the operator's method component, policy.method : !egm, so that the method is a label on the operator, beside its inputs and outputs and its grid. The model does not depend on it: forgetting every label leaves the model's operations unchanged, and forgetting the methods file returns the stage file.

Relationship with other documents

Formal account — Methods: the signature with its components, composition, the method as a type, the handler, the erasures and the two levels. Builds on — Grid: the discretized domain beside the method; Settings: the names a method's arguments read; Addition: the methods file that writes the entries. Used by — Methodization: the binding of methods to a stage and the places they bind at; Handler: the program that computes a method; Method types: the catalogue.

1 Where a method stands

A method types an operator and nothing else: not a field, which is a quantity and not a computation, and not a side of a block header, the inputs before the arrow or the outputs after it, whose perch word types the states and the values listed on it. The entry is written in the methods file, an addition to the stage file, inside the bracket of the block that holds the operator, [id=policy, policy.method : !egm | evaluate.method : !Linear] { … }, the block's own method in the first group and each inner operator's in a group opened by |; or at file level with the full path, dcsn_to_arvl.evaluate.method : !Linear. The places that admit a method are those stage.places() lists: a builder; the Evaluation that stores the builder's result, named by what it evaluates where the value and its stated derivative are represented apart, evaluate[V[<]].method and evaluate[D_{k}V[<]].method; an operator of a line, such as the expectation E_ψ_ξ or the maximization argmax; a line marked !node, a computation inside a block that the author names so that a method can stand on it; and a declared function. The derivative operator D admits no method.

Which methods an operator admits depends on its operation kind, the name under which the package lists the operation, such as Expectation or Evaluation. The methods admitted at one operation kind form one set (Methods §4), and the catalogue Method types lists each word with the kinds of place it admits and the keywords the package reads. A further keyword is read by the handler that computes the method. A method takes keyword arguments only, each valued by the name of a declared setting, a quoted string or a word with its own arguments. Its entry writes no number: every number that a method reads is a declared setting, which the entry names and the settings file values, and no value is part of a signature.

2 What a method does to the stage

A method does one of three things, according to the operator it stands on. A representation, !Linear, !pchip or !closed_form, stores a function from the data its family accepts: an authored table, the policy pairs of !egm at its builder's closing Evaluation, a complete authored expression, or its values on the grid its grid component names (Methods §5). It stands at the Evaluation that closes a builder, one entry for everything the Evaluation stores or one entry per stored object, each with its own grid; or at a !node line or a declared function. A solution method, !egm or !vfi or time iteration, stands on a builder and supplies the lines by which the builder is computed at the operative level, the stage keeping the declared lines in stage.declared (addition §3); !vfi supplies no lines. A method of an operator of a line fixes how that operation is computed: a quadrature or a discretization of a law at an expectation, !gauss_hermite or !tauchen, and a root finder or a search at a maximization. Interpolation and the comparison of candidates inside a method create no authored equation, and no method proves that a computed policy is optimal.

3 Composition and erasure

Two operators compose when the outputs of the first are the inputs of the second; the method plays no part in that condition, and a composite carries the list of its operators' labels, which are kept and never combined. This is the composition of parametrized morphisms of Capucci, Gavranović, Hedges and Rischel (2022, Definition 2, p. 236) under the trivial action. The exact meaning of a stage reads no label; the numerical semantics Ρ reads each label as the routine its handler computes, a handler in the sense of Plotkin and Pretnar (2009): a model of the operators it admits, extended to every composite. Forgetting every label is the erasure \(U_m\), and assigning them from a methods file the methodization \(M_m\), with \(U_m \circ M_m = \mathrm{id}\), the identity label, the list with no entries, standing on every operator without an entry; forgetting the methods file by its provenance is the second erasure, which returns the stage file (Methods §8). A stage is methodized when some operator carries a method label other than the identity label. stage.methods answers each method by the place it binds at, and stage.builder[...].signature() prints the two components beside the inputs and outputs.