Problem 11: Introduction to Probability (Page 363)
The price of one share of stock in the Pilsdorff Beer Company (see Exercise 8.2.12) is given by \(Y_n\) on the nth 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 µ = 0 and variance \(σ^2\) = 1/4. If \(Y_1\) = 100, estimate the probability that \(Y_365\) is (a) ≥ 100. (b) ≥ 110. (c) ≥ 120.
Y1 <- 100
mu <- 0
sigma <- 1/2
# Number of days
n <- 365
# Mean and standard deviation of Y_n
mean_Yn <- Y1 + (n - 1) * mu
sd_Yn <- sqrt((n - 1) * sigma^2)
# Probabilities using the normal distribution
prob_a <- 1 - pnorm(100, mean = mean_Yn, sd = sd_Yn)
prob_b <- 1 - pnorm(110, mean = mean_Yn, sd = sd_Yn)
prob_c <- 1 - pnorm(120, mean = mean_Yn, sd = sd_Yn)
cat("Estimated probability that Y365 is ≥ 100:", prob_a, "\n")
## Estimated probability that Y365 is ≥ 100: 0.5
cat("Estimated probability that Y365 is ≥ 110:", prob_b, "\n")
## Estimated probability that Y365 is ≥ 110: 0.1472537
cat("Estimated probability that Y365 is ≥ 120:", prob_c, "\n")
## Estimated probability that Y365 is ≥ 120: 0.01801584
Problem 2:
Calculate the expected value and variance of the binomial distribution using the moment generating function.
For a binomial distribution with parameters n (number of trials) and p (probability of success), the MGF is given by \(M_X\)(t)=\((1−p+pe^t)^{n}\)
In this case, X is the sum of the differences \(X_n\) = \(Y{n+1}\) - \(Y_n\) for n = 1,2,3,…364
\(X_n\) hs a distribution with has a distribution with mean μ=0 and variance \(σ^2\) = 1/4
E[X] = M’X(0) Var(X) = \(M''_X(0) + M'_X(0) - [M'_X(0)]^2\)
Problem 3:
Calculate the expected value and variance of the exponential distribution using the moment generating function.
The probability of the exponential distribution is given by, f(x)=\(λe^{−λx}\). Also, the moment generating function is \(M_X(t)=\frac{\lambda}{\lambda-t},t<\lambda\).
The first moment is, \(M'_X(t) =\frac{\lambda}{(\lambda-t)^2}\) and the second moment is given by: \(M''_X(t) =\frac{2\lambda}{(\lambda-t)^3}\).
To get the expected value, we evaluate the first moment at t=0:
\[\begin{split} E(X)=M'_X(0) &= \frac{\lambda}{(\lambda-0)^2} \\ &= \frac{\lambda}{\lambda^2}\\ &= \frac{1}{\lambda} \end{split}\]
The variance is given by: \(Var(X)=E(X^2)-E(X)^2\); where \(E(X^2)\) is the second derivative of the moment generating function and E(X)2 is the square of the first derivative of the moment generating function which is also the square of the expected value when evaluated at t=0. Evaluating the variance function for where t=0:
\[\begin{split} Var(X) = E(X^2)-E(X)^2 &= M''_X(0)-M'_X(0)^2 \\ &=\frac{2\lambda}{(\lambda-0)^3} - \frac{1}{\lambda^2}\\ &=\frac{2\lambda}{\lambda^3} - \frac{1}{\lambda^2}\\ &=\frac{2}{\lambda^2} - \frac{1}{\lambda^2}\\ &=\frac{1}{\lambda^2} \end{split}\]
Hence, we get the expected value and variance for exponential probability distribution as \(E(X)=1/\lambda\) and \(Var(X)=1/\lambda^2\) respectively.