Column

Problem 7.1.2

The price of a stock on a given trading day changes according to the distribution \[p(x)=\bigg(\frac{-1\ 0\ 1\ 2}{\ \frac{1}{4}\ \frac{1}{2}\ \frac{1}{8}\ \frac{1}{8}}\bigg)\] Find the distribution for the change in stock price after two (independent) trading days.
X<-RV(outcomes =c(-1,0,1,2), probs =c(1/4,1/2,1/8,1/8))
new_dist<-SofIID(X,2)
print(new_dist)
Random variable with 7 outcomes

Outcomes   -2   -1    0    1    2    3    4
Probs    1/16  1/4 5/16 3/16 9/64 1/32 1/64

Problem 7.1.3

Let X1 and X2 be independent random variables with common distribution \[p(x)=\bigg(\frac{0\ 1\ 2}{\ \frac{1}{8}\ \frac{3}{8}\ \frac{1}{2}}\bigg)\] Find the distribution of the sum X1 + X2.

X<-RV(outcomes =c(0,1,2), probs =c(1/8,3/8, 1/2))
new_dist_2<-SofI(X , X, fractions = TRUE)
print(new_dist_2) 
Random variable with 5 outcomes

Outcomes     0     1     2     3     4
Probs     1/64  3/32 17/64   3/8   1/4

Column

Plot 7.1.2

Plot 7.1.