feat(posts): slider for romer time dynamics

This commit is contained in:
Barrett Ruth 2024-07-03 15:09:58 -05:00
parent 8cc845a1ca
commit 77c38c8999
2 changed files with 126 additions and 74 deletions

View file

@ -525,6 +525,24 @@
</li> </li>
</ul> </ul>
</div> </div>
<div style="padding-left: 20px">
<ul start="3">
<li>
<div class="slider">
<label for="slidert0">\(t_0:\)</label>
<span id="outputt0">50</span>
<input
type="range"
id="slidert0"
min="1"
max="99"
step="1"
value="50"
/>
</div>
</li>
</ul>
</div>
</div> </div>
<p> <p>
Notably, while both the Romer and Solow Models help to analyze Notably, while both the Romer and Solow Models help to analyze
@ -588,68 +606,98 @@
</div> </div>
</div> </div>
<div class="fold"><h3>solving the model</h3></div> <div class="fold"><h3>solving the model</h3></div>
<p> <div>
Based on the the motivations for creating this model, it is more <p>
useful to first analyze the growth rates of equilibrium long run Based on the the motivations for creating this model, it is more
output \(Y_t^*\). useful to first analyze the growth rates of equilibrium long run
</p> output \(Y_t^*\).
<p> </p>
According to the production function, \[g_Y=g_A+\alpha <p>
g_K+(1-\alpha)g_{L_{y}}\] According to the production function, \[g_Y=g_A+\alpha
</p> g_K+(1-\alpha)g_{L_y}\]
<p> </p>
From previous analysis it was found that <p>
\(g_A=\bar{z}\bar{l}\bar{L}\). From previous analysis it was found that
</p> \(g_A=\bar{z}\bar{l}\bar{L}\).
<p> </p>
Based on the <u>Law of Capital Motion</u>, \[g_K=\frac{\Delta <p>
K_{t+1}}{K_t}=\bar{s}\frac{Y_t}{K_t}-\bar{d}\] Based on the <u>Law of Capital Motion</u>, \[g_K=\frac{\Delta
</p> K_{t+1}}{K_t}=\bar{s}\frac{Y_t}{K_t}-\bar{d}\]
<p> </p>
Because growth rates are constant on the Balanced Growth Path, <p>
\(g_K\) must be constant as well. Thus, so is Because growth rates are constant on the Balanced Growth Path,
\(\bar{s}\frac{Y_t}{K_t}-\bar{d}\); it must be that \(g_K\) must be constant as well. Thus, so is
\(g_K^*=g_Y^*\). \(\bar{s}\frac{Y_t}{K_t}-\bar{d}\); it must be that
</p> \(g_K^*=g_Y^*\).
<p> </p>
The model assumes population is constant, so <p>
\(g_{\bar{L}}=0\rightarrow g_{\bar{L}_yt}=0\) as well. The model assumes population is constant, so
</p> \(g_{\bar{L}}=0\rightarrow g_{\bar{L}_yt}=0\) as well.
<p> </p>
Combining these terms, we find: <p>
\[g_Y^*=\bar{z}\bar{l}\bar{L}+\alpha g_Y^*+(1-\alpha)\cdot 0\] Combining these terms, we find:
\[\rightarrow g_Y^*=\frac{\bar{z}\bar{l}\bar{L}}{1-\alpha}\] \[g_Y^*=\bar{z}\bar{l}\bar{L}+\alpha g_Y^*+(1-\alpha)\cdot 0\]
</p> \[\rightarrow g_Y^*=\frac{\bar{z}\bar{l}\bar{L}}{1-\alpha}\]
<p> </p>
Solving for \(Y_t^*\) is trivial after discovering \(g_K=g_Y\) <p>
must hold on a balanced growth path. Solving for \(Y_t^*\) is trivial after discovering \(g_K=g_Y\)
</p> must hold on a balanced growth path.
<p> </p>
Invoking the <u>Law of Capital Motion</u> with magic chants, <p>
\[g_K^*=\bar{s}\frac{Y_t^*}{K_t^*}-\bar{d}=g_Y^*\rightarrow Invoking the <u>Law of Capital Motion</u> with magic chants,
K_t^*=\frac{\bar{s}Y_t^*}{g_Y^*+\bar{d}}\] \[g_K^*=\bar{s}\frac{Y_t^*}{K_t^*}-\bar{d}=g_Y^*\rightarrow
</p> K_t^*=\frac{\bar{s}Y_t^*}{g_Y^*+\bar{d}}\]
<p> </p>
Isolating \(Y_t^*\), \[Y_t^*=A_t^* <p>
(\frac{\bar{s}Y_t^*}{g_Y^*+\bar{d}})^\alpha Isolating \(Y_t^*\), \[Y_t^*=A_t^*
({(1-\bar{l})\bar{L}})^{1-\alpha}\] \[\rightarrow (\frac{\bar{s}Y_t^*}{g_Y^*+\bar{d}})^\alpha
{Y_t^*}^{1-\alpha}=A_t^*(\frac{\bar{s}}{g_Y^*+\bar{d}})^\alpha({(1-\bar{l})\bar{L}})^{1-\alpha}\] ({(1-\bar{l})\bar{L}})^{1-\alpha}\] \[\rightarrow
</p> {Y_t^*}^{1-\alpha}=A_t^*(\frac{\bar{s}}{g_Y^*+\bar{d}})^\alpha({(1-\bar{l})\bar{L}})^{1-\alpha}\]
<p> </p>
Plugging in the known expressions for \(A_t^*\) and \(g_Y^*\), a <p>
final expression for the Balanced Growth Path output as a function Plugging in the known expressions for \(A_t^*\) and \(g_Y^*\), a
of the endogenous parameters and time is obtained: \[ final expression for the Balanced Growth Path output as a
Y_t^*={(A_0(1+\bar{z}\bar{l}\bar{L})^t})^\frac{1}{1-\alpha}(\frac{\bar{s}}{\frac{\bar{z}\bar{l}\bar{L}}{1-\alpha}+\bar{d}})^\frac{\alpha}{1-\alpha}(1-\bar{l})\bar{L}\] function of the endogenous parameters and time is obtained: \[
</p> Y_t^*={(A_0(1+\bar{z}\bar{l}\bar{L})^t})^\frac{1}{1-\alpha}(\frac{\bar{s}}{\frac{\bar{z}\bar{l}\bar{L}}{1-\alpha}+\bar{d}})^\frac{\alpha}{1-\alpha}(1-\bar{l})\bar{L}\]
</div> </p>
<div class="fold"><h3>analysis</h3></div> </div>
<div> <div class="fold"><h3>analysis</h3></div>
<p> <div>
Intuitively, this means that idea-driving factors, as well as an <p>
increased allocation of labor to output, will increase the First looking at the growth rate of output,
Balanced Growth Path (the <i>level</i> of long-run growth), \(g_Y^*=\frac{\bar{z}\bar{l}\bar{L}}{1-\alpha}\), idea-driving
combining both the Romer and Solow model. factors and an increased allocation of labor to output increase
</p> the equilibrium Balanced Growth Path&mdash;the
<i>level</i> of long-run growth. Thus, this model captures the
influences of both capital and ideas on economic growth.
<!-- TODO: t_0 graph break in romer-model and post -->
</p>
<p>
Looking at \(Y_t^*\), ideas have both a direct and indirect
effect on output. Firstly, ideas raise output because they
increase productivity (directly); second, with the introduction
of capital stock, ideas also increase capital, in turn
increasing output further (indirectly). Mathematically, this is
evident in both instances of \(g_A^*\) in the formula for output
\(Y_t^*\)&mdash;note that
\(\frac{1}{1-\alpha},\frac{\alpha}{1-\alpha}>0\) for any
\(\alpha\in(0,1)\), so \(\frac{d}{dg_A^*}Y_t^*>0\).
</p>
<p>
Expectedly, output has a positive relationship with the savings
rate and a negative relationship with the depreciation rate.
</p>
<p>
However, do economics grow <i>faster</i>/<i>slower</i> the
further <i>below</i>/<i>above</i> they are from their Balanced
Growth Path, as initially desired? While this can be
mathematically proven (of course), sometimes a visualization
helps.
</p>
<div class="graph">
<div id="romer-solow-visualization"></div>
</div>
</div>
</div> </div>
</article> </article>
</div> </div>

