jupytext | kernelspec | orphan | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
true |
See "Check Your Understanding" from {doc}Applied Linear Algebra <../scientific/applied_linalg>
, {doc}Randomness <../scientific/randomness>
, and {doc}Optimization <../scientific/optimization>
Alice is a stock broker who owns two types of assets: A and B. She owns 100
units of asset A and 50 units of asset B. The current interest rate is 5%.
Each of the A assets have a remaining duration of 6 years and pay
Alice would like to retire if she can sell her assets for more than $1 million. Use vector addition, scalar multiplication, and dot products to determine whether she can retire.
r = 0.05
# your code here
As in {doc}Applied Linear Algebra <../scientific/applied_linalg>
:
Consider an economy where in any given year,
Define the vector $x_0 = \begin{bmatrix} 600,000 & 200,000 \end{bmatrix}$ as the number of
employed and unemployed workers (respectively) at time
Adapting the code from the lecture notes, plot the unemployment rate over time in this economy for
# your code here
Continue the simulation for 1000 periods to find a long-run unemployment rate.
# your code here
Adapt the lecture notes code to use the matrix you set up for the evolution equation, and find the (left) eigenvector associated with the unit eigenvalue. Rescale this as required (i.e. it is only unique up to a scaling parameter) to find the stationary unemployment rate. Compare to the simulated one.
# your code here
Wikipedia and other credible statistics sources tell us that the mean and variance of the Uniform(0, 1) distribution are (1/2, 1/12) respectively.
How could we check whether the numpy random numbers approximate these
values? (hint: some functions in {doc}Introduction to Numpy <../scientific/numpy_arrays>
and {doc}Randomness <../scientific/randomness>
might be useful)
# your code here
Assume you have been given the opportunity to choose between one of three financial assets.
You will be given the asset for free, allowed to hold it indefinitely, and will keep all payoffs.
Also assume the assets' payoffs are distributed as follows (the notations are the same as in "Continuous Distributions" subsection of {doc}Randomness <../scientific/randomness>
):
- Normal with
$\mu = 10, \sigma = 5$ - Gamma with
$k = 5.3, \theta = 2$ - Gamma with
$k = 5, \theta = 2$
Use scipy.stats
to answer the following questions:
- Which asset has the highest average returns?
- Which asset has the highest median returns?
- Which asset has the lowest coefficient of variation, i.e., standard deviation divided by mean?
- Which asset would you choose? Why? (There is not a single right answer here. Just be creative and express your preferences.)
You can find the official documentation of scipy.stats
here
# your code here
Take the example with preferences over bananas (B) and apples (A) in {doc}Optimization <../scientific/optimization>
The consumer solves the following problem:
Fix W
between 1
and 3
and then plot the optimal ratio of B to A.
p_A = 2
alpha = 0.33
# Your code here
Do the same graph for
# Your code here
Normalize the price of potato chips to be
Using a similar approach as seen in the apples/bananas example above, solve for the optimal basket of potato chips and chocolate bars.
Hint: When analyzing bliss points, as in {doc}Optimization <../scientific/optimization>
, we need to consider that they may not reach the bliss point. Remember that in the algebra for our problems, we were only able to substitute using the budget constraint if the budget constraint is binding under optimal consumption bundles.
Fix the price for chocolate bars to be
Find the optimal quantity of
W = 20
q = 10
# Your code here
Now, do the same thing for a grid of
# Your code here
Let's revisit the unemployment example from the {doc}Applied Linear Algebra <../scientific/applied_linalg>
.
We'll repeat necessary details here.
Consider an economy where in any given year,
Initially, 90% of the 1,000,000 workers are employed.
Suppose that the average employed worker earns 10 dollars while an unemployed worker earns 1 dollar per period.
With this, do the following:
- Represent this problem as a Markov chain by defining the three components defined above
# define components here
- Construct an instance of the QuantEcon MarkovChain using the objects defined in part 1.
# construct the Markov chain
- Simulate the Markov chain 5 times for 50 time periods starting from an employment state and plot the chains over time (see helper code below).
n = 50
M = 5
# uncomment the lines below and fill in the blanks
# sim = XXXXX.simulate(n, init = XXXXX, num_reps = M)
# fig, ax = plt.subplots(figsize=(10, 8))
# ax.plot(range(n), sim.T, alpha=0.4)
- Using the approach above, simulate the Markov chain
M=20
times for 50 time periods. Instead of starting from an employment state, start off theM
in proportion to the initial condition above (i.e. 90% of them in an employment state and 10% in an unemployment state). (Hint: you can pass a list to theinit
parameter in thesimulate
function.)
With this simulation, plot the average proportion of M
agents in the employment state (i.e. it should start at 0.90 from the initial condition).
# define components here
- Calculate the steady-state of the Markov chain and compare results from this simulation to the steady-state unemployment rate for the Markov chain (on a similar graph).
# define components here
- Determine the average long-run payment for a worker in this setting. (Hint: Think about the stationary distribution)
# define components here
# construct Markov chain
# Long-run average payment