Professional Documents
Culture Documents
Uni: rjv2119
STAT W4290
Homework 1
Problem 1)
We can see that GM returns and Ford returns in the large majority are concentrated in the center and
show a somewhat positive correlation. The outliers do appear together (high values for GM imply high
values for Ford and otherwise).
Problem 5,6,7)
We simulate the returns and we include stopping points when the daily price goes over 1,100,000 or
under 950,000. Then we obtain:
Pr(𝐿𝑜𝑠𝑠) = 0.58844
mean(𝑃𝑟𝑜𝑓𝑖𝑡) = 9,922.63
mean(𝐷𝑎𝑖𝑙𝑦_𝑅𝑒𝑡𝑢𝑟𝑛) = −0.01783836
We include an R file with the code, modified from the one provided in the textbook that we used for
obtaining this results.
Exercise 1 a)
We are going to express 𝛷(𝑥) and 𝜑(𝑥) as the C.D.F. and P.D.F. respectively, of a (0,1) Gaussian
distribution. We do:
ln 𝑦 − 𝜇
Pr(𝑌 ≤ 𝑦) = Pr(𝑒 𝑋 ≤ 𝑦) = Pr(𝑋 ≤ ln 𝑦) = 𝛷 ( )
𝜎
ln 𝑦−𝜇 2
−( )
𝑑 𝑑 ln 𝑦 − 𝜇 1 ln 𝑦 − 𝜇 1 1 𝜎
𝑓𝑌 (𝑦) = 𝐹𝑌 (𝑦) = 𝛷( )= 𝜑( )= ( 𝑒 2 )
𝑑𝑦 𝑑𝑦 𝜎 𝜎𝑦 𝜎 𝜎𝑦 √2𝜋
1 −(ln 𝑦−𝜇)2
= 𝑒 2𝜎 2
√2𝜋𝜎𝑦
Exercise 1 b)
𝔼[𝑌] = 𝔼[𝑒 𝑋 ]
1 2
𝔼[𝑌] = 𝔼[𝑒 𝑋 ] = 𝑀. 𝐺. 𝐹(1) = 𝑒 𝜇+2𝜎
Now to get the variance we need the second moment and therefore:
𝔼[𝑌 2 ] = 𝔼[𝑒 2𝑋 ]
We know that if
𝐼(𝑋𝑖 ≤ 𝑥)~𝐵𝑒𝑟𝑛𝑜𝑢𝑙𝑙𝑖(𝑝 = 𝐹(𝑥))
Then:
𝑛
Then:
𝑛
1 𝑌 1
𝔼[𝐹𝑛 (𝑥)] = 𝔼 [ ∑ 𝐼(𝑋𝑖 ≤ 𝑥)] = 𝔼 [ ] = 𝔼[𝑌] = 𝐹(𝑥)
𝑛 𝑛 𝑛
𝑖=1
And with this we have shown that 𝐹𝑛 (𝑥) is an unbiased estimator for 𝐹(𝑥).
Exercise 2 b)
Exercise 2 c)
Knowing that:
𝐹(𝑥)(1 − 𝐹(𝑥))
𝐹𝑛 (𝑥)~𝐹 ∗ (𝐹(𝑥), )
𝑛
Stating that 𝐹 ∗ is a distribution. Using the central limit theorem we know that for a large n:
for (i in 1:niter)
{
r = rnorm(100,mean=.05/253,
sd=.23/sqrt(253)) # generate random numbers
logPrice = log(1e6) + cumsum(r)
#We generate a sequence that stops if a min or a max is obtained
pmax = ifelse(length(which(logPrice >= log(1100000))) > 0,
min(which(logPrice >= log(1100000))), 100)
pmin = ifelse(length(which(logPrice < log(950000))) > 0,
min(which(logPrice < log(950000))), 100)
daystrade = min(pmax,pmin)
logPrice2 =logPrice[1:daystrade]
proof[i] = min(logPrice2)
minlogP = min(logPrice2) # minimum price over next 100 days
below[i] = as.numeric(minlogP < log(950000))
if(daystrade == 100){
profit[i] = max(min(exp(logPrice2[100]) - 1.e6,100000),-50000)
}
else{
if(pmax < pmin){
profit[i] = 100000
}
else{
profit[i] = -50000
}
}
sim_return[i] = profit[i] / 50000.
sim_return[i] = sim_return[i] / daystrade # convert into daily returns
}
mean(below)
mean(profit)
mean(sim_return)