equilibria-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -0
- package/LICENSE +21 -0
- package/README.md +240 -0
- package/dist/builders/YAMLBuilder.d.ts +77 -0
- package/dist/builders/YAMLBuilder.d.ts.map +1 -0
- package/dist/builders/YAMLBuilder.js +251 -0
- package/dist/builders/YAMLBuilder.js.map +1 -0
- package/dist/economics/constants.d.ts +39 -0
- package/dist/economics/constants.d.ts.map +1 -0
- package/dist/economics/constants.js +46 -0
- package/dist/economics/constants.js.map +1 -0
- package/dist/economics/formulas.d.ts +19 -0
- package/dist/economics/formulas.d.ts.map +1 -0
- package/dist/economics/formulas.js +260 -0
- package/dist/economics/formulas.js.map +1 -0
- package/dist/economics/index.d.ts +9 -0
- package/dist/economics/index.d.ts.map +1 -0
- package/dist/economics/index.js +9 -0
- package/dist/economics/index.js.map +1 -0
- package/dist/economics/validators.d.ts +18 -0
- package/dist/economics/validators.d.ts.map +1 -0
- package/dist/economics/validators.js +111 -0
- package/dist/economics/validators.js.map +1 -0
- package/dist/errors/index.d.ts +172 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +313 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/formatters/index.d.ts +8 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +8 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/redux.d.ts +15 -0
- package/dist/formatters/redux.d.ts.map +1 -0
- package/dist/formatters/redux.js +35 -0
- package/dist/formatters/redux.js.map +1 -0
- package/dist/formatters/yaml.d.ts +18 -0
- package/dist/formatters/yaml.d.ts.map +1 -0
- package/dist/formatters/yaml.js +40 -0
- package/dist/formatters/yaml.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +14 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +86 -0
- package/dist/server.js.map +1 -0
- package/dist/templates/advancedMicro.d.ts +8 -0
- package/dist/templates/advancedMicro.d.ts.map +1 -0
- package/dist/templates/advancedMicro.js +834 -0
- package/dist/templates/advancedMicro.js.map +1 -0
- package/dist/templates/consumer.d.ts +12 -0
- package/dist/templates/consumer.d.ts.map +1 -0
- package/dist/templates/consumer.js +1978 -0
- package/dist/templates/consumer.js.map +1 -0
- package/dist/templates/elasticity.d.ts +8 -0
- package/dist/templates/elasticity.d.ts.map +1 -0
- package/dist/templates/elasticity.js +500 -0
- package/dist/templates/elasticity.js.map +1 -0
- package/dist/templates/externalities.d.ts +11 -0
- package/dist/templates/externalities.d.ts.map +1 -0
- package/dist/templates/externalities.js +997 -0
- package/dist/templates/externalities.js.map +1 -0
- package/dist/templates/financeBehavioral.d.ts +8 -0
- package/dist/templates/financeBehavioral.d.ts.map +1 -0
- package/dist/templates/financeBehavioral.js +860 -0
- package/dist/templates/financeBehavioral.js.map +1 -0
- package/dist/templates/growth.d.ts +8 -0
- package/dist/templates/growth.d.ts.map +1 -0
- package/dist/templates/growth.js +740 -0
- package/dist/templates/growth.js.map +1 -0
- package/dist/templates/index.d.ts +31 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +91 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/inequality.d.ts +8 -0
- package/dist/templates/inequality.d.ts.map +1 -0
- package/dist/templates/inequality.js +562 -0
- package/dist/templates/inequality.js.map +1 -0
- package/dist/templates/intertemporalMacro.d.ts +8 -0
- package/dist/templates/intertemporalMacro.d.ts.map +1 -0
- package/dist/templates/intertemporalMacro.js +550 -0
- package/dist/templates/intertemporalMacro.js.map +1 -0
- package/dist/templates/isLM.d.ts +8 -0
- package/dist/templates/isLM.d.ts.map +1 -0
- package/dist/templates/isLM.js +747 -0
- package/dist/templates/isLM.js.map +1 -0
- package/dist/templates/macro.d.ts +8 -0
- package/dist/templates/macro.d.ts.map +1 -0
- package/dist/templates/macro.js +600 -0
- package/dist/templates/macro.js.map +1 -0
- package/dist/templates/marketStructures.d.ts +11 -0
- package/dist/templates/marketStructures.d.ts.map +1 -0
- package/dist/templates/marketStructures.js +1135 -0
- package/dist/templates/marketStructures.js.map +1 -0
- package/dist/templates/newKeynesian.d.ts +8 -0
- package/dist/templates/newKeynesian.d.ts.map +1 -0
- package/dist/templates/newKeynesian.js +633 -0
- package/dist/templates/newKeynesian.js.map +1 -0
- package/dist/templates/oligopoly.d.ts +11 -0
- package/dist/templates/oligopoly.d.ts.map +1 -0
- package/dist/templates/oligopoly.js +1113 -0
- package/dist/templates/oligopoly.js.map +1 -0
- package/dist/templates/ppf.d.ts +8 -0
- package/dist/templates/ppf.d.ts.map +1 -0
- package/dist/templates/ppf.js +439 -0
- package/dist/templates/ppf.js.map +1 -0
- package/dist/templates/producer.d.ts +11 -0
- package/dist/templates/producer.d.ts.map +1 -0
- package/dist/templates/producer.js +979 -0
- package/dist/templates/producer.js.map +1 -0
- package/dist/templates/production.d.ts +8 -0
- package/dist/templates/production.d.ts.map +1 -0
- package/dist/templates/production.js +574 -0
- package/dist/templates/production.js.map +1 -0
- package/dist/templates/supplyDemand.d.ts +8 -0
- package/dist/templates/supplyDemand.d.ts.map +1 -0
- package/dist/templates/supplyDemand.js +1282 -0
- package/dist/templates/supplyDemand.js.map +1 -0
- package/dist/templates/tradeGrowth.d.ts +8 -0
- package/dist/templates/tradeGrowth.d.ts.map +1 -0
- package/dist/templates/tradeGrowth.js +637 -0
- package/dist/templates/tradeGrowth.js.map +1 -0
- package/dist/tools/index.d.ts +25 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +54 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/models.d.ts +8 -0
- package/dist/tools/models.d.ts.map +1 -0
- package/dist/tools/models.js +828 -0
- package/dist/tools/models.js.map +1 -0
- package/dist/tools/output.d.ts +8 -0
- package/dist/tools/output.d.ts.map +1 -0
- package/dist/tools/output.js +236 -0
- package/dist/tools/output.js.map +1 -0
- package/dist/tools/templates.d.ts +8 -0
- package/dist/tools/templates.d.ts.map +1 -0
- package/dist/tools/templates.js +247 -0
- package/dist/tools/templates.js.map +1 -0
- package/dist/tools/validation.d.ts +8 -0
- package/dist/tools/validation.d.ts.map +1 -0
- package/dist/tools/validation.js +181 -0
- package/dist/tools/validation.js.map +1 -0
- package/dist/types/index.d.ts +187 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cache.d.ts +99 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +192 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +128 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +251 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/validation/index.d.ts +42 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +282 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,740 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phillips Curve & Economic Growth Templates
|
|
3
|
+
*
|
|
4
|
+
* Templates for inflation-unemployment dynamics and long-run growth models.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Expectations-Augmented Phillips Curve
|
|
8
|
+
* Shows shifting SRPC based on inflation expectations
|
|
9
|
+
*/
|
|
10
|
+
const expectationsPhillipsCurve = {
|
|
11
|
+
id: 'expectations_phillips_curve',
|
|
12
|
+
name: 'Expectations-Augmented Phillips Curve',
|
|
13
|
+
description: 'Phillips curve with adaptive expectations showing how expected inflation shifts the short-run curve.',
|
|
14
|
+
category: 'macro',
|
|
15
|
+
level: 'undergraduate',
|
|
16
|
+
tags: ['Phillips curve', 'inflation expectations', 'NAIRU', 'unemployment'],
|
|
17
|
+
parameters: {
|
|
18
|
+
naturalRate: {
|
|
19
|
+
type: 'number',
|
|
20
|
+
default: 5,
|
|
21
|
+
description: 'Natural rate of unemployment (NAIRU) %',
|
|
22
|
+
},
|
|
23
|
+
initialExpectations: {
|
|
24
|
+
type: 'number',
|
|
25
|
+
default: 2,
|
|
26
|
+
description: 'Initial expected inflation %',
|
|
27
|
+
},
|
|
28
|
+
newExpectations: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
default: 4,
|
|
31
|
+
description: 'New expected inflation %',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
generate: (params) => {
|
|
35
|
+
const un = params.naturalRate ?? 5;
|
|
36
|
+
const pe0 = params.initialExpectations ?? 2;
|
|
37
|
+
const pe1 = params.newExpectations ?? 4;
|
|
38
|
+
return {
|
|
39
|
+
metadata: {
|
|
40
|
+
specVersion: '1.3',
|
|
41
|
+
title: 'Expectations-Augmented Phillips Curve',
|
|
42
|
+
description: 'Shifting short-run Phillips curves with inflation expectations',
|
|
43
|
+
},
|
|
44
|
+
parameters: {
|
|
45
|
+
un: { value: un, label: 'Natural Rate (%)', min: 2, max: 10 },
|
|
46
|
+
pe0: { value: pe0, label: 'Initial πᵉ (%)', min: 0, max: 8 },
|
|
47
|
+
pe1: { value: pe1, label: 'New πᵉ (%)', min: 0, max: 10 },
|
|
48
|
+
alpha: { value: 0.5, label: 'Slope', min: 0.2, max: 1, step: 0.1 },
|
|
49
|
+
u: { value: un, label: 'Unemployment (%)', min: 2, max: 10 },
|
|
50
|
+
pi0: {
|
|
51
|
+
expression: 'pe0 - alpha * (u - un)',
|
|
52
|
+
label: 'Initial π',
|
|
53
|
+
readonly: true,
|
|
54
|
+
},
|
|
55
|
+
pi1: {
|
|
56
|
+
expression: 'pe1 - alpha * (u - un)',
|
|
57
|
+
label: 'New π',
|
|
58
|
+
readonly: true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
charts: [
|
|
62
|
+
{
|
|
63
|
+
id: 'main',
|
|
64
|
+
title: 'Expectations-Augmented Phillips Curve',
|
|
65
|
+
xAxis: { label: 'Unemployment Rate (%)', min: 0, max: 12 },
|
|
66
|
+
yAxis: { label: 'Inflation Rate (%)', min: -2, max: 12 },
|
|
67
|
+
elements: [
|
|
68
|
+
// LRPC (vertical at natural rate)
|
|
69
|
+
{
|
|
70
|
+
id: 'lrpc',
|
|
71
|
+
type: 'verticalLine',
|
|
72
|
+
x: 'un',
|
|
73
|
+
color: '#16A34A',
|
|
74
|
+
strokeWidth: 3,
|
|
75
|
+
label: 'LRPC',
|
|
76
|
+
},
|
|
77
|
+
// Initial SRPC
|
|
78
|
+
{
|
|
79
|
+
id: 'srpc0',
|
|
80
|
+
type: 'line',
|
|
81
|
+
equation: 'pe0 - alpha * (x - un)',
|
|
82
|
+
color: '#93C5FD',
|
|
83
|
+
lineStyle: 'dashed',
|
|
84
|
+
strokeWidth: 2,
|
|
85
|
+
label: 'SRPC₀',
|
|
86
|
+
curveLabel: { text: 'SRPC (πᵉ=2%)', x: 9, position: 'below' },
|
|
87
|
+
},
|
|
88
|
+
// New SRPC
|
|
89
|
+
{
|
|
90
|
+
id: 'srpc1',
|
|
91
|
+
type: 'line',
|
|
92
|
+
equation: 'pe1 - alpha * (x - un)',
|
|
93
|
+
color: '#2563EB',
|
|
94
|
+
strokeWidth: 3,
|
|
95
|
+
label: 'SRPC₁',
|
|
96
|
+
curveLabel: { text: 'SRPC (πᵉ=4%)', x: 9, position: 'below' },
|
|
97
|
+
},
|
|
98
|
+
// Natural rate point on initial curve
|
|
99
|
+
{
|
|
100
|
+
id: 'nairu0',
|
|
101
|
+
type: 'point',
|
|
102
|
+
x: 'un',
|
|
103
|
+
y: 'pe0',
|
|
104
|
+
color: '#6B7280',
|
|
105
|
+
label: 'A',
|
|
106
|
+
},
|
|
107
|
+
// Natural rate point on new curve
|
|
108
|
+
{
|
|
109
|
+
id: 'nairu1',
|
|
110
|
+
type: 'point',
|
|
111
|
+
x: 'un',
|
|
112
|
+
y: 'pe1',
|
|
113
|
+
color: '#DC2626',
|
|
114
|
+
label: 'B',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
annotations: [
|
|
118
|
+
{
|
|
119
|
+
id: 'lrpc-label',
|
|
120
|
+
text: 'LRPC (uₙ = ${un}%)',
|
|
121
|
+
x: 'un + 1',
|
|
122
|
+
y: 10,
|
|
123
|
+
color: '#16A34A',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 'shift-label',
|
|
127
|
+
text: '↑ πᵉ shifts SRPC up',
|
|
128
|
+
x: 7,
|
|
129
|
+
y: 'pe1 + 2',
|
|
130
|
+
color: '#7C3AED',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Phillips Curve with Supply Shock
|
|
140
|
+
* Shows stagflation from adverse supply shock
|
|
141
|
+
*/
|
|
142
|
+
const phillipsCurveSupplyShock = {
|
|
143
|
+
id: 'phillips_curve_supply_shock',
|
|
144
|
+
name: 'Phillips Curve: Supply Shock',
|
|
145
|
+
description: 'Shows how an adverse supply shock causes stagflation - simultaneous inflation and unemployment.',
|
|
146
|
+
category: 'macro',
|
|
147
|
+
level: 'undergraduate',
|
|
148
|
+
tags: ['Phillips curve', 'supply shock', 'stagflation', 'oil shock'],
|
|
149
|
+
parameters: {
|
|
150
|
+
shockSize: {
|
|
151
|
+
type: 'number',
|
|
152
|
+
default: 3,
|
|
153
|
+
description: 'Size of supply shock (inflation points)',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
generate: (params) => {
|
|
157
|
+
const shock = params.shockSize ?? 3;
|
|
158
|
+
return {
|
|
159
|
+
metadata: {
|
|
160
|
+
specVersion: '1.3',
|
|
161
|
+
title: 'Phillips Curve: Supply Shock',
|
|
162
|
+
description: 'Adverse supply shock causing stagflation',
|
|
163
|
+
},
|
|
164
|
+
parameters: {
|
|
165
|
+
un: { value: 5, label: 'Natural Rate (%)' },
|
|
166
|
+
pe: { value: 2, label: 'Expected Inflation (%)' },
|
|
167
|
+
alpha: { value: 0.5, label: 'Slope' },
|
|
168
|
+
shock: { value: shock, label: 'Supply Shock', min: -2, max: 6 },
|
|
169
|
+
// Initial equilibrium
|
|
170
|
+
u0: { value: 5, label: 'Initial u', readonly: true },
|
|
171
|
+
pi0: { value: 2, label: 'Initial π', readonly: true },
|
|
172
|
+
// After shock (before adjustment)
|
|
173
|
+
u1: { value: 7, label: 'Interim u' },
|
|
174
|
+
pi1: {
|
|
175
|
+
expression: 'pe + shock - alpha * (u1 - un)',
|
|
176
|
+
label: 'Interim π',
|
|
177
|
+
readonly: true,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
charts: [
|
|
181
|
+
{
|
|
182
|
+
id: 'main',
|
|
183
|
+
title: 'Supply Shock and Stagflation',
|
|
184
|
+
xAxis: { label: 'Unemployment Rate (%)', min: 0, max: 12 },
|
|
185
|
+
yAxis: { label: 'Inflation Rate (%)', min: -2, max: 12 },
|
|
186
|
+
elements: [
|
|
187
|
+
// LRPC
|
|
188
|
+
{
|
|
189
|
+
id: 'lrpc',
|
|
190
|
+
type: 'verticalLine',
|
|
191
|
+
x: 'un',
|
|
192
|
+
color: '#16A34A',
|
|
193
|
+
strokeWidth: 2,
|
|
194
|
+
lineStyle: 'dashed',
|
|
195
|
+
},
|
|
196
|
+
// Original SRPC
|
|
197
|
+
{
|
|
198
|
+
id: 'srpc0',
|
|
199
|
+
type: 'line',
|
|
200
|
+
equation: 'pe - alpha * (x - un)',
|
|
201
|
+
color: '#93C5FD',
|
|
202
|
+
lineStyle: 'dashed',
|
|
203
|
+
strokeWidth: 2,
|
|
204
|
+
label: 'SRPC₀',
|
|
205
|
+
},
|
|
206
|
+
// Shocked SRPC (shifted up)
|
|
207
|
+
{
|
|
208
|
+
id: 'srpc1',
|
|
209
|
+
type: 'line',
|
|
210
|
+
equation: 'pe + shock - alpha * (x - un)',
|
|
211
|
+
color: '#DC2626',
|
|
212
|
+
strokeWidth: 3,
|
|
213
|
+
label: 'SRPC₁',
|
|
214
|
+
},
|
|
215
|
+
// Initial equilibrium
|
|
216
|
+
{
|
|
217
|
+
id: 'eq0',
|
|
218
|
+
type: 'point',
|
|
219
|
+
x: 'u0',
|
|
220
|
+
y: 'pi0',
|
|
221
|
+
color: '#16A34A',
|
|
222
|
+
size: 10,
|
|
223
|
+
label: 'A (Initial)',
|
|
224
|
+
},
|
|
225
|
+
// After shock (stagflation)
|
|
226
|
+
{
|
|
227
|
+
id: 'eq1',
|
|
228
|
+
type: 'point',
|
|
229
|
+
x: 'u1',
|
|
230
|
+
y: 'pi1',
|
|
231
|
+
color: '#DC2626',
|
|
232
|
+
size: 10,
|
|
233
|
+
label: 'B (Stagflation)',
|
|
234
|
+
droplines: { x: true, y: true },
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
annotations: [
|
|
238
|
+
{
|
|
239
|
+
id: 'shock-label',
|
|
240
|
+
text: 'Supply shock (+${shock}%)',
|
|
241
|
+
x: 8,
|
|
242
|
+
y: 'pe + shock + 2',
|
|
243
|
+
color: '#DC2626',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: 'stagflation',
|
|
247
|
+
text: 'Stagflation: ↑π & ↑u',
|
|
248
|
+
x: '(u0 + u1) / 2',
|
|
249
|
+
y: '(pi0 + pi1) / 2 + 1',
|
|
250
|
+
color: '#7C3AED',
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
};
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Solow Growth Model - Basic
|
|
260
|
+
* Shows steady state with capital accumulation
|
|
261
|
+
*/
|
|
262
|
+
const solowBasic = {
|
|
263
|
+
id: 'solow_growth_basic',
|
|
264
|
+
name: 'Solow Growth Model',
|
|
265
|
+
description: 'Basic Solow model showing capital accumulation and steady state equilibrium.',
|
|
266
|
+
category: 'macro',
|
|
267
|
+
level: 'undergraduate',
|
|
268
|
+
tags: ['growth', 'Solow', 'capital accumulation', 'steady state'],
|
|
269
|
+
parameters: {
|
|
270
|
+
savingsRate: {
|
|
271
|
+
type: 'number',
|
|
272
|
+
default: 0.3,
|
|
273
|
+
description: 'Savings rate (s)',
|
|
274
|
+
},
|
|
275
|
+
depreciation: {
|
|
276
|
+
type: 'number',
|
|
277
|
+
default: 0.1,
|
|
278
|
+
description: 'Depreciation rate (δ)',
|
|
279
|
+
},
|
|
280
|
+
alpha: {
|
|
281
|
+
type: 'number',
|
|
282
|
+
default: 0.3,
|
|
283
|
+
description: 'Capital share (α)',
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
generate: (params) => {
|
|
287
|
+
const s = params.savingsRate ?? 0.3;
|
|
288
|
+
const delta = params.depreciation ?? 0.1;
|
|
289
|
+
const alpha = params.alpha ?? 0.3;
|
|
290
|
+
return {
|
|
291
|
+
metadata: {
|
|
292
|
+
specVersion: '1.3',
|
|
293
|
+
title: 'Solow Growth Model',
|
|
294
|
+
description: 'Capital accumulation and steady state',
|
|
295
|
+
},
|
|
296
|
+
parameters: {
|
|
297
|
+
s: { value: s, label: 'Savings Rate', min: 0.1, max: 0.5, step: 0.05 },
|
|
298
|
+
delta: { value: delta, label: 'Depreciation (δ)', min: 0.05, max: 0.2, step: 0.01 },
|
|
299
|
+
alpha: { value: alpha, label: 'Capital Share (α)', min: 0.2, max: 0.5, step: 0.05 },
|
|
300
|
+
A: { value: 1, label: 'Technology (A)' },
|
|
301
|
+
n: { value: 0.02, label: 'Population Growth (n)' },
|
|
302
|
+
// Effective depreciation
|
|
303
|
+
effDep: {
|
|
304
|
+
expression: 'delta + n',
|
|
305
|
+
label: 'Effective Depreciation',
|
|
306
|
+
readonly: true,
|
|
307
|
+
},
|
|
308
|
+
// Steady state capital (per worker)
|
|
309
|
+
kStar: {
|
|
310
|
+
expression: '(s * A / effDep) ^ (1 / (1 - alpha))',
|
|
311
|
+
label: 'k* (Steady State)',
|
|
312
|
+
readonly: true,
|
|
313
|
+
},
|
|
314
|
+
// Steady state output (per worker)
|
|
315
|
+
yStar: {
|
|
316
|
+
expression: 'A * kStar ^ alpha',
|
|
317
|
+
label: 'y* (Steady State)',
|
|
318
|
+
readonly: true,
|
|
319
|
+
},
|
|
320
|
+
// Current capital
|
|
321
|
+
k: { value: 5, label: 'Current k', min: 0, max: 20 },
|
|
322
|
+
// Output at current k
|
|
323
|
+
y: {
|
|
324
|
+
expression: 'A * k ^ alpha',
|
|
325
|
+
label: 'Current y',
|
|
326
|
+
readonly: true,
|
|
327
|
+
},
|
|
328
|
+
// Investment
|
|
329
|
+
investment: {
|
|
330
|
+
expression: 's * y',
|
|
331
|
+
label: 'Investment (sy)',
|
|
332
|
+
readonly: true,
|
|
333
|
+
},
|
|
334
|
+
// Depreciation at current k
|
|
335
|
+
depreciation: {
|
|
336
|
+
expression: 'effDep * k',
|
|
337
|
+
label: 'Depreciation',
|
|
338
|
+
readonly: true,
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
charts: [
|
|
342
|
+
{
|
|
343
|
+
id: 'main',
|
|
344
|
+
title: 'Solow Model: Steady State',
|
|
345
|
+
xAxis: { label: 'Capital per Worker (k)', min: 0, max: 20 },
|
|
346
|
+
yAxis: { label: 'Output per Worker (y)', min: 0, max: 'yStar * 1.5' },
|
|
347
|
+
elements: [
|
|
348
|
+
// Production function
|
|
349
|
+
{
|
|
350
|
+
id: 'production',
|
|
351
|
+
type: 'line',
|
|
352
|
+
equation: 'A * x ^ alpha',
|
|
353
|
+
color: '#2563EB',
|
|
354
|
+
strokeWidth: 3,
|
|
355
|
+
label: 'y = f(k)',
|
|
356
|
+
curveLabel: { text: 'y = Akᵅ', x: 18, position: 'above' },
|
|
357
|
+
},
|
|
358
|
+
// Investment (savings)
|
|
359
|
+
{
|
|
360
|
+
id: 'investment',
|
|
361
|
+
type: 'line',
|
|
362
|
+
equation: 's * A * x ^ alpha',
|
|
363
|
+
color: '#16A34A',
|
|
364
|
+
strokeWidth: 2,
|
|
365
|
+
label: 'sy = sf(k)',
|
|
366
|
+
curveLabel: { text: 'sy', x: 18, position: 'above' },
|
|
367
|
+
},
|
|
368
|
+
// Depreciation line
|
|
369
|
+
{
|
|
370
|
+
id: 'depreciation',
|
|
371
|
+
type: 'line',
|
|
372
|
+
equation: 'effDep * x',
|
|
373
|
+
color: '#DC2626',
|
|
374
|
+
strokeWidth: 2,
|
|
375
|
+
label: '(δ+n)k',
|
|
376
|
+
curveLabel: { text: '(δ+n)k', x: 18, position: 'above' },
|
|
377
|
+
},
|
|
378
|
+
// Steady state point
|
|
379
|
+
{
|
|
380
|
+
id: 'steadyState',
|
|
381
|
+
type: 'point',
|
|
382
|
+
x: 'kStar',
|
|
383
|
+
y: 's * yStar',
|
|
384
|
+
color: '#7C3AED',
|
|
385
|
+
size: 10,
|
|
386
|
+
label: 'Steady State',
|
|
387
|
+
droplines: { x: 'k*', y: false },
|
|
388
|
+
},
|
|
389
|
+
// Current position
|
|
390
|
+
{
|
|
391
|
+
id: 'current',
|
|
392
|
+
type: 'point',
|
|
393
|
+
x: 'k',
|
|
394
|
+
y: 's * y',
|
|
395
|
+
color: '#F59E0B',
|
|
396
|
+
size: 8,
|
|
397
|
+
label: 'Current',
|
|
398
|
+
draggable: true,
|
|
399
|
+
dragConfig: {
|
|
400
|
+
mode: 'expression',
|
|
401
|
+
parameters: { expressions: { k: 'x' } },
|
|
402
|
+
constraints: { bounds: { minX: 0.5, maxX: 19 } },
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
],
|
|
406
|
+
annotations: [
|
|
407
|
+
{
|
|
408
|
+
id: 'steadystate-label',
|
|
409
|
+
text: 'k* = ${kStar:.2f}',
|
|
410
|
+
x: 'kStar + 1',
|
|
411
|
+
y: 's * yStar + 0.3',
|
|
412
|
+
color: '#7C3AED',
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
id: 'gap-label',
|
|
416
|
+
text: 'Gap = ${investment - depreciation:.2f}',
|
|
417
|
+
x: 'k',
|
|
418
|
+
y: 'max(investment, depreciation) + 0.5',
|
|
419
|
+
color: '#F59E0B',
|
|
420
|
+
},
|
|
421
|
+
],
|
|
422
|
+
},
|
|
423
|
+
],
|
|
424
|
+
};
|
|
425
|
+
},
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Solow Golden Rule
|
|
429
|
+
* Shows consumption-maximizing savings rate
|
|
430
|
+
*/
|
|
431
|
+
const solowGoldenRule = {
|
|
432
|
+
id: 'solow_golden_rule',
|
|
433
|
+
name: 'Solow Golden Rule',
|
|
434
|
+
description: 'Shows the golden rule savings rate that maximizes steady-state consumption.',
|
|
435
|
+
category: 'macro',
|
|
436
|
+
level: 'undergraduate',
|
|
437
|
+
tags: ['growth', 'Solow', 'golden rule', 'optimal savings', 'consumption'],
|
|
438
|
+
parameters: {
|
|
439
|
+
alpha: {
|
|
440
|
+
type: 'number',
|
|
441
|
+
default: 0.3,
|
|
442
|
+
description: 'Capital share (α) - also the golden rule savings rate',
|
|
443
|
+
},
|
|
444
|
+
currentSavings: {
|
|
445
|
+
type: 'number',
|
|
446
|
+
default: 0.2,
|
|
447
|
+
description: 'Current savings rate',
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
generate: (params) => {
|
|
451
|
+
const alpha = params.alpha ?? 0.3;
|
|
452
|
+
const s = params.currentSavings ?? 0.2;
|
|
453
|
+
return {
|
|
454
|
+
metadata: {
|
|
455
|
+
specVersion: '1.3',
|
|
456
|
+
title: 'Solow Golden Rule',
|
|
457
|
+
description: 'Consumption-maximizing steady state',
|
|
458
|
+
},
|
|
459
|
+
parameters: {
|
|
460
|
+
alpha: { value: alpha, label: 'Capital Share (α)', min: 0.2, max: 0.5, step: 0.05 },
|
|
461
|
+
s: { value: s, label: 'Savings Rate (s)', min: 0.1, max: 0.6, step: 0.05 },
|
|
462
|
+
sGold: {
|
|
463
|
+
expression: 'alpha',
|
|
464
|
+
label: 'Golden Rule s*',
|
|
465
|
+
readonly: true,
|
|
466
|
+
},
|
|
467
|
+
delta: { value: 0.1, label: 'Depreciation' },
|
|
468
|
+
A: { value: 1, label: 'Technology' },
|
|
469
|
+
n: { value: 0.02, label: 'Pop. Growth' },
|
|
470
|
+
effDep: { expression: 'delta + n', hidden: true },
|
|
471
|
+
// Steady state at current s
|
|
472
|
+
kStar: {
|
|
473
|
+
expression: '(s * A / effDep) ^ (1 / (1 - alpha))',
|
|
474
|
+
label: 'k* (current)',
|
|
475
|
+
readonly: true,
|
|
476
|
+
},
|
|
477
|
+
yStar: {
|
|
478
|
+
expression: 'A * kStar ^ alpha',
|
|
479
|
+
label: 'y* (current)',
|
|
480
|
+
readonly: true,
|
|
481
|
+
},
|
|
482
|
+
cStar: {
|
|
483
|
+
expression: '(1 - s) * yStar',
|
|
484
|
+
label: 'c* (current)',
|
|
485
|
+
readonly: true,
|
|
486
|
+
},
|
|
487
|
+
// Golden rule steady state
|
|
488
|
+
kGold: {
|
|
489
|
+
expression: '(sGold * A / effDep) ^ (1 / (1 - alpha))',
|
|
490
|
+
label: 'k* (golden)',
|
|
491
|
+
readonly: true,
|
|
492
|
+
},
|
|
493
|
+
yGold: {
|
|
494
|
+
expression: 'A * kGold ^ alpha',
|
|
495
|
+
label: 'y* (golden)',
|
|
496
|
+
readonly: true,
|
|
497
|
+
},
|
|
498
|
+
cGold: {
|
|
499
|
+
expression: '(1 - sGold) * yGold',
|
|
500
|
+
label: 'c* (golden)',
|
|
501
|
+
readonly: true,
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
charts: [
|
|
505
|
+
{
|
|
506
|
+
id: 'main',
|
|
507
|
+
title: 'Golden Rule Savings Rate',
|
|
508
|
+
xAxis: { label: 'Savings Rate (s)', min: 0, max: 0.7 },
|
|
509
|
+
yAxis: { label: 'Steady State Consumption', min: 0, max: 'cGold * 1.3' },
|
|
510
|
+
elements: [
|
|
511
|
+
// Consumption as function of s
|
|
512
|
+
{
|
|
513
|
+
id: 'consumption',
|
|
514
|
+
type: 'line',
|
|
515
|
+
equation: '(1 - x) * A * ((x * A / effDep) ^ (alpha / (1 - alpha)))',
|
|
516
|
+
color: '#2563EB',
|
|
517
|
+
strokeWidth: 3,
|
|
518
|
+
label: 'c*(s)',
|
|
519
|
+
},
|
|
520
|
+
// Golden rule vertical line
|
|
521
|
+
{
|
|
522
|
+
id: 'golden-line',
|
|
523
|
+
type: 'verticalLine',
|
|
524
|
+
x: 'sGold',
|
|
525
|
+
color: '#F59E0B',
|
|
526
|
+
strokeWidth: 2,
|
|
527
|
+
lineStyle: 'dashed',
|
|
528
|
+
},
|
|
529
|
+
// Golden rule point
|
|
530
|
+
{
|
|
531
|
+
id: 'goldenPoint',
|
|
532
|
+
type: 'point',
|
|
533
|
+
x: 'sGold',
|
|
534
|
+
y: 'cGold',
|
|
535
|
+
color: '#F59E0B',
|
|
536
|
+
size: 12,
|
|
537
|
+
label: 'Golden Rule',
|
|
538
|
+
},
|
|
539
|
+
// Current savings point
|
|
540
|
+
{
|
|
541
|
+
id: 'currentPoint',
|
|
542
|
+
type: 'point',
|
|
543
|
+
x: 's',
|
|
544
|
+
y: 'cStar',
|
|
545
|
+
color: '#DC2626',
|
|
546
|
+
size: 10,
|
|
547
|
+
label: 'Current',
|
|
548
|
+
droplines: { x: true, y: true },
|
|
549
|
+
draggable: true,
|
|
550
|
+
dragConfig: {
|
|
551
|
+
mode: 'expression',
|
|
552
|
+
parameters: { expressions: { s: 'x' } },
|
|
553
|
+
constraints: { bounds: { minX: 0.05, maxX: 0.65 } },
|
|
554
|
+
},
|
|
555
|
+
},
|
|
556
|
+
],
|
|
557
|
+
annotations: [
|
|
558
|
+
{
|
|
559
|
+
id: 'golden-label',
|
|
560
|
+
text: 's* = α = ${sGold:.2f}',
|
|
561
|
+
x: 'sGold + 0.05',
|
|
562
|
+
y: 'cGold * 1.1',
|
|
563
|
+
color: '#F59E0B',
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
id: 'consumption-label',
|
|
567
|
+
text: 'c* = ${cStar:.2f}',
|
|
568
|
+
x: 's + 0.05',
|
|
569
|
+
y: 'cStar',
|
|
570
|
+
color: '#DC2626',
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
id: 'rule-note',
|
|
574
|
+
text: 'MPK = δ + n at golden rule',
|
|
575
|
+
x: 0.45,
|
|
576
|
+
y: 'cGold * 0.3',
|
|
577
|
+
color: '#6B7280',
|
|
578
|
+
},
|
|
579
|
+
],
|
|
580
|
+
},
|
|
581
|
+
],
|
|
582
|
+
};
|
|
583
|
+
},
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* Endogenous Growth (AK Model)
|
|
587
|
+
* Shows constant returns and sustained growth
|
|
588
|
+
*/
|
|
589
|
+
const endogenousGrowthAK = {
|
|
590
|
+
id: 'endogenous_growth_ak',
|
|
591
|
+
name: 'AK Endogenous Growth Model',
|
|
592
|
+
description: 'Simple endogenous growth model with constant returns to capital (no diminishing returns).',
|
|
593
|
+
category: 'macro',
|
|
594
|
+
level: 'postgraduate',
|
|
595
|
+
tags: ['growth', 'endogenous', 'AK model', 'no convergence'],
|
|
596
|
+
parameters: {
|
|
597
|
+
productivity: {
|
|
598
|
+
type: 'number',
|
|
599
|
+
default: 0.2,
|
|
600
|
+
description: 'Productivity parameter (A)',
|
|
601
|
+
},
|
|
602
|
+
savingsRate: {
|
|
603
|
+
type: 'number',
|
|
604
|
+
default: 0.25,
|
|
605
|
+
description: 'Savings rate (s)',
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
generate: (params) => {
|
|
609
|
+
const A = params.productivity ?? 0.2;
|
|
610
|
+
const s = params.savingsRate ?? 0.25;
|
|
611
|
+
return {
|
|
612
|
+
metadata: {
|
|
613
|
+
specVersion: '1.3',
|
|
614
|
+
title: 'AK Endogenous Growth Model',
|
|
615
|
+
description: 'Constant returns and sustained per-capita growth',
|
|
616
|
+
},
|
|
617
|
+
parameters: {
|
|
618
|
+
A: { value: A, label: 'Productivity (A)', min: 0.1, max: 0.4, step: 0.02 },
|
|
619
|
+
s: { value: s, label: 'Savings Rate (s)', min: 0.1, max: 0.5, step: 0.05 },
|
|
620
|
+
delta: { value: 0.05, label: 'Depreciation (δ)' },
|
|
621
|
+
n: { value: 0.02, label: 'Population Growth (n)' },
|
|
622
|
+
// Growth rate in AK model
|
|
623
|
+
growthRate: {
|
|
624
|
+
expression: 's * A - delta - n',
|
|
625
|
+
label: 'Growth Rate (g)',
|
|
626
|
+
readonly: true,
|
|
627
|
+
},
|
|
628
|
+
// Initial values
|
|
629
|
+
k0: { value: 10, label: 'Initial k' },
|
|
630
|
+
t: { value: 0, label: 'Time', min: 0, max: 50 },
|
|
631
|
+
// Capital at time t
|
|
632
|
+
kt: {
|
|
633
|
+
expression: 'k0 * exp(growthRate * t)',
|
|
634
|
+
label: 'k(t)',
|
|
635
|
+
readonly: true,
|
|
636
|
+
},
|
|
637
|
+
// Output at time t
|
|
638
|
+
yt: {
|
|
639
|
+
expression: 'A * kt',
|
|
640
|
+
label: 'y(t)',
|
|
641
|
+
readonly: true,
|
|
642
|
+
},
|
|
643
|
+
},
|
|
644
|
+
charts: [
|
|
645
|
+
{
|
|
646
|
+
id: 'diagram',
|
|
647
|
+
title: 'AK Model: Investment vs Depreciation',
|
|
648
|
+
xAxis: { label: 'Capital per Worker (k)', min: 0, max: 50 },
|
|
649
|
+
yAxis: { label: 'Investment / Depreciation', min: 0, max: 'max(s * A * 50, (delta + n) * 50)' },
|
|
650
|
+
elements: [
|
|
651
|
+
// Investment line (constant slope = sA)
|
|
652
|
+
{
|
|
653
|
+
id: 'investment',
|
|
654
|
+
type: 'line',
|
|
655
|
+
equation: 's * A * x',
|
|
656
|
+
color: '#16A34A',
|
|
657
|
+
strokeWidth: 3,
|
|
658
|
+
label: 'sAk (Investment)',
|
|
659
|
+
},
|
|
660
|
+
// Depreciation line
|
|
661
|
+
{
|
|
662
|
+
id: 'depreciation',
|
|
663
|
+
type: 'line',
|
|
664
|
+
equation: '(delta + n) * x',
|
|
665
|
+
color: '#DC2626',
|
|
666
|
+
strokeWidth: 3,
|
|
667
|
+
label: '(δ+n)k',
|
|
668
|
+
},
|
|
669
|
+
],
|
|
670
|
+
annotations: [
|
|
671
|
+
{
|
|
672
|
+
id: 'growth-label',
|
|
673
|
+
text: 'g = sA - δ - n = ${growthRate:.1%}',
|
|
674
|
+
x: 25,
|
|
675
|
+
y: 's * A * 30',
|
|
676
|
+
color: '#7C3AED',
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
id: 'note',
|
|
680
|
+
text: 'Parallel lines → constant growth',
|
|
681
|
+
x: 25,
|
|
682
|
+
y: '(delta + n) * 15',
|
|
683
|
+
color: '#6B7280',
|
|
684
|
+
},
|
|
685
|
+
],
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
id: 'growth',
|
|
689
|
+
title: 'Growth Path Over Time',
|
|
690
|
+
xAxis: { label: 'Time', min: 0, max: 50 },
|
|
691
|
+
yAxis: { label: 'Output per Worker (y)', min: 0, max: 'A * k0 * exp(growthRate * 50) * 1.1' },
|
|
692
|
+
elements: [
|
|
693
|
+
// Growth path
|
|
694
|
+
{
|
|
695
|
+
id: 'path',
|
|
696
|
+
type: 'line',
|
|
697
|
+
equation: 'A * k0 * exp(growthRate * x)',
|
|
698
|
+
color: '#2563EB',
|
|
699
|
+
strokeWidth: 3,
|
|
700
|
+
label: 'y(t)',
|
|
701
|
+
},
|
|
702
|
+
// Current position
|
|
703
|
+
{
|
|
704
|
+
id: 'current',
|
|
705
|
+
type: 'point',
|
|
706
|
+
x: 't',
|
|
707
|
+
y: 'yt',
|
|
708
|
+
color: '#F59E0B',
|
|
709
|
+
size: 10,
|
|
710
|
+
label: 'Current',
|
|
711
|
+
draggable: true,
|
|
712
|
+
dragConfig: {
|
|
713
|
+
mode: 'expression',
|
|
714
|
+
parameters: { expressions: { t: 'x' } },
|
|
715
|
+
constraints: { bounds: { minX: 0, maxX: 50 } },
|
|
716
|
+
},
|
|
717
|
+
},
|
|
718
|
+
],
|
|
719
|
+
annotations: [
|
|
720
|
+
{
|
|
721
|
+
id: 'exp-label',
|
|
722
|
+
text: 'Exponential growth at ${growthRate:.1%}/period',
|
|
723
|
+
x: 25,
|
|
724
|
+
y: 'A * k0 * exp(growthRate * 25) * 1.2',
|
|
725
|
+
color: '#2563EB',
|
|
726
|
+
},
|
|
727
|
+
],
|
|
728
|
+
},
|
|
729
|
+
],
|
|
730
|
+
};
|
|
731
|
+
},
|
|
732
|
+
};
|
|
733
|
+
export const growthTemplates = [
|
|
734
|
+
expectationsPhillipsCurve,
|
|
735
|
+
phillipsCurveSupplyShock,
|
|
736
|
+
solowBasic,
|
|
737
|
+
solowGoldenRule,
|
|
738
|
+
endogenousGrowthAK,
|
|
739
|
+
];
|
|
740
|
+
//# sourceMappingURL=growth.js.map
|