2. Example workflow contracts

The companion WorkingWithAModel/example_contracts/howto.m runs small serialization, color and progress examples without fitting a model.

2.1. Publishing and installation checks

rise.publish(source,'SaveAs',destination) respects the complete destination, including nested relative or absolute folders. A missing extension means PDF. The PDF, retained TeX and figure directory are delivered together; the caller’s working folder is restored after success or failure. The existing temporary builder still handles compilation.

Source listings preserve literal markup. Unsupported characters appear as explicit UTF-16 \uXXXX units, including both units of a surrogate pair, rather than disappearing or being replaced by different punctuation. A notice identifies this representation; the original source remains unchanged and is the source to execute. Console-control cleanup applies to console output.

[status,diagnostic]=rise.demo() returns status zero only when all checks pass, and one on a caught failure. The diagnostic contains stage and exception. Only figures created during the demonstration are closed. The original model and its calibration are retained.

2.2. Numerical and graphics utilities

Polynomial serialization uses enough significant digits to retain double coefficients. Signed scientific exponents belong to the numeric literal, not polynomial subtraction. The formatter can reorder monomials; compare their powers together with the associated coefficients.

colorspace(matrix,rgb) applies a real finite 3-by-3 transform. colorspace('hsi<-rgb',rgb) uses intensity equal to the arithmetic RGB mean, saturation one minus the minimum channel divided by intensity, and angular hue. Black and gray have zero saturation and hue. The inverse uses the corresponding three hue sectors. HSI and HSL have different definitions.

Zero total work in progress_monitor is already complete: it creates no parallel queue or progress figure. Zero increments are accepted, while invalid indices, negative/nonfinite counts and positive work against a zero total are rejected. CancelButton=false creates no cancel control.

2.3. Retained model examples

Start the currently active installation with rise.startup(). In the irreversible-investment example, I is the investment nonnegativity slack; I-.025*k is a separate stationary capital-law residual.

The SGUSEA callbacks declare their computed parameter updates, use a unit multiplier when the additional shock is absent, and reject failed or inaccurate price solves. The engine checks the original steady-state equations instead of treating the returned point as imposed. No equation or calibration is changed by these callback repairs. The driver filters its fitted model.

The numbered batch driver runs each script in its own function workspace and returns a structure indexed by driver name. Driver03 retains its calibrated m; driver12 retains mest1 and mest2; other drivers retain mest. A missing output is an error, so the previous driver’s result cannot leak in. The recession plots request one ordinary forecast per recession and make no claim to remove an individual shock.

The marginal-density example keeps complete chain results and evaluates all nine supported methods through mdd. Stored f values and the supplied objective are the negative log posterior. The historical cache has no verified parameter-order metadata, so its serialized callback is never loaded. Enable sampling to use a freshly rebuilt objective and its same-run draws and bounds. New files retain numeric results, parameter names, version and model source instead of callbacks. Separately saved chains still need a verified matching contract before reuse. The sampler option is thinning. The example’s bounded validation uses a known Gaussian normalization with a nonzero log-kernel offset, not a fitted model likelihood.

Structural VAR adapters retain the original chains, restrictions and prior arguments. Equation references use names from the supplied ordering. Plotting uses get(model,'endo_list(original)') rather than generated lag auxiliaries. Construction and prior/restriction absorption are separate from a complete replication estimate. Source configurations 1, 2, 3 and 5 retain their original Beta priors with mean 0.1 and standard deviation 0.3. A proper Beta distribution requires variance strictly below \(m(1-m)\); these declarations are at the improper boundary. Their numbered workflows stop before loading data, and the batch workflow reports and skips only those four configurations. Types 0, 4 and 6 and all financial-stress specifications remain available. No replacement prior is chosen, and the source factories retain the declarations for inspection.

The variance-only workflow retains its three original joint Dirichlet priors and uses the constructed model in its downstream calls. The bounded companion retained_svar_source_priors_example(source_root) returns the availability mask without loading data, estimating or sampling. Bounded constructor checks do not certify a complete replication estimate. The unfinished conditional draft still requires its absent original posterior-coordinate converter and a validated simulation plan before it can report a conditional result.

The retained prior-density reference helper supports uniform and no-prior groups without extra files. Other shapes name the missing original density helper and remain parked; no substitute density is inferred. The native model example uses RISE’s distribution infrastructure independently.

2.4. Static code inspection

The call scanner distinguishes comments, quoted literals, doubled quotes, transpose operators and named handles. A percent sign inside a string cannot hide a later call. Unresolved dynamic or lexical references classify otherwise unreferenced names as unknown. A static unreferenced candidate is not evidence that deleting a capability is safe.

