using Distributions, Plots, LaTeXStrings, LinearAlgebra, Statistics, RandomAssignment 1
Instructions
- Edit the above cell to include your name and student number.
- Submit just this
ipynbto Canvas. Do not rename, it associates your student number with the submission automatically.
Question 1
Create the following variables:
D: A floating point number with the value 10,000r: A floating point number with the value 0.025 (i.e., 2.5% net interest rate)
Compute the present discounted value of a payment (D) made in t years, assuming an interest rate of r = 2.5%. Save this value to a new variable called PDV and print your output.
Hint: The formula is
\[ \text{PDV}(D, t) = \frac{D}{(1 + r)^t} \]
For \(t = 10\), calculate this PDV
# add code hereQuestion 2
Now assume that you have an asset the pays \(D\) every year from \(t = 0,\ldots T\). Write code which will price this as the PDV of all payoffs,
\[ P_T(D) = \sum_{t=0}^{T}\left(\frac{1}{1+r} \right)^t D \]
Part (a)
Derive the analytic solution for the limit of \(P_{\infty}(D) \equiv \lim_{T\to \infty} P_T(D)\)
(doubleclick here to modify. Add other cells as required. No need to show all of your steps)
\[ P_{\infty}(D) = ? \]
Part (b)
Plot the price as the horizon increases
- On the x-axis plot \(T = 1, \ldots 30\)
- On the y-axis plot \(P_T(D)\) at that horizon
- Plot a horizontal line at the asymptotic \(P_{\infty}\) you calculated
T_max = 30
T = 1:T_max
r = 0.025
D = 10_000
# add code here10000
Question 3
Now instead of having constant dividends, assume that dividends follow the process
\[\log D_{t+1} = \log D_t + \sigma w_{t+1} \]
Where
- \(w_{t+1} \sim N(0,1)\) are IID unit random normals
- \(D_0 = 1.0\)
- \(\sigma = 0.001\)
Part (a)
Write code to simulate a sequence of dividends with the process and initial condition for \(t = 0, \ldots T = 30\).
T = 30
D_0 = 1.0
sigma = 0.001
# reminder, can draw from N(0,1) with randn()
# add code here for simulation0.001
Part (b)
Plot three simulated sequences of dividends (i.e, the \(D_{t}\) for \(t = 0, \ldots 30\)) on the same graph with the shared x-axis.
# add code here for plotting using your functions aboveQuestion 4
Using the simulated sequences of dividends from Question 3, calculate the \(P_T\) assuming perfect foresight (i.e., they were able to know the sequence of \(w_{t+1}\) even for \(t \geq 0\)). The formula remains the same, except where \(\{D_0, \ldots D_T\}\) is an argument which allows for time-dependent dividends
\[ P_T(\{D_t\}_{t=0}^T) = \sum_{t=0}^{T}\left(\frac{1}{1+r} \right)^t D_t \]
All from the same \(D_0 = 1.0\) initial condition calculate the \(P_T(\{D^n_t\}_{t=0}^T)\) for \(n = 1, \ldots N\) simulated sequences of dividends (i.e. see Question 3)
Part (a)
Calculate the \(P_T\) above given a dividend sequence
T = 30
D_0 = 1.0
sigma = 0.001
# add code here for calculating P_T and check results0.001
Part (b)
Plot a histogram of the prices for \(N = 100\) simulations and compare to the deterministic case, which is nested if \(\sigma = 0\). (Hint: see our lectures or Julia By Example for more on histograms)
N = 100
# add code here for plotting using your functions above
# hint: use the `histogram` function100