37363 - Lab/Tutorial 7 Solutions

Scott Alexander

Q1

(a)

Note that
(Subscript[S, t+Δt]) = (Subscript[S, t])(e^((r-(σ^2)/2)Δt+σ (Subscript[B, Δt]))).

With loops

(* parameters and setup *)
S0=50;r=3/100;sigma=4/10;TT=5;
steps=1250;n=(10^5);
dt=TT/steps;
disc=Exp[-r*TT];

(* creating price-path array *)
rv=RandomReal[NormalDistribution[0,Sqrt[dt]],{n,steps}];
stock=Table[S0,{n},{steps+1}];
For[k=1,k≤steps,k++,
stock[[All,k+1]]=stock[[All,k]]*Exp[(r-sigma^2/2)*dt+sigma*rv[[All,k]]]
];

(* applying payoff *)
payoff=Table[0,{n}];
For[k=1,k≤n,k++,
sMin=Min[stock[[k,2;;steps+1]]];
payoff[[k]]=disc*Max[stock[[k,steps+1]]-sMin,0]
];

(* calculating estimated price and variance *)
Cn=Mean[payoff];
stderrCn=(Sqrt[Variance[payoff]/n]);
{Cn,stderrCn}

ListLinePlot[stock[[1;;20,All]],PlotRange->All]

Without loops

(* parameters and setup *)
S0=50;r=3/100;sigma=4/10;TT=5;
steps=1250;n=(10^5);
dt=TT/steps;
disc=Exp[-r*TT];

(* creating price-path array without for loop *)
rv=RandomReal[NormalDistribution[0,Sqrt[dt]],{n,steps}];
stock=Table[S0,n];
stockCalc[s_,b_]:=s Exp[(r-sigma^2/2)*dt+sigma*b];stock=FoldList[stockCalc,stock,Transpose[rv]]//Transpose;

(* applying payoff *)
payoffCalc[s_]:=disc*Max[s[[1]]-s[[2]],0];
sMin=Map[Min,stock[[All,2;;steps+1]]];
sT=stock[[All,steps+1]];
payoff=Map[payoffCalc,Transpose[{sT,sMin}]];

(* calculating estimated price and standard error *)
Cn=Mean[payoff];
stderrCn=(Sqrt[Variance[payoff]/n]);
{Cn,stderrCn}

Fold and FoldList

start=s0;
rv={rv1,rv2,rv3,rv4};
Fold[f,start,rv]
FoldList[f,start,rv]

(b)

See R code file.

Q2

(a)

𝔼[(Subscript[X, t])] = 𝔼[(e^(-t))B((e^(2t)))] = (e^(-t))𝔼[B((e^(2t)))]    (remove non-random term from expectation)
  = 0
Assuming 0≤s<t
cov((Subscript[X, t]),(Subscript[X, s])) = 𝔼[(Subscript[X, t])(Subscript[X, s])] - 𝔼[(Subscript[X, t])]𝔼[(Subscript[X, s])] = 𝔼[(Subscript[X, t])(Subscript[X, s])]
  = 𝔼[(e^(-t))(Subscript[B, (e^(2t))])(e^(-s))(Subscript[B, (e^(2s))])] = (e^(-(t+s)))𝔼[(Subscript[B, (e^(2t))])(Subscript[B, (e^(2s))])]
  = (e^(-(t+s)))𝔼[((Subscript[B, (e^(2t))])-(Subscript[B, (e^(2s))])+(Subscript[B, (e^(2s))]))(Subscript[B, (e^(2s))])]
  = (e^(-(t+s)))(𝔼[((Subscript[B, (e^(2t))])-(Subscript[B, (e^(2s))]))(Subscript[B, (e^(2s))])]+𝔼[(Subscript[B, (e^(2s))])(Subscript[B, (e^(2s))])])
  = (e^(-(t+s)))(𝔼[(Subscript[B, (e^(2t))])-(Subscript[B, (e^(2s))])]𝔼[(Subscript[B, (e^(2s))])]+𝔼[(Subscript[B, (e^(2s))])(Subscript[B, (e^(2s))])])
       (independence of increments)
  = (e^(-(t+s)))𝔼[(Subscript[B, (e^(2s))])(Subscript[B, (e^(2s))])]
  = (e^(-(t+s)))var((Subscript[B, (e^(2s))])) = (e^(-(t+s)))(e^(2s))
  = (e^(-(t-s))).

Assuming 0≤t<s and using similar arguments
cov((Subscript[X, t]),(Subscript[X, s])) = (e^(-(s-t))).

Combining the two cases gives
cov((Subscript[X, t]),(Subscript[X, s])) = (e^(-|t-s|)).

