feat(posts): models of production solow model

This commit is contained in:
Barrett Ruth 2024-06-26 16:14:10 -05:00
parent cae425da1a
commit 26815a522b
3 changed files with 346 additions and 10 deletions

View file

@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/styles/common.css" />
<link rel="stylesheet" href="/styles/post.css" />
<link rel="stylesheet" href="/styles/graph.css" />
<link rel="icon" type="image/webp" href="/public/logo.webp" />
<link rel="stylesheet" href="/public/katex/katex.css" />
<script defer src="/public/katex/katex.js"></script>
@ -17,7 +18,7 @@
<script defer src="/public/d3.js"></script>
<title>Barrett Ruth</title>
</head>
<body class="graph">
<body class="graph-background">
<header>
<a
href="/"
@ -74,7 +75,9 @@
</li>
<li>
Capital accumulates according to investment \(I_t\) and
depreciation \(\bar{d}\), beginning with \(K_0\)
depreciation \(\bar{d}\), beginning with \(K_0\) (often called
the
<u>Law of Capital Motion</u>)
</li>
<li>Labor \(L_t\) is time-independent</li>
<li>
@ -87,13 +90,13 @@
the Solow Model:
</p>
<div style="display: flex; justify-content: center">
<div style="margin: 0 20px">
<div style="padding-right: 50px">
<ol>
<li>\(C_t + I_t = Y_t\)</li>
<li>\(\Delta K_{t+1} = I_t - \bar{d} K_t\)</li>
</ol>
</div>
<div>
<div style="padding-left: 50px">
<ol start="3">
<li>\(L_t = \bar{L}\)</li>
<li>\(I_t = \bar{s} Y_t\)</li>
@ -111,14 +114,105 @@
</p>
<p>
Letting \((L_t,\alpha)=(\bar{L}, \frac{1}{3})\), it follows that
\(Y_t=F(K_t,L_t)=\bar{A}K_t^{\frac{1}{3}}
\bar{L_t}^{\frac{2}{3}}\). Utilizing this simplification and its
graphical representation below, output is clearly characterized by
the cube root of capital:
\(Y_t=F(K_t,L_t)=\bar{A}K_t^{\frac{1}{3}} \bar{L}^{\frac{2}{3}}\).
Utilizing this simplification and its graphical representation
below, output is clearly characterized by the cube root of
capital:
</p>
<div class="graph">
<div id="solow-visualization"></div>
</div>
<div class="sliders">
<div style="padding-right: 20px">
<ul>
<li>
<div class="slider">
<label for="sliderA">\(A:\)</label>
<span id="outputA">1.00</span>
<input
type="range"
id="sliderA"
min="0.1"
max="2"
step="0.01"
value="1"
/>
</div>
</li>
<li>
<div class="slider">
<label for="sliderD">\(d:\)</label>
<span id="outputD">0.50</span>
<input
type="range"
id="sliderD"
min="0.01"
max="1"
step="0.01"
value="0.50"
/>
</div>
</li>
</ul>
</div>
<div style="padding-left: 20px">
<ul start="3">
<li>
<div class="slider">
<label for="sliderS">\(s:\)</label>
<span id="outputS">0.50</span>
<input
type="range"
id="sliderS"
min="0.01"
max="1"
step="0.01"
value="0.50"
/>
</div>
</li>
<li>
<div class="slider">
<label for="sliderAlpha">\(\alpha:\)</label>
<span id="outputAlpha">0.33</span>
<input
type="range"
id="sliderAlpha"
min="0.01"
max="1"
step="0.01"
value="0.33"
/>
</div>
</li>
</ul>
</div>
</div>
<p>
When investment is completely disincentivized by depreciation (in
other words, \(sY_t=\bar{d}K_t\)), the economy equilibrates at a
so-called &quot;steady-state&quot; with equilibrium
\((K_t,Y_t)=(K_t^*,Y_t^*)\).
</p>
<p>
Using this equilibrium condition, it follows that:
\[Y_t^*=\bar{A}{K_t^*}^\alpha\bar{L}^{1-\alpha} \rightarrow
\bar{d}K_t^*=\bar{s}\bar{A}{K_t^*}^\alpha\bar{L}^{1-\alpha}\]
\[\rightarrow
K^*=\bar{L}(\frac{\bar{s}\bar{A}}{\bar{d}})^\frac{1}{1-\alpha}\]
\[\rightarrow
Y^*=\bar{A}^\frac{1}{1-\alpha}(\frac{\bar{s}}{\bar{d}})^\frac{\alpha}{1-\alpha}\bar{L}\]
</p>
<p>
Thus, the equilibrium intensive form (output per worker) of both
capital and output are summarized as follows:
\[(k^*,y^*)=(\frac{K^*}{\bar{L}},\frac{Y^*}{\bar{L}})
=((\frac{\bar{s}\bar{A}}{\bar{d}})^\frac{1}{1-\alpha},
\bar{A}^\frac{1}{1-\alpha}(\frac{\bar{s}}{\bar{d}})^\frac{\alpha}{1-\alpha})\]
</p>
</div>
<div class="fold"><h3>conclusions</h3></div>
<p>hello conclusions</p>
<div class="fold"><h3>analysis</h3></div>
<p>discuss limitations</p>
<h2>romer</h2>
<h2>romer-solow</h2>
</article>
@ -126,5 +220,6 @@
</main>
<script src="/scripts/common.js"></script>
<script src="/scripts/post.js"></script>
<script src="/scripts/posts/models-of-production.js"></script>
</body>
</html>

View file

