p363 #11
The price of one share of stock in the Pilsdorff Beer Company (see Exercise 8.2.12) is given by \(Y_n\) on the \(n\)th day of the year. Finn observes that the differences \(X_n = Y_{n+1} - Y_n\) appear to be independent random variables with a common distribution having mean \(\mu = 0\) and variance \(\sigma^2 = 1/4\). If \(Y_1 = 100\), estimate the probability that \(Y_{365}\) is:
- \(\geq 100\)
The probability that the share price will be \(\geq 100\) after one year is 50%.
x_1 <- 100 # Initial share price
x_2 <- 100 # Target share price
n <- 365-1 # Number of days
mu <- 0
variance <- 1/4
sd <- sqrt(variance)
# Calculate z-score to standardize the change in share price
z <- (x_2-x_1)/(sd*sqrt(n))
# Set probability density function
f <- function(x) {1/sqrt(2*pi)*exp(-x^2/2)}
# Find the area under the normal curve from z to infinity
i <- integrate(f, lower=z, upper=Inf)
# Probability that change in share price is >=0
i$value
## [1] 0.5
- \(\geq 110\)
The probability that the share price will be \(\geq 110\) after one year is approximately 14.8%.
# Set variables
x_1 <- 100 # Initial share price
x_2 <- 110 # Target share price
n <- 365-1 # Number of days
mu <- 0
variance <- 1/4
sd <- sqrt(variance)
# Calculate z-score to standardize the change in share price
z <- (x_2-x_1)/(sd*sqrt(n))
# Set probability density function
f <- function(x) {1/sqrt(2*pi)*exp(-x^2/2)}
# Find the area under the normal curve from z to infinity
i <- integrate(f, lower=z, upper=Inf)
# Probability that change in share price is >=10
i$value
## [1] 0.1472537
- \(\geq 120\)
The probability that the share price will be \(\geq 120\) after one year is approximately 1.8%.
# Set variables
x_1 <- 100 # Initial share price
x_2 <- 120 # Target share price
n <- 365-1 # Number of days
mu <- 0
variance <- 1/4
sd <- sqrt(variance)
# Calculate z-score to standardize the change in share price
z <- (x_2-x_1)/(sd*sqrt(n))
# Set probability density function
f <- function(x) {1/sqrt(2*pi)*exp(-x^2/2)}
# Find the area under the normal curve from z to infinity
i <- integrate(f, lower=z, upper=Inf)
# Probability that change in share price is >=20
i$value
## [1] 0.01801584
We could also use the pnorm
function to calculate the same probabilities.
Question 2
Calculate the expected value and variance of the binomial distribution using the moment-generating function.
The general formula for a moment-generating function \(g(t)\) is \(\sum_{j=1}^\infty \ e^{txj} \ p(x_j)\), where \(p(x_j)\) is a probability mass function. The probability mass function of a binomial distribution is \({n \choose k} p^k (1-p)^{n-k}\).
Plugging this into the moment generation function, we get:
\[ \begin{align} g(t) &= \sum_{j=1}^\infty \ e^{txj} \ {n \choose k} p^k (1-p)^{n-k} \\ \\ &= (1-p+pe^t)^n \qquad \text{using the binomial formula} \end{align} \]
The expected value \(E(X)\) of a moment-generating function is \(\mu_1\), or the mean of the first moment. The variance \(\sigma^2\) is \(\mu_2 - \mu_1^2\).
\[ \begin{align} \mu_1 &= g'(0) = npe^0 \ (pe^0 - p + 1)^{n-1} \qquad \text{first derivative of g(x) at 0; expected value} \\ \\ \mu_2 &= g''(0) = npe^0(pe^0-p+1)^{n-2}(npe^0-p+1) \qquad \text{second derivative of g(x) at 0}\\ \end{align} \]
Now we can calculate the variance using \(\mu_1\) (the expected value) and \(\mu_2\).
\[ \begin{align} \mu_2 - \mu_1^2 &= [np(p-p+1)^{n-2}(np-p+1)] \ - \ [np \ (p - p + 1)^{n-1}]^2 \qquad \text{replace } e^0 \text{ with 1} \\ \\ &= np(np-p+1) - np \ = \ n^2p^2-np^2+np \qquad \text{simplify} \end{align} \]
Question 3
Calculate the expected value and variance of the exponential distribution using the moment-generating function.
The PDF of an exponential distribution is \(\lambda e^{-x \lambda}\). Plugging this into the moment-generating function, we get:
\[ \begin{align} g(t) &= \sum_{j=1}^\infty \ e^{txj} \ \lambda e^{-x \lambda} \\ \\ &= \frac{\lambda}{\lambda-t} \ \ \text{for t>0} \qquad \text{after reducing} \end{align} \]
Now we can calculate \(\mu_1\) (the expected value) and \(\mu_2\).
\[ \begin{align} \mu_1 &= g'(0) = \frac{\lambda}{(\lambda-0)^2} = \frac{\lambda}{\lambda^2} = \frac{1}{\lambda} \\ \\ \mu_2 &= g''(0) = \frac{2 \lambda}{(\lambda-t)^3} = \frac{2 \lambda}{\lambda^3} = \frac{2}{\lambda^2} \\ \end{align} \]
This will help us calculate the variance \(\mu_2 - \mu_1^2\).
\[ \begin{align} \mu_2 - \mu_1^2 &= \frac{2}{\lambda^2} - (\frac{1}{\lambda})^2 \\ \\ &= \frac{2}{\lambda^2} - \frac{1}{\lambda^2} \\ \\ &= \frac{1}{\lambda^2} \end{align} \]