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.

Quality Assessment: Companion Notebook 1

Date: 2026-02-17
Subject: Fidelity assessment of website/replication/companion-notebook-1.ipynb relative to Marimon, McGrattan & Sargent (1990)
Paper: “Money as a Medium of Exchange in an Economy with Artificially Intelligent Agents,” Journal of Economic Dynamics and Control, 14(2), 329–373.


Executive Summary

The companion notebook provides a complete Python replication of all 8 economies (A1.1, A1.2, A2.1, A2.2, B.1, B.2, C, D) from MMS 1990. The core algorithm — Kiyotaki-Wright matching, trinary classifier systems, bucket brigade strength updates (Eqs 10–11), and genetic algorithm — is faithfully implemented and produces qualitatively correct convergence behavior.

The paper contains 66 named tables and 10 figures. Of the 50 tables that are simulation outputs (parameters, results, classifier strengths), the notebook reproduces all 50 (100%). The remaining 16 tables are analytically derived theoretical equilibrium benchmarks that live in the paper text and are not duplicated in the notebook — readers can cross-reference them directly in the companion paper, which is published alongside the notebook in the same MyST site. Of the 10 figures, 7 are reproduced (70%), with the 3 missing being conceptual/explanatory diagrams (classifier flow, GA illustration, speculative triangle).

Key strengths: Full economy coverage, 100% simulation table coverage, GA replicating MATLAB ga3.m, data-driven Wicksell triangles, classifier strength tables for A1.1/A1.2, all 8 economies qualitatively match the paper’s equilibrium findings.
Remaining improvements: Triplicated code with divergence risk, Economy C/D missing consumption frequency tracking, conceptual diagrams not reproduced.


1. Paper Content Inventory

The paper contains:

CategoryCountDescription
Named tables66Parameters (8), theoretical equilibrium (16), simulation results (30), classifier strengths (12)
Figures10Flow diagrams (2), equilibrium trading patterns (3), holdings time series (3), production/exchange diagrams (2)
Equations17Core model: trading/matching (1–8), bid function (9), strength updates (10–11), utility (12), eq. conditions (13–17)

2. Algorithm Fidelity

2.1 What Matches the Paper

