# 11. The price of one share of stock in the Pilsdorff Beer Company (see Exercise8.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 $$\mu = 0$$ and $$\sigma^2 = 1/4$$. If $$Y_1 = 100$$ estimate the probability that $$Y_{365}$$ is:-

$$Y_{365}−Y_1=X_1+X_2..X_{364}$$

$$\mu = 0$$

$$\sigma^2 = 1/4$$

# (a) $$\geq$$ 100.

pnorm(100 - 100, mean = 0, sd = sqrt(364/4), lower.tail = FALSE)
## [1] 0.5

# (b) $$\geq$$ 110.

pnorm(110 - 100, mean = 0, sd = sqrt(364/4), lower.tail = FALSE)
## [1] 0.1472537

# (c) $$\geq$$ 120.

pnorm(120 - 100, mean = 0, sd = sqrt(364/4), lower.tail = FALSE)
## [1] 0.01801584

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

The moment generating function for a binomial random variable X:

$$M(t)=[(1-p) +pe^t]^n$$.

Calculating the first Derivative of M(t) with respect to t, we get

$$M'(t) = n(pe^t)[(1-p)+pe^t]^{n-1}$$

Setting t = 0

$$M'(0) = n [ 1 - p + p ]^{n-1} p(1) = np$$

Expected value:- $E(X) = \mu = M'(0) = np$

To find the variance, we first need to take the second derivative of M(t) with respect to t. Doing so, we get:

$$M''(t) = n[1 - p + pe^t]^{n-1}(pe^t)+ (pe^t) n(n-1)[1 - p + pe^t]^{n-2}(pe^t)$$

Setting t = 0

$$M''(0) = np + n^2p^2 -np^2$$

Variance: = $$M''(0) = n(n-1)p^2 + np$$ = $$\sigma^2 = M''(0) - [M'(0)]^2 = np(1-p)$$

or,

$$\sigma^2 = np(1-p)$$

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

The exponential distribution function is given as: $$f(x)= \lambda e^{−\lambda x}$$

Moment generating function for the distribution is:

$$M_X(t)=E(e^{tx})=\int ^∞_0e^{tx}f(x)dx$$

$$=E(e^{tx})=\int ^∞_0e^{tx}λe^{−λx}dx$$

$$=\lambda \int^∞_0e^{tx}e^{−λx}dx$$

$$=\lambda \int^∞_0e^{(t−λ)x}dx$$

$$=\lambda \int ^∞_0e^{(t−λ)x}dx$$

So, $$M_X(t)=\frac {\lambda}{\lambda−t}$$

For t=0,

The first derivative

$$M_X'(0) = E(x)= \frac {\lambda}{(\lambda -0)^2} = \frac{1}{\lambda}$$ = $$\mu_1$$ = expected value E(x)

The second derivative For t = 0,

$$M_X''(0) = E(X^2)= \frac {2\lambda}{(\lambda-t)^3}$$

$$M_X''(0) = E(X^2)= \frac{2}{\lambda^2}$$

$$V(X)=E(X^2)−E(X)^2=\frac { 2 }{ \lambda ^{ 2 } } -\frac { 1 }{ \lambda ^{ 2 } }=\frac{1}{\lambda^2}$$ = V(X) = Variance = $$\sigma^2$$