Since the mean of the price of stock difference from a day to the subsequent day is 0 (Xn=Yn+1-Yn), any non-zero value of Xn deviates from the mean. Assuming Xn follows a normal distribution, if Y1 = 100 then 100 =< 100+Xn. This will be true 50% of the time since this statement is true when Xn >= 0, which is right of the normal curve and 50%.
variance = 1/4
sd = sqrt(variance*365)
mu=0
1-pnorm(0,mean = mu,sd = sd)
## [1] 0.5
Similarly, this statement would mean 110 =< 100+Xn. So in order for this to be true then Xn <=10. The proportion of the data that falls to the right of 10 units from the mean is calculated:
1-pnorm(10,mean = mu,sd = sd)
## [1] 0.1475849
Similarly, this statement would mean 120 =< 100+Xn. So in order for this to be true then Xn =<20. The proportion of the data that falls to the right of 20 units from the mean is calculated:
1-pnorm(20,mean=mu,sd=sd)
## [1] 0.01814355
The moment generating function g(t) is calculated below for a discrete distribution, the binomial. q is substituted for (1-p) in the binomial equation.
\[ g(t)=\sum_{j=0}^{n} \begin{pmatrix} n\\ j \end{pmatrix} (pe^t)^jq^{n-j}\]
\[ g(t)= \begin{pmatrix} n\\ 0 \end{pmatrix} (pe^t)^0q^{n-0}+\begin{pmatrix} n\\ 1 \end{pmatrix} (pe^t)^1q^{n-1}+\begin{pmatrix} n\\ 2 \end{pmatrix} (pe^t)^2q^{n-2}+...+\begin{pmatrix} n\\ n \end{pmatrix} (pe^t)^nq^{n-n}\]
\[\text{This was tested out for n = 3 to get the following:}\] \[g(t)=(pe^t)^3+3(pe^t)^2q+3(pe^t)q^2+q^3\] \[g(t)=(pe^t+q)^3\]
\[\text{This is the same as } g(t) = (pe^t+q)^n\]
The first moment or the mean is derived below. Chain rule is used to find the derivative: \[M'(0) = E(x)=\frac{d}{dt}(pe^t+q)^n|_{t=0}=n(pe^t+q)^{n-1}pe^t|_{t=0}\] \[=n(p+q)^{n-1}p=n(p+(1-p))^{n-1}p=np\]
The second moment or the variance is derived below. The product rule is used to find the derivative: \[M''(0)=E(X^2)=\frac{d}{dt}(n(pe^t+q)^{n-1}pe^t)|_{t=0}\] \[=[n(n-1)(pe^t+q)(p)(pe^t)+pe^t(n(pe^t+q)^{n-1}]|_{t=0}\] \[=n(n-1)(p+q)(p)(p)+p(n(p+q)^{n-1})\] \[=n(n-1)(p+(1-p))p^2+pn=np^2(n-1)+np\]
\[M''(0)=E(X^2)-E(X)^2=np^2(n-1)+np-(np)^2\] \[=(np)^2-np^2+np-(np)^2=np(1-p)\]
The moment generating function is calculated for a contiunous function, the exponential distribution. \[g(t)=\int_0^{+\infty}e^{tx}\lambda e^{-\lambda x}dx\] \[=\int_0^{+\infty}e^{x(t-\lambda)}\lambda dx=\frac{\lambda e^{x(t-\lambda)}}{t-\lambda}|_0^{+\infty}\] \[=-\frac{\lambda}{t-\lambda}=\frac{\lambda}{\lambda-t}\]
The first moment or the mean is calculated below. The quotient rule is used to find the derivative: \[M'(0)=E(X)=\frac{d}{dt}\frac{\lambda}{\lambda-t}|_{t=0}=\frac{\lambda (+1)}{(\lambda -t)^2}|_{t=0}=\frac{\lambda}{(\lambda -t)^2}|_{t=0}\] \[=\frac{1}{\lambda}\]
The second moment or the variance is calculated below: \[E(X^2)=\frac{d}{dt}\frac{\lambda}{(\lambda-t)^2}|_{t=0}=\frac{\lambda(2(\lambda-t))}{(\lambda-t)^4}|_{t=0}\] \[=\frac{2\lambda}{(\lambda-t)^3}|_{t=0}=\frac{2\lambda}{\lambda^3}=\frac{2}{\lambda^2}\]
\[M''(0)=E(X^2)-[E(X)]^2=\frac{2}{\lambda^2}-\frac{1}{\lambda^2}=\frac{1}{\lambda^2}\]