ComponentPaper ReferenceStatus
Trinary encoding (0, 1, #)Section 3, Table 1✅ 2-bit for 3–4 goods, 3-bit for 5 goods
Complete enumeration (72 trade + 12 consume)Section 3✅ For A1.1, A2.1, B.1
Random initial classifiersSection 6✅ For A1.2, A2.2, B.2, C, D
Auction: highest strength winsEq (7)✅ Uses max(..., key=strength)
Bucket brigade: Eq (10) consume updateEq (10), denominator τc1\tau_c - 1✅ Uses n_used before incrementing
Bucket brigade: Eq (11) exchange updateEq (11), denominator τe\tau_e✅ Uses n_used before incrementing
External payoff: Eq (12)ui(k)=0u_i(k) = 0 for kik \neq i✅ Agents may consume wrong goods with 0 utility
Inter-period paymentSection 3.2✅ Via last_consume_winner
GA: two-stage parent selectionga3.m✅ Usage-weighted pre-selection (p2=0.7p_2 = 0.7), then fitness-proportional roulette
GA: single-point crossoverga3.m✅ Matches MATLAB
GA: ternary cyclic mutationga3.m✅ Matches MATLAB
GA: crowding replacementcrowdin3.mcankill filtering with De Jong crowding
GA: N_pairs formularound(propselect × n_classifiers × 0.5)✅ 7 trade pairs, 1 consume pair for 72/12
Specialization operatorSection 6: fs(t)=1/(2t)f_s(t) = 1/(2\sqrt{t})✅ Implemented in all simulation loops
Diversification operatorSection 6✅ Activated in all agent decision methods
Creation operatorSection 6 / create.m✅ Replaces most-redundant or weakest; constant population

2.2 Discrepancies

IssuePaper ReferenceCurrent StatusSeverity
Bid function unused for auctionFootnote 5, Eq (9)bid() defined but never called; auction uses raw strengthLow — Under complete enumeration, all classifiers have identical specificity, so bid ranking ≡ strength ranking. Under random classifiers, bid-based selection would favor more specific rules, but the effect is likely minor.
Triplicated codeClassifierAgent/FiatMoneyAgent/FiveGoodAgent are separate classes with copy-pasted logicMedium — Bug fixes must be replicated 3 times. Risk of silent divergence.
No EconomyConfig for C and DEconomies C and D have hardcoded parameters in dedicated classesLow — Makes systematic comparison harder but doesn’t affect results.

3. Table-by-Table Coverage

3.1 Parameter Tables (8 of 8 = 100%)

All economy parameters are fully specified in the notebook:

Paper TableEconomyNotebook Status
Table 9A1.1 params✅ Cell 19 (EconomyConfig)
Table 19A1.2 params✅ Cell 25 (EconomyConfig)
Table 30A2.1 params✅ Cell 29 (EconomyConfig)
— (A2.2 uses A2.1 params + GA)A2.2 params✅ Cell 33 (EconomyConfig)
Table 37B.1 params✅ Cell 37 (EconomyConfig)
Table 48B.2 params✅ Cell 40 (EconomyConfig)
Table 52C params✅ Cell 45 (hardcoded in FiatMoneySimulation)
Table 60D params✅ Cell 50 (hardcoded in FiveGoodSimulation)

3.2 Theoretical Equilibrium Tables (16 tables — in paper, not notebook)

The paper provides 16 tables of analytically derived equilibrium values (Tables 2–8, 31–33, 38–43, 53–55). These are closed-form solutions to the Kiyotaki-Wright model’s stationary equilibrium equations — static reference data, not simulation output. They serve as benchmarks against which the notebook’s simulation results can be compared.

These tables are intentionally not duplicated in the notebook. They live in the companion paper text, which is published alongside the notebook in the same MyST site. Readers can cross-reference simulation outputs against the theoretical benchmarks by consulting the paper directly. One table (Table 2, A1 fundamental holdings) is included in the notebook as a worked example.

EconomyPaper TablesContent
A1Tables 2–5Fundamental eq.: holdings, joint exchange, strategies, consumption
GeneralTables 6–7Type I agent behavior in fundamental/speculative eq.
AllTable 8Master economy description
A2Tables 31–33Speculative eq.: holdings, exchange, strategies
BTables 38–43Fundamental + speculative eq.: holdings, exchange, strategies
CTables 53–55Fundamental eq. with fiat money: holdings, exchange, strategies

3.3 Simulation Result Tables — Holdings (9 of 9 = 100%)

All holdings tables from the paper are reproduced at the correct time points:

Paper TableEconomyTime PointsStatus
Table 10A1.1t=500, t=1000print_full_analysis
Table 20A1.2t=1000, t=2000print_full_analysis
Table 34A2.1t=500, t=1000print_full_analysis
Table 44B.1t=500, t=1000print_full_analysis
Table 49B.2t=1000, t=2000print_full_analysis
Table 56Ct=750, t=1250print_fiat_holdings
Table 61Dt=500print_5good_holdings
Table 62Dt=1750print_5good_holdings
— (A2.2 extra)A2.2t=1000, t=2000✅ (beyond paper)

3.4 Simulation Result Tables — Exchange Frequency (9 of 9 = 100%)

Paper TableEconomyTime PointsStatus
Table 11A1.1t=500, t=1000
Table 21A1.2t=1000, t=2000
Table 35A2.1t=500, t=1000
Table 45B.1t=500, t=1000
Table 50B.2t=1000, t=2000
Table 57Ct=750
Table 58Ct=1250
Table 63Dt=500
Table 64Dt=1750

3.5 Simulation Result Tables — Winning Actions (8 of 8 = 100%)

Paper TableEconomyTime PointsStatus
Table 12A1.1t=1000✅ (also at t=500, beyond paper)
Table 22A1.2t=1000, t=2000
Table 36A2.1t=500, t=1000
Table 46B.1t=500, t=1000
Table 51B.2t=1000, t=2000
Table 59Ct=750, t=1250
Table 65Dt=500
Table 66Dt=1750

3.6 Simulation Result Tables — Consumption Frequency (1 of 2 = 50%)

Paper TableEconomyTime PointsStatus
Table 23A1.2t=1000, t=2000
Table 47B.1t=500

The notebook also reports consumption frequency for A1.1, A2.1, A2.2, B.2 at multiple time points — beyond the paper. Economies C and D do not report consumption frequency (the FiatMoneySimulation and FiveGoodSimulation classes do not track it).

3.7 Classifier Strength Tables (12 of 12 = 100%)

The paper provides classifier strength tables only for A1.1 (at t=1000) and A1.2 (at t=1000 and t=2000) — 12 tables total. The notebook reproduces all 12:

Paper TablesEconomyTimeAgent TypesStatus
Tables 13–18A1.1t=1000All 3 types × exchange + consumeprint_classifier_strengths
Tables 24–29A1.2t=1000, t=2000All 3 types × exchange + consumeprint_classifier_strengths

The paper does not provide classifier strength tables for A2.1, A2.2, B.1, B.2, C, or D.


4. Figure Coverage

Paper FigureDescriptionEconomyStatusNotebook Cell
Figure 1Classifier payment flow diagramGeneral❌ Not reproduced
Figure 2Fundamental trading patterns (triangle)A (theory)✅ Reproduced via data-driven Wicksell triangleCell 61
Figure 3Speculative trading patterns (triangle)A (theory)❌ Not as standalone theoretical diagram
Figure 4GA mating/crossover illustrationGeneral❌ Not reproduced
Figure 5A1.1 holdings distribution over timeA1.1plot_holdings_distributionCell 21
Figure 6A1.2 holdings distribution over timeA1.2plot_holdings_distributionCell 26
Figure 7Economy B trading patterns (fund/spec)B✅ Via Wicksell triangleCell 61
Figure 8Economy C exchange patternC✅ Via Wicksell triangleCell 61
Figure 9Economy D production structureD✅ Pentagon production diagramCell 54
Figure 10Economy D exchange patternsD✅ Pentagon exchange diagramCell 54

Extra figures (beyond paper):


5. Economy-by-Economy Assessment

5.1 Economy A1.1

AspectPaper ContentNotebook Status
ParametersTable 9
Theoretical equilibriumTables 2–5 (in paper text)— Cross-reference paper (Table 2 included as worked example)
HoldingsTable 10 at t=500, t=1000
Exchange freqTable 11 at t=500, t=1000
Winning actionsTable 12 at t=1000✅ (also at t=500)
Classifier strengthsTables 13–18 (3 types × exchange + consume) at t=1000
Holdings plotFigure 5
Qualitative resultFundamental equilibrium✅ Confirmed

5.2 Economy A1.2

AspectPaper ContentNotebook Status
ParametersTable 19
HoldingsTable 20 at t=1000, t=2000
Exchange freqTable 21 at t=1000, t=2000
Winning actionsTable 22 at t=1000, t=2000
Consumption freqTable 23 at t=1000, t=2000
Classifier strengthsTables 24–29 (3 types × exchange + consume) at t=1000, t=2000
Holdings plotFigure 6
Qualitative resultFundamental equilibrium (slower convergence)✅ Confirmed

5.3 Economy A2.1

AspectPaper ContentNotebook Status
ParametersTable 30
Theoretical equilibriumTables 31–33 (in paper text)— Cross-reference paper
HoldingsTable 34 at t=500, t=1000
Exchange freqTable 35 at t=500, t=1000
Winning actionsTable 36 at t=500, t=1000
Holdings plotNot in paper✅ (beyond paper)
Qualitative resultFundamental (despite speculative being unique REE)✅ Discussed with KW condition check

5.4 Economy A2.2

AspectPaper ContentNotebook Status
ParametersSame as A2.1 + GA
Paper providesBrief qualitative summary only (“refer to working paper”)✅ Notebook exceeds paper — reports full tables
Holdings, exchange freq, winning actionsNot tabulated in paper✅ At t=1000 and t=2000
Qualitative result“S” in master table, not converged✅ Speculative indicator check included

5.5 Economy B.1

AspectPaper ContentNotebook Status
ParametersTable 37
Theoretical equilibriaTables 38–43 (in paper text)— Cross-reference paper
HoldingsTable 44 at t=500, t=1000
Exchange freqTable 45 at t=500, t=1000
Winning actionsTable 46 at t=500, t=1000
Consumption freqTable 47 at t=500
Holdings plotNot in paper✅ (beyond paper)
Exchange patternFigure 7 (fund/spec triangles)✅ Via Wicksell triangle
Qualitative resultSpeculative at t=500 → fundamental at t=1000✅ Speculative indicator included

5.6 Economy B.2

AspectPaper ContentNotebook Status
ParametersTable 48
HoldingsTable 49 at t=1000, t=2000
Exchange freqTable 50 at t=1000, t=2000
Winning actionsTable 51 at t=1000, t=2000
Holdings plotNot in paper✅ (beyond paper)
B.1 vs B.2 comparisonNot in paper✅ (beyond paper)
Qualitative resultNot converged, trending fundamental✅ Discussed

5.7 Economy C (Fiat Money)

AspectPaper ContentNotebook Status
ParametersTable 52
Theoretical equilibriumTables 53–55 (in paper text)— Cross-reference paper
HoldingsTable 56 at t=750, t=1250
Exchange freqTables 57–58 at t=750, t=1250
Winning actionsTable 59 at t=750, t=1250
Holdings plotFigure 8 (implied from text)✅ 3-panel figure
Exchange patternFigure 8✅ Via Wicksell triangle
Consumption freqNot in paper❌ Not tracked (FiatMoneySimulation omits it)
Qualitative resultFiat money emerges as medium of exchange✅ Discussed

5.8 Economy D (Five Goods)

AspectPaper ContentNotebook Status
ParametersTable 60
HoldingsTables 61–62 at t=500, t=1750✅ (also at t=3000, beyond paper)
Exchange freqTables 63–64 at t=500, t=1750✅ (also at t=3000)
Winning actionsTables 65–66 at t=500, t=1750✅ (also at t=3000)
Production diagramFigure 9✅ Pentagon diagram
Exchange pattern diagramFigure 10✅ Data-driven pentagon
Holdings plotNot in paper✅ 5-panel figure (beyond paper)
Trading pattern analysisNot in paper✅ Accept/refuse matrix (beyond paper)
Consumption freqNot in paper❌ Not tracked (FiveGoodSimulation omits it)
Qualitative resultFundamental-like patterns✅ Extended analysis

6. Overall Coverage Summary

Tables

CategoryPaper CountReproducedCoverageNotes
Parameter tables88100%
Simulation holdings99100%
Simulation exchange freq99100%
Simulation winning actions88100%
Simulation consumption freq22100%
Classifier strength tables1212100%
Simulation subtotal4848100%All simulation outputs reproduced
Theoretical equilibrium tables16In paper text; cross-reference by design
General reference tables2Encoding scheme (Table 1) present; Table 8 params scattered
Grand total6648 + 16 in paper

Figures

CategoryPaper CountReproducedCoverage
Holdings time series22 + 6 extra100%
Exchange pattern diagrams44 + 4 extra100%
Production diagram11100%
Conceptual diagrams200%
GA illustration100%
Total10770%

Qualitative Results

EconomyPaper EquilibriumNotebook Match
A1.1Fundamental
A1.2Fundamental
A2.1Fundamental (despite speculative REE)
A2.2Speculative (not converged)
B.1Speculative→Fundamental transition
B.2Not converged, trending fundamental
CFiat money emerges
DFundamental-like patterns

All 8 economies produce qualitatively correct convergence behavior.


7. Prioritized Recommendations

Priority 1 — Code Quality (High Impact)

  1. Unify agent and simulation classes: Refactor ClassifierAgent, FiatMoneyAgent, and FiveGoodAgent into a single parameterized class. Similarly unify the three simulation classes. Eliminates 3× code duplication and divergence risk — any future bug fix would need to be applied only once.

  2. Extend EconomyConfig to cover C and D: Add n_fiat, n_bits, n_goods, and n_types fields so all 8 economies can be configured through a single dataclass.

  3. Add consumption frequency tracking to Economy C and D: The FiatMoneySimulation and FiveGoodSimulation classes do not track consumption frequency. While the paper doesn’t report these for C/D, tracking them provides useful diagnostic information and aligns behavior across all economies.

Priority 2 — Enhanced Analysis (Medium Impact)

  1. Add convergence diagnostics: Implement a rolling-window metric (e.g., standard deviation of holdings distribution) and report whether each economy has converged by its final period.

  2. Add side-by-side paper comparison: For each simulation output table, display the paper’s values alongside the notebook’s values. Since simulations are stochastic, exact matches are not expected, but qualitative patterns should align.

  3. Explore bid-based vs strength-based auction: Under random classifiers (varying specificity), bid-based selection would favor more specific rules. Adding a toggle parameter could test whether this affects convergence behavior.

Priority 3 — Conceptual Figures (Low Impact)

  1. Consider adding classifier flow diagram (Figure 1): The payment flow between exchange and consumption classifiers is central to the algorithm. A reproduction would aid comprehension, though this is an explanatory diagram rather than a result.

  2. Consider adding GA mating illustration (Figure 4): The crossover process for bit-string classifiers. Helpful for readers unfamiliar with genetic algorithms.


8. Content Beyond the Paper

The notebook includes several valuable additions not in the original paper:

FeatureDescriptionEconomies
Holdings distribution plotsTime series of all holding probabilitiesAll 8 (paper only has A1.1, A1.2)
Data-driven Wicksell trianglesExchange pattern diagrams with arrow thickness ∝ exchange frequencyAll 8
Trade/consumption activity ratesSmoothed rates over timeA1.1
Strength distribution histogramsDistribution of classifier strengths by typeA1.1
Human-readable classifier tableDecoded classifier conditions with strengthsA1.1
Trading pattern analysisAccept/refuse matrix checking fundamental consistencyD
Extended simulationEconomy D run to t=3000 (paper stops at t=1750)D
B.1 vs B.2 comparisonSide-by-side final holdingsB.1, B.2
Consumption frequencyReported for A/B economies at multiple time pointsA1.1, A1.2, A2.1, A2.2, B.1, B.2

Appendix: Paper-to-Notebook Table Mapping

Paper TableContentEconomyNotebookStatus
1Encoding schemeGeneralCell 8
2A1 eq. holdingsA1Cell 18✅ (also in paper)
3A1 eq. joint exchangeA1Paper📄 In paper text
4A1 eq. exchange strategiesA1Paper📄 In paper text
5A1 eq. consumptionA1Paper📄 In paper text
6Type I fundamental behaviorGeneralPaper📄 In paper text
7Type I speculative behaviorGeneralPaper📄 In paper text
8Master economy descriptionAllPaper📄 In paper text
9A1.1 parametersA1.1Cell 19
10A1.1 holdingsA1.1Cell 21
11A1.1 exchange freqA1.1Cell 21
12A1.1 winning actionsA1.1Cell 21
13A1.1 CS type I consumeA1.1Cell 21
14A1.1 CS type I exchangeA1.1Cell 21
15A1.1 CS type II consumeA1.1Cell 21
16A1.1 CS type II exchangeA1.1Cell 21
17A1.1 CS type III consumeA1.1Cell 21
18A1.1 CS type III exchangeA1.1Cell 21
19A1.2 parametersA1.2Cell 25
20A1.2 holdingsA1.2Cell 26
21A1.2 exchange freqA1.2Cell 26
22A1.2 winning actionsA1.2Cell 26
23A1.2 consumption freqA1.2Cell 26
24A1.2 CS type I consumeA1.2Cell 26
25A1.2 CS type I exchangeA1.2Cell 26
26A1.2 CS type II consumeA1.2Cell 26
27A1.2 CS type II exchangeA1.2Cell 26
28A1.2 CS type III consumeA1.2Cell 26
29A1.2 CS type III exchangeA1.2Cell 26
30A2.1 parametersA2.1Cell 29
31A2 speculative eq. holdingsA2Paper📄 In paper text
32A2 speculative eq. exchangeA2Paper📄 In paper text
33A2 speculative eq. strategiesA2Paper📄 In paper text
34A2.1 holdingsA2.1Cell 30
35A2.1 exchange freqA2.1Cell 30
36A2.1 winning actionsA2.1Cell 30
37B.1 parametersB.1Cell 37
38B fundamental eq. holdingsBPaper📄 In paper text
39B fundamental eq. exchangeBPaper📄 In paper text
40B fundamental eq. strategiesBPaper📄 In paper text
41B speculative eq. holdingsBPaper📄 In paper text
42B speculative eq. exchangeBPaper📄 In paper text
43B speculative eq. strategiesBPaper📄 In paper text
44B.1 holdingsB.1Cell 38
45B.1 exchange freqB.1Cell 38
46B.1 winning actionsB.1Cell 38
47B.1 consumption freqB.1Cell 38
48B.2 parametersB.2Cell 40
49B.2 holdingsB.2Cell 41
50B.2 exchange freqB.2Cell 41
51B.2 winning actionsB.2Cell 41
52C parametersCCell 45
53C fundamental eq. holdingsCPaper📄 In paper text
54C fundamental eq. exchangeCPaper📄 In paper text
55C fundamental eq. strategiesCPaper📄 In paper text
56C holdingsCCell 46
57C exchange freq t=750CCell 46
58C exchange freq t=1250CCell 46
59C winning actionsCCell 46
60D parametersDCell 50
61D holdings t=500DCell 51
62D holdings t=1750DCell 51
63D exchange freq t=500DCell 51
64D exchange freq t=1750DCell 51
65D winning actions t=500DCell 51
66D winning actions t=1750DCell 51