View file

@ -303,13 +303,16 @@ function drawRomerlGraph() {
A0 = 50; A0 = 50;
margin = { top: 20, right: 100, bottom: 20, left: 50 }; margin = { top: 20, right: 100, bottom: 20, left: 50 };
const slider = document.getElementById(`sliderlChange`); ["lChange", "t0"].forEach((param) => {
slider.oninput = function () { const slider = document.getElementById(`slider${param}`);
slider.previousElementSibling.innerText = this.value; slider.oninput = function () {
drawRomerlGraph(); slider.previousElementSibling.innerText = this.value;
}; drawRomerlGraph();
};
});
const l = parseFloat(document.getElementById("outputlChange").textContent); const l = parseFloat(document.getElementById("outputlChange").textContent),
t0 = parseFloat(document.getElementById("outputt0").textContent);
const container = document.getElementById("romer-lchange-visualization"); const container = document.getElementById("romer-lchange-visualization");
const width = container.clientWidth - margin.left - margin.right; const width = container.clientWidth - margin.left - margin.right;
@ -329,14 +332,14 @@ function drawRomerlGraph() {
l_ = 0.1; l_ = 0.1;
const romerData = []; const romerData = [];
for (let t = 1; t <= Math.floor(T_MAX / 2) - 1; ++t) { for (let t = 1; t <= t0; ++t) {
const A_t = A * (1 + z * l_ * L); const A_t = A * (1 + z * l_ * L);
const Y_t = A_t * (1 - l_) * L; const Y_t = A_t * (1 - l_) * L;
romerData.push({ year: t, A: A_t, Y: Math.log10(Y_t) }); romerData.push({ year: t, A: A_t, Y: Math.log10(Y_t) });
A = A_t; A = A_t;
} }
for (let t = Math.floor(T_MAX / 2); t <= T_MAX; ++t) { for (let t = t0 + 1; t <= T_MAX; ++t) {
const A_t = A * (1 + z * l * L); const A_t = A * (1 + z * l * L);
const Y_t = A_t * (1 - l) * L; const Y_t = A_t * (1 - l) * L;
romerData.push({ year: t, A: A_t, Y: Math.log10(Y_t) }); romerData.push({ year: t, A: A_t, Y: Math.log10(Y_t) });
@ -385,11 +388,12 @@ function drawRomerlGraph() {
.y((d) => y(d.Y)), .y((d) => y(d.Y)),
); );
console.log(t0)
svg svg
.append("line") .append("line")
.attr("x1", x(T_MAX / 2)) .attr("x1", x(t0))
.attr("y1", y(romerData[T_MAX - 1].Y)) .attr("y1", y(romerData[T_MAX - 1].Y))
.attr("x2", x(T_MAX / 2)) .attr("x2", x(t0))
.attr("y2", height) .attr("y2", height)
.attr("stroke", "black") .attr("stroke", "black")
.attr("stroke-width", 1) .attr("stroke-width", 1)
@ -413,8 +417,8 @@ function drawRomerlGraph() {
.append("foreignObject") .append("foreignObject")
.attr("width", "5em") .attr("width", "5em")
.attr("height", "2em") .attr("height", "2em")
.attr("x", x(T_MAX / 2) + 15) .attr("x", x(t0) + 15)
.attr("y", y(romerData[T_MAX / 2].Y)) .attr("y", y(romerData[t0].Y))
.append("xhtml:body") .append("xhtml:body")
.style("font-size", "0.6em") .style("font-size", "0.6em")
.html(`<div class="romer-changel-after"></div>`); .html(`<div class="romer-changel-after"></div>`);