ex11 pg363
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
- \(\geq 100\)
- \(\geq 110\)
- \(\geq 120\)
from the text above, we have
- \(X_n = Y_{n+1} -Y_n\)
- \(\mu_X = 0\)
- \(\sigma_X^2 = 1/4\)
- \(Y_1 = 100\)
we also know that,
\(S_n = X_1 + X_2 + ...+X_n\)
so,
\(S_n = (Y_2-Y_1)+(Y_3-Y_2)+...+(Y_n-Y_{n-1})+(Y_{n+1}-Y_n)\\ = Y_{n+1} - Y_1 \\= Y_{n+1} - 100\)
when \(Y_{n+1} = Y_{365}\), n = 365-1 = 364,
so, \(S_{364} = Y_{365} - 100\)
then, \(Y_{365} = S_{364} + 100\)
As a result,
- \(\mu_S = np = n\mu_X = 364*0 = 0\)
- \(\sigma_S^2 = n\sigma_X^2 = 364 * 1/4 = 91\)
- \(\sigma_S = \sqrt{91}\)
then,
\(P(Y_{365} \geq100) = P(S_{364}+100 \geq100) = P(S_{364} \geq0)\)
# >=100
1-pnorm(0,mean = 0, sd = sqrt(91))## [1] 0.5
\(P(Y_{365} \geq110) = P(S_{364}+100 \geq110) = P(S_{364} \geq10)\)
# >=110
1-pnorm(10,mean = 0, sd = sqrt(91))## [1] 0.1472537
\(P(Y_{365} \geq120) = P(S_{364}+100 \geq120) = P(S_{364} \geq20)\)
# >=120
1-pnorm(20,mean = 0, sd = sqrt(91))## [1] 0.01801584
Moment generation
binominal distribution
calculate the expected value and variance of the binomial distribution using the moment generating function.
binomial distribution function: \(n\choose j\)\(p^jq^{n-j}\)
moment generating function:
\(M(t) = \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}\)
\(=(pe^t + q)^n\)
because \(\mu = \mu_1, \sigma^2 = \mu_2-\mu_1^2\), we need to calculate \(\mu_1\) and \(\mu_2\)
with derivative calculator, we get
- \(M'(t) = npe^t(pe^t+q)^{n-1}\)
- \(M''(t) = (n-1)np^2(pe^t+q)^{n-2}e^{2t}+npe^t(pe^t+q)^{n-1}\)
then,
\(\mu_1 = M'(t=0)\\=npe^t(pe^t+q)^{n-1} |_{t=0}\\=npe^0(pe^0+q)^{n-1}\\=np\)
\(\mu_2 = M''(t=0)\\=(n-1)np^2(pe^t+q)^{n-2}e^{2t}+npe^t(pe^t+q)^{n-1}|_{t=0}\\=(n-1)np^2(pe^0+q)^{n-2}e^{2*0}+npe^0(pe^0+q)^{n-1}\\=(n-1)np^2+np\\=np(np+q)\)
As a result,
- \(\mu = \mu_1 = np\)
- \(\sigma^2 = \mu_2 - \mu_1^2 = npq\) where \(q = 1-p\)
exponential distribution
calculate the expected value and variance of the exponential distribution using the moment generating function.
exponential distribution function: \(\lambda e^{-\lambda x}\)
moment generating function(with integral calculator):
\(M(t) = \int e^{tx} \lambda e^{-\lambda x}\\=\int \lambda e^{(-\lambda+t)x} \\=-\frac{\lambda e^{(t-\lambda)x}}{\lambda-t}|_{0}^{\infty}\\=\frac{\lambda}{\lambda-t}\)
using derivative calculator, we have:
- \(M'(t) = \frac{\lambda}{(\lambda-t)^2}\)
- \(M''(t) = \frac{2\lambda}{(\lambda-t)^3}\)
therefore,
- \(\mu_1 = M'(t=0)\\=\frac{\lambda}{(\lambda-0)^2}\\=\frac{1}{\lambda}\)
- \(\mu_2 = M''(t=0)\\=\frac{2\lambda}{(\lambda-0)^3}\\=\frac{2}{\lambda^2}\)
finally,
- \(\mu = \mu_1 = \frac{1}{\lambda}\)
- \(\sigma^2 = \mu_2-\mu_1^2 = \frac{2}{\lambda^2}-(\frac{1}{\lambda})^2=\frac{1}{\lambda^2}\)