@ -0,0 +1,171 @@
function drawSolowGraph() {
const L = 150,
K_MAX = 500,
margin = { top: 20, right: 30, bottom: 20, left: 50 };
["A", "D", "S", "Alpha"].forEach((param) => {
const slider = document.getElementById(`slider${param}`);
slider.oninput = function () {
slider.previousElementSibling.innerText = this.value;
drawSolowGraph();
};
});
const A = document.getElementById("outputA").textContent,
D = document.getElementById("outputD").textContent,
S = document.getElementById("outputS").textContent,
alpha = document.getElementById("outputAlpha").textContent;
const solowOutput = (K) => A * Math.pow(K, alpha) * Math.pow(L, 1 - alpha);
const solowDepreciation = (K) => D * K;
const solowInvestment = (Y) => S * Y;
const container = document.getElementById("solow-visualization");
const width = container.clientWidth - margin.left - margin.right;
const height = container.clientHeight - margin.top - margin.bottom;
container.innerHTML = "";
const svg = d3
.select("#solow-visualization")
.append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", `translate(${margin.left}, ${margin.top})`);
const x = d3.scaleLinear().domain([0, K_MAX]).range([0, width]);
const xAxis = svg
.append("g")
.attr("transform", `translate(0, ${height})`)
.call(d3.axisBottom(x));
xAxis
.append("text")
.attr("fill", "#000")
.attr("x", width + 10)
.attr("y", -10)
.style("text-anchor", "end")
.style("font-size", "1.5em")
.text("K");
const Y_MAX = solowOutput(K_MAX) + K_MAX / 10;
const y = d3.scaleLinear().domain([0, Y_MAX]).range([height, 0]);
const yAxis = svg.append("g").call(d3.axisLeft(y));
yAxis
.append("text")
.attr("fill", "#000")
.attr("x", 0)
.attr("y", -10)
.style("text-anchor", "start")
.style("font-size", "1.5em")
.text("Y");
const outputData = Array.from({ length: K_MAX }, (_, k) => ({
K: k,
Y: solowOutput(k),
}));
svg
.append("path")
.datum(outputData)
.attr("fill", "none")
.attr("stroke", getTopicColor(urlToTopic()))
.attr("stroke-width", 2)
.attr(
"d",
d3
.line()
.x((d) => x(d.K))
.y((d) => y(d.Y)),
);
svg
.append("foreignObject")
.attr("width", "2em")
.attr("height", "2em")
.attr("x", x(K_MAX))
.attr("y", y(outputData[K_MAX - 1].Y))
.append("xhtml:body")
.style("font-size", "0.75em")
.html(`<div class="solow-visualization-y"></div>`);
katex.render("Y", document.querySelector(".solow-visualization-y"), {
throwOnError: false,
});
const depreciationData = Array.from({ length: K_MAX }, (_, k) => ({
K: k,
Y: solowDepreciation(k),
}));
svg
.append("path")
.datum(depreciationData)
.attr("fill", "none")
.attr("stroke", "red")
.attr("stroke-width", 2)
.attr(
"d",
d3
.line()
.x((d) => x(d.K))
.y((d) => y(d.Y)),
);
svg
.append("foreignObject")
.attr("width", "2em")
.attr("height", "2em")
.attr("x", x(K_MAX))
.attr("y", y(depreciationData[K_MAX - 1].Y))
.append("xhtml:body")
.style("font-size", "0.75em")
.html(`<div class="solow-visualization-d"></div>`);
katex.render("\\bar{d}K", document.querySelector(".solow-visualization-d"), {
throwOnError: false,
});
const investmentData = outputData.map((d) => ({
K: d.K,
Y: solowInvestment(d.Y),
}));
svg
.append("path")
.datum(investmentData)
.attr("fill", "none")
.attr("stroke", "purple")
.attr("stroke-width", 2)
.attr(
"d",
d3
.line()
.x((d) => x(d.K))
.y((d) => y(d.Y)),
);
svg
.append("foreignObject")
.attr("width", "1em")
.attr("height", "2em")
.attr("x", x(K_MAX))
.attr("y", y(investmentData[K_MAX - 1].Y))
.append("xhtml:body")
.style("font-size", "0.75em")
.html(`<div class="solow-visualization-i"></div>`);
katex.render("I", document.querySelector(".solow-visualization-i"), {
throwOnError: false,
});
const k_star = L * Math.pow((S * A) / D, 1 / (1 - alpha));
svg
.append("line")
.attr("x1", x(k_star))
.attr("y1", y((D * k_star) / S))
.attr("x2", x(k_star))
.attr("y2", y(0))
.attr("stroke", "black")
.attr("stroke-width", 1)
.attr("stroke-dasharray", "5,5");
}
document.addEventListener("DOMContentLoaded", function () {
drawSolowGraph();
window.onresize = drawSolowGraph;
});

70
styles/graph.css Normal file
View file

@ -0,0 +1,70 @@
.graph {
height: 50vh;
width: 100%;
display: flex;
justify-content: center;
margin: 50px 0;
}
.graph div {
height: 100%;
width: 60%;
}
.slider {
display: flex;
align-items: center;
justify-content: space-between;
}
.slider label {
margin-right: 10px;
}
.slider input {
margin-left: 20px;
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 2px;
background: black;
cursor: pointer;
outline: none;
transform: translateY(-50%);
width: 150px;
}
.slider input::-webkit-slider-thumb {
-webkit-appearance: none;
width: 2px;
height: 15px;
background: black;
cursor: col-resize;
position: relative;
}
.slider input::-moz-range-thumb {
width: 2px;
height: 15px;
background: black;
cursor: col-resize;
position: relative;
}
.slider input::-webkit-slider-runnable-track,
.slider input::-moz-range-track {
width: 100%;
height: 2px;
background: black;
border: none;
}
.sliders {
display: flex;
justify-content: center;
}
ul {
list-style: none;
margin: 0;
}