From d3f3452fb4c0889e2af17c080d2cdc3cfe64a315 Mon Sep 17 00:00:00 2001 From: JingkunZhao Date: Mon, 22 Jul 2024 13:21:58 +1000 Subject: [PATCH 01/17] [geom_series] Add an exercise --- lectures/geom_series.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 7a7d4c9d..09412785 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -856,12 +856,21 @@ so $\frac{\partial p_0}{\partial r}$ will always be negative. Similarly, $\frac{\partial p_0}{\partial g}>0$ as long as $r>g$, $r>0$ and $g>0$ and $x_0$ is positive, so $\frac{\partial p_0}{\partial g}$ will always be positive. -## Back to the Keynesian multiplier +## Exercise -We will now go back to the case of the Keynesian multiplier and plot the +```{exercise} +:label: solow_ex1 + +Now go back to the case of the Keynesian multiplier and plot the time path of $y_t$, given that consumption is a constant fraction of national income, and investment is fixed. +``` + +```{solution-start} solow_ex1 +:class: dropdown +``` + ```{code-cell} ipython3 --- mystnb: @@ -959,3 +968,6 @@ plt.show() Notice here, whether government spending increases from 0.3 to 0.4 or investment increases from 0.3 to 0.4, the shifts in the graphs are identical. + +```{solution-end} +``` \ No newline at end of file From 3dd66486e0cc38582a783728724a0c7e3a0087d6 Mon Sep 17 00:00:00 2001 From: JingkunZhao Date: Mon, 22 Jul 2024 14:25:38 +1000 Subject: [PATCH 02/17] Update the code --- lectures/geom_series.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 09412785..1f202ee5 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -860,11 +860,12 @@ will always be positive. ```{exercise} :label: solow_ex1 - +``` Now go back to the case of the Keynesian multiplier and plot the time path of $y_t$, given that consumption is a constant fraction of national income, and investment is fixed. +```{exercise-end} ``` ```{solution-start} solow_ex1 From 7de56eb1eff02d85998bbe4679e8b30512837dd7 Mon Sep 17 00:00:00 2001 From: JingkunZhao Date: Mon, 22 Jul 2024 14:37:04 +1000 Subject: [PATCH 03/17] Update geom_series.md --- lectures/geom_series.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 1f202ee5..c6a5e3a3 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -858,8 +858,8 @@ will always be positive. ## Exercise -```{exercise} -:label: solow_ex1 +```{exercise-start} +:label: geom_ex1 ``` Now go back to the case of the Keynesian multiplier and plot the time path of $y_t$, given that consumption is a constant fraction @@ -868,7 +868,7 @@ of national income, and investment is fixed. ```{exercise-end} ``` -```{solution-start} solow_ex1 +```{solution-start} geom_ex1 :class: dropdown ``` From f4343251fe2f8da7ba907314384510ef381c9881 Mon Sep 17 00:00:00 2001 From: JingkunZhao Date: Mon, 22 Jul 2024 16:33:40 +1000 Subject: [PATCH 04/17] Update geom_series.md --- lectures/geom_series.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index c6a5e3a3..6165a87b 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -856,7 +856,7 @@ so $\frac{\partial p_0}{\partial r}$ will always be negative. Similarly, $\frac{\partial p_0}{\partial g}>0$ as long as $r>g$, $r>0$ and $g>0$ and $x_0$ is positive, so $\frac{\partial p_0}{\partial g}$ will always be positive. -## Exercise +## Exercises ```{exercise-start} :label: geom_ex1 From e121412e88b6d7f7c09be687f6bcfe2db7fb9705 Mon Sep 17 00:00:00 2001 From: shlff Date: Tue, 23 Jul 2024 17:15:57 +1000 Subject: [PATCH 05/17] split_exercises --- lectures/geom_series.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 1bbd4c14..cfc2b91a 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -900,10 +900,23 @@ plt.show() In this model, income grows over time, until it gradually converges to the infinite geometric series sum of income. +```{solution-end} +``` + +```{exercise-start} +:label: geom_ex2 +``` We now examine what will happen if we vary the so-called **marginal propensity to consume**, i.e., the fraction of income that is consumed +```{exercise-end} +``` + +```{solution-start} geom_ex2 +:class: dropdown +``` + ```{code-cell} ipython3 --- mystnb: @@ -927,7 +940,20 @@ plt.show() Increasing the marginal propensity to consume $b$ increases the path of output over time. +```{solution-end} +``` + + +```{exercise-start} +:label: geom_ex3 +``` Now we will compare the effects on output of increases in investment and government spending. +```{exercise-end} +``` + +```{solution-start} geom_ex3 +:class: dropdown +``` ```{code-cell} ipython3 --- From 7e791a7da78092571a3af5dd6ced751c908d07fa Mon Sep 17 00:00:00 2001 From: JingkunZhao Date: Tue, 23 Jul 2024 21:49:22 +1000 Subject: [PATCH 06/17] Update geom_series.md --- lectures/geom_series.md | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index cfc2b91a..b71188c1 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -854,9 +854,19 @@ will always be positive. ```{exercise-start} :label: geom_ex1 ``` -Now go back to the case of the Keynesian multiplier and plot the -time path of $y_t$, given that consumption is a constant fraction -of national income, and investment is fixed. +In this exercise, we go back to the case of the Keynesian multiplier. + +Now try to plot the time path of $y_t$, given that consumption is a constant fraction of national income, and investment is fixed. + +Given intial values: + +```{code-cell} ipython3 +i_0 = 0.3 +g_0 = 0.3 +b = 2/3 +y_init = 0 +T = 100 +``` ```{exercise-end} ``` @@ -906,9 +916,17 @@ the infinite geometric series sum of income. ```{exercise-start} :label: geom_ex2 ``` -We now examine what will +Continuing to explore the model, we now examine what will happen if we vary the so-called **marginal propensity to consume**, -i.e., the fraction of income that is consumed +i.e., the fraction of income that is consumed. + +Here, b can take four different numbers. + +Given: + +```{code-cell} ipython3 +bs = (1/3, 2/3, 5/6, 0.9) +``` ```{exercise-end} ``` @@ -947,7 +965,17 @@ path of output over time. ```{exercise-start} :label: geom_ex3 ``` -Now we will compare the effects on output of increases in investment and government spending. + +Use the same initial values: + +```{code-cell} ipython3 +b = 2/3 +y_init = 0 +T = 100 +``` + +Compare the effects on $y$ of increasing investment $i$ from $0.3$ to $0.4$ and government spending $g$ from $0.3$ to $0.4$. + ```{exercise-end} ``` From 07ef18f1402e418ee8eebc6ef761749e725c48e1 Mon Sep 17 00:00:00 2001 From: shlff Date: Wed, 24 Jul 2024 13:03:07 +1000 Subject: [PATCH 07/17] shu_edits --- lectures/geom_series.md | 44 ++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index b71188c1..4e4fb44a 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -854,11 +854,15 @@ will always be positive. ```{exercise-start} :label: geom_ex1 ``` -In this exercise, we go back to the case of the Keynesian multiplier. +Consider a dynamic Keynesian multiplier model -Now try to plot the time path of $y_t$, given that consumption is a constant fraction of national income, and investment is fixed. +$$ + y_t = c_t + i_t + g_t \ \ \textrm { and } \ \ c_t = b y_{t-1}. +$$ + +Assume that $i_t=i_0$ and $g_t=g_0$ for all $t \geq 0$. -Given intial values: +Plot the time path of $y_t$ with the following initial values: ```{code-cell} ipython3 i_0 = 0.3 @@ -874,7 +878,6 @@ T = 100 ```{solution-start} geom_ex1 :class: dropdown ``` - ```{code-cell} ipython3 --- mystnb: @@ -890,14 +893,6 @@ def calculate_y(i, b, g, T, y_init): y[t] = b * y[t-1] + i + g return y -# Initial values -i_0 = 0.3 -g_0 = 0.3 -# 2/3 of income goes towards consumption -b = 2/3 -y_init = 0 -T = 100 - fig, ax = plt.subplots() ax.set_xlabel('$t$') ax.set_ylabel('$y_t$') @@ -916,18 +911,17 @@ the infinite geometric series sum of income. ```{exercise-start} :label: geom_ex2 ``` -Continuing to explore the model, we now examine what will -happen if we vary the so-called **marginal propensity to consume**, -i.e., the fraction of income that is consumed. -Here, b can take four different numbers. +Continue from [exercise 1](#geom_ex1). -Given: +Plot the time paths of $y_t$ with the same initial values but varying $b$ values: ```{code-cell} ipython3 bs = (1/3, 2/3, 5/6, 0.9) ``` +Interpret the economic effect on $y_t$ of increasing $b$. + ```{exercise-end} ``` @@ -942,7 +936,6 @@ mystnb: caption: "Changing consumption as a fraction of income" name: changing_consumption_as_fraction_of_income --- -bs = (1/3, 2/3, 5/6, 0.9) fig,ax = plt.subplots() ax.set_ylabel('$y_t$') @@ -965,17 +958,19 @@ path of output over time. ```{exercise-start} :label: geom_ex3 ``` - -Use the same initial values: +Continue from [exercise 1](#geom_ex1) with the following values ```{code-cell} ipython3 -b = 2/3 -y_init = 0 -T = 100 +values = [0.3, 0.4] ``` -Compare the effects on $y$ of increasing investment $i$ from $0.3$ to $0.4$ and government spending $g$ from $0.3$ to $0.4$. +First, plot the time paths of $y_t$ using the same initial valuesm but with $i$ +taking the values mentioned above. +Next, plot the time paths of $y_t$ with the same initial values but let $g$ take +the values abovementioned. + +Are the effects on $y_t$ of increasing $i$ and $g$ in these plots the same? ```{exercise-end} ``` @@ -994,7 +989,6 @@ fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(6, 10)) fig.subplots_adjust(hspace=0.3) x = np.arange(0, T+1) -values = [0.3, 0.4] for i in values: y = calculate_y(i, b, g_0, T, y_init) From 44da5e26541751b30b97877e4a62e2222def152b Mon Sep 17 00:00:00 2001 From: shlff Date: Wed, 24 Jul 2024 13:22:26 +1000 Subject: [PATCH 08/17] fix --- lectures/geom_series.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 4e4fb44a..a21614a4 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -912,7 +912,7 @@ the infinite geometric series sum of income. :label: geom_ex2 ``` -Continue from [exercise 1](#geom_ex1). +Continue from {ref}`geom_ex1`. Plot the time paths of $y_t$ with the same initial values but varying $b$ values: @@ -958,7 +958,7 @@ path of output over time. ```{exercise-start} :label: geom_ex3 ``` -Continue from [exercise 1](#geom_ex1) with the following values +Continue from {ref}`geom_ex1` with the following values ```{code-cell} ipython3 values = [0.3, 0.4] From 9871f29492f958e77a5c8a635ad702e29648ba34 Mon Sep 17 00:00:00 2001 From: JingkunZhao <155940781+SylviaZhaooo@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:05:06 +1000 Subject: [PATCH 09/17] Revise context.md Co-authored-by: Matt McKay --- lectures/geom_series.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index a21614a4..0da37b79 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -912,7 +912,7 @@ the infinite geometric series sum of income. :label: geom_ex2 ``` -Continue from {ref}`geom_ex1`. +As an extension to {ref}`geom_ex1`. Plot the time paths of $y_t$ with the same initial values but varying $b$ values: From 68b6cd56128ca8b2ff602a77e4a828d255571f5e Mon Sep 17 00:00:00 2001 From: JingkunZhao Date: Wed, 24 Jul 2024 17:40:45 +1000 Subject: [PATCH 10/17] Modify context --- lectures/geom_series.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index a21614a4..2d70d02c 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -740,7 +740,7 @@ the value of a lease of duration $T$ approaches the value of a perpetual lease. Now we consider two different views of what happens as $r$ and -$g$ covary +$g$ covary. ```{code-cell} ipython3 --- @@ -964,7 +964,7 @@ Continue from {ref}`geom_ex1` with the following values values = [0.3, 0.4] ``` -First, plot the time paths of $y_t$ using the same initial valuesm but with $i$ +First, plot the time paths of $y_t$ using the same initial values but with $i$ taking the values mentioned above. Next, plot the time paths of $y_t$ with the same initial values but let $g$ take From 6a051d673eebd4061e512ce55787cc645f026212 Mon Sep 17 00:00:00 2001 From: shlff Date: Wed, 24 Jul 2024 17:48:34 +1000 Subject: [PATCH 11/17] edits --- lectures/geom_series.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 0da37b79..ea7feef9 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -882,7 +882,7 @@ T = 100 --- mystnb: figure: - caption: "Path of aggregate output tver time" + caption: "Path of aggregate output over time" name: path_of_aggregate_output_over_time --- # Function that calculates a path of y From fc61b03fb0a71b351fe6623d5abc9a7fb1b608f1 Mon Sep 17 00:00:00 2001 From: Shu Hu Date: Fri, 11 Oct 2024 13:22:30 +1100 Subject: [PATCH 12/17] Update lectures/geom_series.md Co-authored-by: Matt McKay --- lectures/geom_series.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 62fb624e..f646d2c3 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -968,7 +968,7 @@ values = [0.3, 0.4] ``` First, plot the time paths of $y_t$ using the same initial values but with $i$ -taking the values mentioned above. +taking the values above. Next, plot the time paths of $y_t$ with the same initial values but let $g$ take the values abovementioned. From 84303917b482fcb30c8b8f40d9118d793e25debe Mon Sep 17 00:00:00 2001 From: JingkunZhao Date: Fri, 11 Oct 2024 15:37:51 +1100 Subject: [PATCH 13/17] Clarify mentioned values --- lectures/geom_series.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index e1ce89aa..46d61718 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -968,7 +968,7 @@ First, plot the time paths of $y_t$ using the same initial values but with $i$ taking the values mentioned above. Next, plot the time paths of $y_t$ with the same initial values but let $g$ take -the values abovementioned. +the values mentioned above. Are the effects on $y_t$ of increasing $i$ and $g$ in these plots the same? ```{exercise-end} From 2bc17a4c2bd43c92532ec585af62989a115e9752 Mon Sep 17 00:00:00 2001 From: JingkunZhao <155940781+SylviaZhaooo@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:55:58 +1100 Subject: [PATCH 14/17] Update lectures/geom_series.md Co-authored-by: Shu Hu --- lectures/geom_series.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 8538f562..112e48d2 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -961,7 +961,7 @@ path of output over time. ```{exercise-start} :label: geom_ex3 ``` -Continue from {ref}`geom_ex1` with the following values +Continue from {ref}`geom_ex1`. ```{code-cell} ipython3 values = [0.3, 0.4] From 95b50241f2a2e6152e81af4ba1392b0df960cc30 Mon Sep 17 00:00:00 2001 From: JingkunZhao <155940781+SylviaZhaooo@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:57:03 +1100 Subject: [PATCH 15/17] Update lectures/geom_series.md Co-authored-by: Shu Hu --- lectures/geom_series.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 112e48d2..41ce4707 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -962,7 +962,8 @@ path of output over time. :label: geom_ex3 ``` Continue from {ref}`geom_ex1`. - +First, plot the time paths of $y_t$ using the same initial values but with $i$ +taking the values below. ```{code-cell} ipython3 values = [0.3, 0.4] ``` From 0244418756f9db6048fd5246d5d5672c9498039e Mon Sep 17 00:00:00 2001 From: JingkunZhao <155940781+SylviaZhaooo@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:57:15 +1100 Subject: [PATCH 16/17] Update lectures/geom_series.md Co-authored-by: Shu Hu --- lectures/geom_series.md | 1 - 1 file changed, 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 41ce4707..43088eaf 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -968,7 +968,6 @@ taking the values below. values = [0.3, 0.4] ``` -First, plot the time paths of $y_t$ using the same initial values but with $i$ taking the values above. Next, plot the time paths of $y_t$ with the same initial values but let $g$ take From 06fd37326bbd97a5fbeb9645fb83c0e18b4df714 Mon Sep 17 00:00:00 2001 From: JingkunZhao <155940781+SylviaZhaooo@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:57:38 +1100 Subject: [PATCH 17/17] Update lectures/geom_series.md Co-authored-by: Shu Hu --- lectures/geom_series.md | 1 - 1 file changed, 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 43088eaf..fe07db53 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -968,7 +968,6 @@ taking the values below. values = [0.3, 0.4] ``` -taking the values above. Next, plot the time paths of $y_t$ with the same initial values but let $g$ take the values mentioned above.