Alternative solution

Assuming 0≤s<t
cov((Subscript[X, t]),(Subscript[X, s])) = cov((e^(-t))(Subscript[B, (e^(2t))])(e^(-s))(Subscript[B, (e^(2s))])) = (e^(-(t+s)))cov((Subscript[B, (e^(2t))])(Subscript[B, (e^(2s))]))
  =(e^(-(t+s)))(e^(2s)) = (e^(-(t-s))).

Assuming 0≤t<s and using similar arguments
cov((Subscript[X, t]),(Subscript[X, s])) = (e^(-(s-t))).

Combining the two cases gives
cov((Subscript[X, t]),(Subscript[X, s])) = (e^(-|t-s|)).

(b)

From (a) we see the (Subscript[X, t]) has constant expectation and a covariance function determined
by the increment t-s. So by Definition 9 (page 38 Lecture Notes Chapter 4) (Subscript[X, t]) is weakly
stationary.

But (Subscript[X, t]) is also Gaussian so by Proposition 8 (page 40 Chapter 4 Notes) (Subscript[X, t]) is
strictly stationary.

(c)

Let    Q(t,s)=cov((Subscript[X, t]),(Subscript[X, s])).

For (Subscript[t, 1])<(Subscript[t, 2])<(Subscript[t, 3])
Q((Subscript[t, 1]),(Subscript[t, 2]))Q((Subscript[t, 2]),(Subscript[t, 3])) = (e^(-|(Subscript[t, 2])-(Subscript[t, 1])|))(e^(-|(Subscript[t, 3])-(Subscript[t, 2])|)) =  (e^(-((Subscript[t, 2])-(Subscript[t, 1]))))(e^(-((Subscript[t, 3])-(Subscript[t, 2]))))
  = (e^(-((Subscript[t, 3])-(Subscript[t, 1]))))(e^(-((Subscript[t, 2])-(Subscript[t, 2]))))
  = Q((Subscript[t, 1]),(Subscript[t, 3]))Q((Subscript[t, 2]),(Subscript[t, 2])).

This result and the fact that (Subscript[X, t]) is Gaussian by Theorem 1 (page 7 Chapter 5 Notes)
means that (Subscript[X, t]) is Markov.

(d)

We need to find distribution of
(Subscript[ΔX, t]) = (Subscript[X, t+Δt])-(Subscript[X, t]) = (e^(-(t+Δt)))(Subscript[B, (e^(2(t+Δt)))]) - (e^(-t))(Subscript[B, (e^(2t))]).

As a weighted sum of joint-Gaussian RVs the increment is Gaussian.
So we need to find its mean and variance.

The expected value
𝔼[(Subscript[ΔX, t])] = 𝔼[(Subscript[X, t+Δt])-(Subscript[X, t]) ] = 𝔼[(e^(-(t+Δt)))(Subscript[B, (e^(2(t+Δt)))]) - (e^(-t))(Subscript[B, (e^(2t))])]
  = (e^(-(t+Δt)))𝔼[(Subscript[B, (e^(2(t+Δt)))])] - (e^(-t))𝔼[(Subscript[B, (e^(2t))])]
  = 0
as B is a standard BM.

The variance
var((Subscript[ΔX, t])) = var((Subscript[X, t+Δt])-(Subscript[X, t]) ) = var((Subscript[X, t+Δt]))-2cov((Subscript[X, t+Δt]),(Subscript[X, t]))+var((Subscript[X, t]))
  = cov((Subscript[X, t+Δt]),(Subscript[X, t+Δt]))-2cov((Subscript[X, t+Δt]),(Subscript[X, t]))+cov((Subscript[X, t]),(Subscript[X, t]))
  = (e^(-|t+Δt-(t+Δt)|))-2(e^(-|t+Δt-t|))+(e^(-|t-t|))
  = 2-2(e^(-Δt)).

Therefore    (Subscript[ΔX, t])~N(0,2-2(e^(-Δt))).

(e)

Let    s<t<u.

Then
cov((Subscript[X, u])-(Subscript[X, t]),(Subscript[X, t])-(Subscript[X, s])) = cov((Subscript[X, u]),(Subscript[X, t]))-cov((Subscript[X, u]),(Subscript[X, s]))-cov((Subscript[X, t]),(Subscript[X, t]))+cov((Subscript[X, t]),(Subscript[X, s]))
  = (e^(-(u-t)))-(e^(-(u-s)))-(e^(-(t-t)))+(e^(-(t-s)))
  = (e^(-(u-t)))-(e^(-(u-s)))-1+(e^(-(t-s))).

As covariance is not zero the increments are not independent.