Skip to content

Commit 0ad4aeb

Browse files
Smit-createmmcky
andauthored
Remove unused imports (#142)
* Remove unused imports * remove unwanted lines * fix errors --------- Co-authored-by: mmcky <[email protected]>
1 parent 84c7285 commit 0ad4aeb

22 files changed

+316
-364
lines changed

lectures/BCG_complete_mkts.md

+11-13
Original file line numberDiff line numberDiff line change
@@ -802,44 +802,44 @@ It consists of 4 functions that do the following things:
802802
- First, create a grid for capital.
803803
- Then for each value of capital stock in the grid, compute the left side of the planner's
804804
first-order necessary condition for $k$, that is,
805-
805+
806806
$$
807807
\beta \alpha A K^{\alpha -1} \int \left( \frac{w_1(\epsilon) + A K^\alpha e^\epsilon}{w_0 - K } \right)^{-\gamma} e^\epsilon g(\epsilon) d \epsilon - 1 =0
808808
$$
809-
809+
810810
- Find $k$ that solves this equation.
811811
* `q` computes Arrow security prices as a function of the productivity shock $\epsilon$ and capital $K$:
812-
812+
813813
$$
814814
q(\epsilon;K) = \beta \left( \frac{u'\left( w_1(\epsilon) + A K^\alpha e^\epsilon\right)} {u'(w_0 - K )} \right)
815815
$$
816-
816+
817817
* `V` solves for the firm value given capital $k$:
818-
818+
819819
$$
820820
V = - k + \int A k^\alpha e^\epsilon q(\epsilon; K) d \epsilon
821821
$$
822-
822+
823823
* `opt_c` computes optimal consumptions $c^i_0$, and $c^i(\epsilon)$:
824824
- The function first computes weight $\eta$ using the
825825
budget constraint for agent 1:
826-
826+
827827
$$
828828
w_0^1 + \theta_0^1 V + \int w_1^1(\epsilon) q(\epsilon) d \epsilon
829829
= c_0^1 + \int c_1^1(\epsilon) q(\epsilon) d \epsilon
830830
= \eta \left( C_0 + \int C_1(\epsilon) q(\epsilon) d \epsilon \right)
831831
$$
832832
where
833-
833+
834834
$$
835835
\begin{aligned}
836836
C_0 & = w_0 - K \cr
837837
C_1(\epsilon) & = w_1(\epsilon) + A K^\alpha e^\epsilon \cr
838838
\end{aligned}
839839
$$
840-
840+
841841
- It computes consumption for each agent as
842-
842+
843843
$$
844844
\begin{aligned}
845845
c_0^1 & = \eta C_0 \cr
@@ -848,7 +848,7 @@ It consists of 4 functions that do the following things:
848848
c_1^2 (\epsilon) & = (1 - \eta) C_1(\epsilon)
849849
\end{aligned}
850850
$$
851-
851+
852852

853853
The list of parameters includes:
854854

@@ -868,7 +868,6 @@ The list of parameters includes:
868868
Gauss-Hermite quadrature: default value is 10
869869

870870
```{code-cell} ipython
871-
import pandas as pd
872871
import numpy as np
873872
import matplotlib.pyplot as plt
874873
from scipy.stats import norm
@@ -1205,4 +1204,3 @@ Image(fig.to_image(format="png"))
12051204
# fig.show() will provide interactive plot when running
12061205
# notebook locally
12071206
```
1208-

lectures/BCG_incomplete_mkts.md

+20-24
Original file line numberDiff line numberDiff line change
@@ -580,47 +580,47 @@ Here goes:
580580
$|\theta^1_h - \theta^1_l|$ is large:
581581
* Compute agent 1’s valuation of the equity claim with a
582582
fixed-point iteration:
583-
583+
584584
$q_1 = \beta \int \frac{u^\prime(c^1_1(\epsilon))}{u^\prime(c^1_0)} d^e(k,b;\epsilon) g(\epsilon) \ d\epsilon$
585-
585+
586586
where
587-
587+
588588
$c^1_1(\epsilon) = w^1_1(\epsilon) + \theta^1 d^e(k,b;\epsilon)$
589-
589+
590590
and
591-
591+
592592
$c^1_0 = w^1_0 + \theta^1_0V - q_1\theta^1$
593593
* Compute agent 2’s valuation of the bond claim with a
594594
fixed-point iteration:
595-
595+
596596
$p = \beta \int \frac{u^\prime(c^2_1(\epsilon))}{u^\prime(c^2_0)} d^b(k,b;\epsilon) g(\epsilon) \ d\epsilon$
597-
597+
598598
where
599-
599+
600600
$c^2_1(\epsilon) = w^2_1(\epsilon) + \theta^2 d^e(k,b;\epsilon) + b$
601-
601+
602602
and
603-
603+
604604
$c^2_0 = w^2_0 + \theta^2_0 V - q_1 \theta^2 - pb$
605605
* Compute agent 2’s valuation of the equity claim with a
606606
fixed-point iteration:
607-
607+
608608
$q_2 = \beta \int \frac{u^\prime(c^2_1(\epsilon))}{u^\prime(c^2_0)} d^e(k,b;\epsilon) g(\epsilon) \ d\epsilon$
609-
609+
610610
where
611-
611+
612612
$c^2_1(\epsilon) = w^2_1(\epsilon) + \theta^2 d^e(k,b;\epsilon) + b$
613-
613+
614614
and
615-
615+
616616
$c^2_0 = w^2_0 + \theta^2_0 V - q_2 \theta^2 - pb$
617617
* If $q_1 > q_2$, Set $\theta_l = \theta^1$;
618618
otherwise, set $\theta_h = \theta^1$.
619619
* Repeat steps 6Aa through 6Ad until
620620
$|\theta^1_h - \theta^1_l|$ is small.
621621
1. Set bond price as $p$ and equity price as $q = \max(q_1,q_2)$.
622622
1. Compute optimal choices of consumption:
623-
623+
624624
$$
625625
\begin{aligned}
626626
c^1_0 &= w^1_0 + \theta^1_0V - q\theta^1 \\
@@ -629,29 +629,29 @@ Here goes:
629629
c^2_1(\epsilon) &= w^2_1(\epsilon) + \theta^2 d^e(k,b;\epsilon) + b
630630
\end{aligned}
631631
$$
632-
632+
633633
1. (Here we confess to abusing notation again, but now in a different
634634
way. In step 7, we interpret frozen $c^i$s as Big
635635
$C^i$. We do this to solve the firm’s problem.) Fixing the
636636
values of $c^i_0$ and $c^i_1(\epsilon)$, compute optimal
637637
choices of capital $k$ and debt level $b$ using the
638638
firm’s first order necessary conditions.
639639
1. Compute deviations from the firm’s FONC for capital $k$ as:
640-
640+
641641
$kfoc = \beta \alpha A k^{\alpha - 1} \left( \int \frac{u^\prime(c^2_1(\epsilon))}{u^\prime(c^2_0)} e^\epsilon g(\epsilon) \ d\epsilon \right) - 1$
642642
- If $kfoc > 0$, Set $k_l = k$; otherwise, set
643643
$k_h = k$.
644644
- Repeat steps 4 through 7A until $|k_h-k_l|$ is small.
645645
1. Compute deviations from the firm’s FONC for debt level $b$ as:
646-
646+
647647
$bfoc = \beta \left[ \int_{\epsilon^*}^\infty \left( \frac{u^\prime(c^1_1(\epsilon))}{u^\prime(c^1_0)} \right) g(\epsilon) \ d\epsilon - \int_{\epsilon^*}^\infty \left( \frac{u^\prime(c^2_1(\epsilon))}{u^\prime(c^2_0)} \right) g(\epsilon) \ d\epsilon \right]$
648648
- If $bfoc > 0$, Set $b_h = b$; otherwise, set
649649
$b_l = b$.
650650
- Repeat steps 3 through 7B until $|b_h-b_l|$ is small.
651651
1. Given prices $q$ and $p$ from step 6, and the firm
652652
choices of $k$ and $b$ from step 7, compute the synthetic
653653
firm value:
654-
654+
655655
$V_x = -k + q + pb$
656656
- If $V_x > V$, then set $V_l = V$; otherwise, set
657657
$V_h = V$.
@@ -704,12 +704,9 @@ Parameters include:
704704
- bound: Bound for truncated normal distribution. Default value is 3.
705705

706706
```{code-cell} ipython
707-
import pandas as pd
708707
import numpy as np
709-
from scipy.stats import norm
710708
from scipy.stats import truncnorm
711709
from scipy.integrate import quad
712-
from scipy.optimize import bisect
713710
from numba import njit
714711
from interpolation import interp
715712
```
@@ -1946,4 +1943,3 @@ Agents of type 2 value bonds more highly (they want more hedging).
19461943

19471944
Taken together with our earlier plot of equity holdings, these graphs confirm our earlier conjecture that while both type
19481945
of agents hold equities, only agents of type 2 holds bonds.
1949-

lectures/additive_functionals.md

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ Let's start with some imports:
7575

7676
```{code-cell} ipython3
7777
import numpy as np
78-
import scipy as sp
7978
import scipy.linalg as la
8079
import quantecon as qe
8180
import matplotlib.pyplot as plt

lectures/amss.md

-3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ from interpolation.splines import eval_linear, UCGrid, nodes
4646
from quantecon import optimize, MarkovChain
4747
from numba import njit, prange, float64
4848
from numba.experimental import jitclass
49-
50-
%matplotlib inline
5149
```
5250

5351
In {doc}`an earlier lecture <opt_tax_recur>`, we described a model of
@@ -1033,4 +1031,3 @@ problem, there exists another realization $\tilde s^t$ with
10331031
the same history up until the previous period, i.e., $\tilde s^{t-1}=
10341032
s^{t-1}$, but where the multiplier on constraint {eq}`AMSS_46` takes a positive value, so
10351033
$\gamma_t(\tilde s^t)>0$.
1036-

lectures/arellano.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ Let's start with some imports:
7878
import matplotlib.pyplot as plt
7979
import numpy as np
8080
import quantecon as qe
81-
import random
8281
83-
from numba import njit, int64, float64, prange
84-
from numba.experimental import jitclass
82+
from numba import njit, prange
8583
%matplotlib inline
8684
```
8785

0 commit comments

Comments
 (0)