The Cox-Ross random walk, widely used in Finance, is
defined as follows. Let
be a sequence of
independent random variables with common law
,
where
,
and
being two fixed real numbers. Let
and
Question 1
For a given discrete time compute in a vector the possible states
of .
t=3;
I=0:t;
X=....
|
Question 2
Draw on a figure all the possible states that can be reached from X0
when discrete time evolves from 0 to
t=N;
xbasc();
for i=0:t
....
plot2d(...) // plot the states at time i with a mark
end
|
Question 5
Compute also for each discrete time, the values of the state variables and
plot the value function according to the state value.
// The cost function at time T
function y=f(x,K) .... endfunction
// at each time we compute in a column of V the function value associated to states
// X_0(1+a)^i*(1+b)^(t-i)
T=10;
I=0:T;
XT=...
n=.. // maximum number of states for t in [0,T]
V=zeros(n,T); // initialize V
X=zeros(n,T); // initialize X
V(:,T)=...
X(:,T)=...
for t=T-1:-1:1
...
X(I+1,t)=... // I is the vector of possible indices at time t
V(I+1,t) =...
end
// plot the value function at each step
for t=1:T
xbasc();
I=0:t;
plot2d(X(I+1,t),V(I+1,t))
halt();
end
|
Question 6
Use the U matrix to plot the tree of discrete value for the state according to time
using a different mark for stopping or non-stopping states.
|
Question 7
Use the previous code to implement a function which computes
the value function at time for a given grid of state values.
Draw these functions for time evolving from 0 to .
|