2.5. Inflation targets in the bond-premium example

Rudebusch and Swanson (2012), “The Bond Premium in a DSGE Model with Long-Run Real and Nominal Risks”, American Economic Journal: Macroeconomics 4(1), 2012, 105–143, and the public replication files specify an annualized log inflation target and positive target persistence.

For the retained example, PIBAR and PISTAR are annualized log rates, whereas PI and PIAVG are quarterly gross rates. Thus the steady relations are \(\log(PI)=PIBAR/4\) and \(PISTAR=PIBAR\). The target’s contemporaneous feedback uses \(4\log(PIAVG)-PISTAR\). Calibration and the original shock declarations are retained.

At nonzero target inflation, the reset price and price dispersion must be computed jointly with marginal cost. The numerator’s continuation exponent is \((1+\theta)/(\theta\eta)\). The production and wage reference values then follow their written equations; assigning the zero-inflation dispersion or markup away from zero inflation would violate those identities.

rudebusch_inflation_target_example(source_root,annual_target) computes this reference state with an explicit annualized log target. It does not run estimation or a stochastic solution. Bounded tests check every written steady equilibrium/reporting identity at zero, positive and negative targets, including persistent targets and feedback. The supplied local calibration is retained; this check is not a reproduction of the paper’s parameter estimation.

2.6. A binding date in the affine-rate example

The separate howto_zlb_linear_rate worked example uses the original switching NK calibration with an affine level-rate policy and the existing occbin.paradigm solver. Its twenty-period scenario sets one monetary-policy innovation to -30 at date1 and every other innovation to zero. The transition probabilities do not select regimes under this constraint-driven paradigm.

The native check exercises both a binding and a slack date. It verifies finite, nonnegative realized rates and the independent relation R=max(0,Rshadow) at every simulated date. The shadow rate is the affine Taylor expression evaluated with the simulated inflation and lagged rate. This checks both release and binding conditions, rather than only a regime label. The separate original log-rate and dispatch examples are retained.

switching_zlb_level_example(tests_root) runs this bounded scenario from the tutorials. The affine bound is exact in rate levels; other equations use the stated first-order piecewise-linear approximation. No full nonlinear residual or stochastic-accuracy claim follows from this check.

2.7. Value derivatives in the Bellman-game reference

The retained Algorithm3 iteration passes independent unilateral best-response, Bellman-value and strategic-envelope checks at its supplied calibration. It uses discounted continuation-value derivatives in the current debt stationarity equations and separately recovers current constraint multipliers. These quantities need not coincide when a rival follows a state-dependent rule.

The reference result fields Lambda and Mu report the current multipliers from entries10 and11 of p, consistently with the other two reference algorithms. continuationM and continuationF report the discounted continuation-value derivative coefficients. With the stated quadratic value normalization and default factor2, these are 2*beta*Sm and 2*beta*Sf. This reporting repair leaves the numerical policy/value iteration unchanged.

History columns10 and11 are named continuation_m and continuation_f. The final diagnostic is envelope_res and includes each rival’s state response. A difference between a current multiplier and a continuation derivative is generally nonzero and is not an equilibrium residual.

The new algorithm3_markov_v2/main.tex and matching PDF derive the current best-response equations, the strategic envelopes and the meaning of the code inputs. Historical notes remain unchanged. Use bellman_rival_response_example(tests_root) for the bounded companion. The checks concern this retained linear-quadratic example and do not establish global nonlinear-game uniqueness or equivalence of the other iterations.

Both retained post-processing envelope checkers now include the rival terms. The individual fiscal reduction uses signs obtained directly from the written debt and Phillips equations; its previous hand elimination was inconsistent. These changes affect diagnostics rather than the Bellman policy iteration.

2.8. The home-consumption CES endpoint

For positive market and home consumption and 0<a<1, the retained consumption utility is

\[\frac{b}{e}\log\left(a C_m^e+(1-a)C_h^e\right).\]

At e=0 its limit is b*(a*log(C_m)+(1-a)*log(C_h)). Both home-production callers use the same symbolic expression helper. Near zero it uses the local cumulant expansion through fourth order in elasticity, retaining the finite first and second elasticity derivatives. Away from zero a shifted log-sum evaluates the original aggregate. Its numerical conditionals do not introduce model inequality constraints.

home_consumption_utility_example(tests_root,market,home,power) evaluates this kernel with the retained weights a=.337 and b=.63. The default power is zero. The source examples keep their supplied calibration, and historical reference equations remain unchanged. This scalar companion does not solve the full home-production model.

