1. The price of one share of stock in the Pilsdorff Beer Company (see Exercise 8.2.12) is given by Yn on the nth day of the year. Finn observes that the differences Xn = Yn+1 ??? Yn appear to be independent random variables with a common distribution having mean ?? = 0 and variance ??2 = 1/4. If Y1 = 100, estimate the probability that Y365 is

(a)>=100

num <- 365
mu <- 0
n <- num - 1
y <- 100
mu1 <- mu + y
var <- 0.25 * n
s <- sqrt(var)
x <- 100


pnorm(x, mu1, s, lower.tail = F)
## [1] 0.5
library(visualize)
visualize.norm(stat = x, mu = mu1,sd = s, section = "upper")

(b)>=100

x <- 110

visualize.norm(stat = x, mu = mu1, sd = s, section = "upper")

(c)>=120

x <- 120

visualize.norm(stat = x, mu = mu1, sd = s, section = "upper")

  1. Calculate the expected value and variance of the binomial distribution using the moment generating function

The binomial distrubution: \(P(X=k)= (nk) p^k q^{n-k}, where \space q = 1-p\)

he moment generating function is : \(M_{X} (t) = (q+pe^t)^n\)

The First moment fucntion is: \(M_{X}^{\prime}= n(q+pe^t)^{n-1} pe^t\)

\[ \begin{split} E(X)=M'_X(0) &= n(q+pe^0)^{n-1}pe^0\\ &= n(q+p)^{n-1}p\\ &= np(1-p+p)^{n-1}\\ &= np1^{n-1}\\ &=np \end{split}\]

The second moment function is : \(M''_X(t) = n(n-1)(q+pe^t)^{n-2}p^2 e^{2t}+n(q+pe^t)^{n-1}pe^t\)

\[ \begin{split} E(X^2)=M''_X(0) &= n(n-1)(q+pe^0)^{n-2}p^2 e^0+n(q+pe^0)^{n-1}pe^0\\ &= n(n-1)(1-p+p)^{n-2}p^2+n(1-p+p)^{n-1}p\\ &= n(n-1)p^2+np \end{split} \]

The variance is \(V(X)=E(X^2)-E(X)^2\)

\[ \begin{split} V(X) &= n(n-1)p^2+np-n^2p^2 \\ &= np((n-1)p+1-np) \\ &= np(np-p+1-np) \\ &= np(1-p) \\ &= npq \end{split} \]

\(E(X) = np, \space V(X) = npq\)

  1. Calculate the expected value and variance of the exponential distribution using the moment generating function.

The prob. density function for exponential distribution is \(f(x)=\lambda e^{-\lambda x}\)

We can obtain the MGF of X using PDF \(M_x(t)=\frac{\lambda}{\lambda-t}, t<\lambda\)

Using calculator, our first derivative is \(M'_x(t) = \frac{\lambda}{(\lambda-t)^2}\) and and second derivative is \(M''_x(t) = \frac{2\lambda}{(\lambda-t)^3}\)

As we set t=0 for the first moment, we will obtain the expected value.

\[ \begin{split} E(x)=M'_x(0) &= \frac{\lambda}{(\lambda-0)^2} \\ &= \frac{\lambda}{\lambda^2}\\ &= \frac{1}{\lambda} \end{split} \]

To obtain variance, we differentiate again and set t=0

\[ \begin{split} V(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} \]

\(E(X)=\frac{1}{\lambda}, \space V(X)=\frac{1}{\lambda^2}\)