The price of one share of stock in the Pilsdorff Beer Company 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
\(Y_{365}-Y_1\) = \((Y_{365}-Y_{364})+(Y_{364}-Y_{363})+(Y_{363}-Y_{362})+...(Y_2-Y_1)\) = \(X_{364} + X_{363} + X_{362} +...+X_1\) = \(\sum_{i=1}^{364}X_i\) = \(S_{364}\)
n <- 364
\(E[Y_{365}] = E[S_{364}] = n\mu = 364 \times 0 = 0\)
mu <- 0
\(Var(Y_{365})= Var(S_{364}) = n\sigma^2=364\times \frac{1}{4} = 91\)
std <- sqrt(n*1/4)
\(P(Y_{365}\ge 100)\Rightarrow P(Y_{365}-100\ge 100-100)=P(Y_{365}-Y_1\ge 0)=P(S_{364}\ge 0)\)
diff <- 0
1-pnorm(q=diff,mean=mu,sd=std)
## [1] 0.5
\(P(Y_{365}\ge 110)\Rightarrow P(Y_{365}-100\ge 110-100)=P(Y_{365}-Y_1\ge 10)=P(S_{364}\ge 10)\)
diff <- 10
1-pnorm(q=diff,mean=mu,sd=std)
## [1] 0.1472537
\(P(Y_{365}\ge 120)\Rightarrow P(Y_{365}-100\ge 120-100)=P(Y_{365}-Y_1\ge 20)=P(S_{364}\ge 20)\)
diff <- 20
1-pnorm(q=diff,mean=mu,sd=std)
## [1] 0.01801584
Calculate the expected value and variance of the binomial distribution using the moment generating function.
Binomial distribution: \(p_X(j) = (_j^n)p^jq^{n-j}\) for \(0\le j\le n\)
\(g(t)\) = \(E[e^{tx}]\) = \(\sum_{j=0}^{n}e^{tj} {n\choose j} p^jq^{n-j}\) = \(\sum_{j=0}^{n}{n\choose j}(pe^t)^jq^{n-j}\)
Binomial theorem: \((x+y)^n=\sum_{k=0}^{n}{n\choose k}x^{n-k}y^k \space \Rightarrow\) \(g(t)\) = \((pe^t+q)^n\)
\(g'(t)\) = \(n(pe^t+q)^{n-1}pe^t\)
\(g''(t)\) = \(n(n-1)(pe^t+q)^{n-2}(pe^t)^2+n(pe^t+q)^{n-1}pe^t\)
\(E[X]\) = \(g'(0)\) = \(n(p+q)^{n-1}p\)=\(np\)
\(Var(X)\) = \(E[X^2]-E[X]^2\) = \(g''(0)-(g'(0))^2\)=\(n(n-1)p^2+np-(np)^2\) = \(np(1-p)\)
Calculate the expected value and variance of the exponential distribution using the moment generating function.
Exponential distribution: \(f(x) = \lambda e^{-\lambda x}\) for \(x\ge 0\)
\(g(t)\) = \(E[e^{tx}]\) = \(\int_0^\infty e^{tx}\lambda e^{-\lambda x}dx\) = \(\lambda \int_0^\infty e^{(t-\lambda)x}dx\) = \(\lambda \frac{1}{t-\lambda}e^{(t-\lambda)x}]_{x=0}^{x\rightarrow\infty}\) = \(\frac{\lambda}{t-\lambda}[\lim_{x\to \infty} e^{(t-\lambda)x}-1]\)
\(\because |t|<\lambda,\space\space \therefore \lim_{x\to\infty}e^{(t-\lambda)x}=0\)
\(g(t)\) = \(\frac{\lambda}{\lambda-t}\)
\(g'(t)\) = \(\frac{\lambda}{(\lambda-t)^2}\)
\(g''(t)\) = \(\frac{2\lambda}{(\lambda-t)^3}\)
\(E[X]\) = \(g'(0)\) = \(\frac{\lambda}{\lambda ^2}\) = \(\frac{1}{\lambda}\)
\(Var(X)\) = \(g''(0)-(g'(0))^2\) = \(\frac{2\lambda}{\lambda ^3}-\frac{1}{\lambda^2}\) = \(\frac{1}{\lambda^2}\)