CUNY MSDA DATA 605 HW 9

Nicholas Schettini

October 28, 2018

library(visualize)
  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
  1. = 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
visualize.norm(stat = x, mu = mu1,sd = s, section = "upper")

  1. = 110

x <- 110

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

  1. = 110

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) = {n \choose k} p^k q^{n-k}\) when \(q=1-p\)

The moment generating function is \(M_X(t)=(q+pe^t)^n\)

The first moment function is \(M'_X(t) = 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}\]

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

The exponential distribution is \(f(x)=\lambda e^{-\lambda x}\)

The moment generating function is: \(M_X(t)=\frac{\lambda}{\lambda-t}, t<\lambda\)

The expected value is:

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

The variance is:

\[\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}\]

References:

http://mathworld.wolfram.com/BinomialDistribution.html http://math.arizona.edu/~tgk/464_10/chap4_9_29.pdf https://www.statlect.com/probability-distributions/binomial-distribution http://www.r-tutor.com/elementary-statistics/probability-distributions/binomial-distribution