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
(a) ≥ 100
yn=100
y1 <- 100
n<- 364
var <- sqrt(n)*1/2
mean <- 0
pnorm(yn-y1,mean,var,lower.tail=FALSE)
## [1] 0.5
(b) ≥ 110
yn_b <- 110
pnorm(yn_b-y1,mean,var,lower.tail=FALSE)
## [1] 0.1472537
(c) ≥ 120
yn_c <- 120
pnorm(yn_c-y1,mean,var,lower.tail=FALSE)
## [1] 0.01801584
2. Calculate the expected value and variance of the binomial distribution using the moment generating function
#examples
n <- 10
p <- 0.3
moment_function_bindist <- function(t) (1 - p + p * exp(t))^n
# ev
ev <- moment_function_bindist(0)
# var
var <- moment_function_bindist(0) + moment_function_bindist(-2 * log(1 - p)) - ev^2
3. Calculate the expected value and variance of the exponential distribution using the moment generating function.
lambda <- 1
moment_function_expdist <- function(t) 1 / (1 - t / lambda)
# ev
ev2 <- moment_function_expdist(1)
# variance
var2 <- moment_function_expdist(2) - (moment_function_expdist(1))^2