The independent value check integrates a tilted weighted mean of log quantities. Additional checks differentiate elasticity around zero and compile both consumption marginal utilities. The finite limit relies on the stated normalized weights; an unrelated raw-weight CES expression does not acquire a Cobb-Douglas limit without its own normalization convention. Input columns and quarterly calendars ————————————-

The numbered quarterly examples select economic variables by workbook header. Numeric date metadata are never economic series. The supplied dateq convention counts quarters from 1960Q1; the importer requires a consecutive integer calendar. The macro workbook starts at 1955Q1, and the deflator/rate workbook at 1947Q1. Rates are missing until 1954Q3. The stored calendar retains those early dates; an all-missing date query can return an empty series. Missing headers or a gapped/noninteger calendar produce an input error. The workbooks and inflation transformation are unchanged.

2.9. Graphics, palettes and bounded numerical work

rise.startup(true) restores explicit figure-paper defaults present before the first load. Repeated loads retain that snapshot. Unloading skips optional reporting and toolbox probes. Loading again starts a new ownership interval.

Single-precision color inputs retain the units of their declared source space. Only uint8 RGB uses 0–255 scaling. Other integer types and integer non-RGB inputs are rejected. distinguishable_colors(0) returns 0-by-3 without conversion. Default candidate grids and their Lab conversion are reused; backgrounds remain request-specific, and custom callbacks are not cached.

utils.gridfuncs.commutation(m,n) constructs its permutation sparsely; compatibility algorithm selectors have identical results. Combination recursion stops at the requested tuple length and prunes impossible branches. Length zero returns one empty tuple. mcmc.meanplot uses the loaded draw count and existing recursive mean formula without an unused covariance history.

The optional fifth input to petschel.groebner and petschel.polynsolve is a work-limit structure. Defaults are 100000 steps, 30 seconds, 100000 terms, 64 MiB of checked polynomial tables and recursion depth 32. Fields are MaxSteps, MaxTime, MaxTerms, MaxBytes and MaxDepth. Limits are shared across reductions and recursive root branches; raise them explicitly when needed, including Inf to disable a limit. Exhaustion throws petschel:ResourceLimit with no partial enumeration. The byte limit covers checked tables, rather than total process memory. Existing coefficient tolerance and floating-point accuracy limitations remain. Leading terms retain the original ordering keys.

The replanning estimation entry is a function. howto(false) does not request a pool. Parallel mode borrows an existing pool; only a pool created by the example is closed, including on an estimation error.

2.10. Preserved economic and historical contracts

SGUSEA1 fractional observations, x/x_ss-1, match demeaned log data at first order. Its driver requests first order explicitly. At higher order exp(d)-1 differs from d; SGUSEA12 has its own exact log observations, driver and calibration.

SVAR volatility restrictions hold unnormalized structural coefficients fixed. Dividing the Phillips equation by 1/sig_pai makes its first lag sig_pai*alpha_pai1. Changing sig_pai from .1 to .2 with alpha_pai1=.9 changes that coefficient from .09 to .18 as well as innovation variance. These structural restrictions are preserved.

The 2017 two-constraint example retains the published hours observation SIGMA*n/lln+(1-SIGMA)*n1/lln1-1. All four constraint variants use that formula in the authors’ July 2017 archive: https://www.matteoiacoviello.com/research_files/ASYMMETRIES_CODES_JULY2017.zip. Its measurement weights differ from interpreting the series as the production labor index; that interpretation is not silently substituted.

The absent replanning steady-state fixture is parked before housekeeping. A recovered public Smets-Wouters mode has matching parameter order but a different sample; its cached-mode recipe is parked, while the native example remains available. Each folder states the contract needed for reactivation.

The retained 2014 New Keynesian report identifies the volPolInd column’s violation of its printed policy ordering: 1.243 is below 2.986. Both reports identify nonreal Laplace evidence as unavailable for Bayes-factor comparisons. Their originating Hessians have not been recovered. All original report pages and numbers are retained, with notices in separate space.

2.11. Canonical source inspection

The third output of isolated_functions_retriever contains nodes keyed by relative path and qualified identity. Package, class and nearest-private references retain separate counters. The legacy basename map lists its identities and marks collisions unknown. Bound array names, dynamic calls and unresolved scope remain unresolved. Command references and handles are lexical references, rather than proof of reachability or deletion safety.

Migration previews show proposed lines. Apply requires a reviewed plan marking each exact occurrence qualify or keep; hashes and offsets must still match. Local variables, comments and serialized names can retain their meaning. Ignore rules expose source languages and ignore generated directories and caches instead.