follows a geometric brownian motion of
,
whereis the drift rate,
is the variance rate, and
is the standard Wiener process with ~ . Assume that , , and . Simulate the stock price movement for one year 1000 times.
(1)
Plot the distributions of the stock price and of the logarithm of the stock price at the end of each quarter.
(2)
Compute the means and standard deviations of the stock price and the logarithm of the stock price
at the end of each quarter. Compare them to their theorectical values.
data a;
do i=1 to 252;
do roll=1 to 10;
observation = i;
e=rannor(0);
pribeg=. ;
priend=. ;
end;
output;
end;
run;
%let mu=0.15 sigma=0.20 s0=50 t=252;
proc iml;
use a;
read all var {observation e pribeg priend} into x;
if i=1 then do;
x[i,3]=50;
x[i,4]=x[i,3]+mu*(1/t)*s0+sigma*sqrt(1/t)*x[i,2]*s0;
end;
do i = 2 to nrow(x);
x[i,3] = x[i-1,4];
x[i,4] = x[i,3]+mu*(1/t)*s0+sigma*(1/t)**(1/2)*x[i,2]*s0;
end;
create final from x;
append from x;
quit;
run;
拟模拟股票价格走势,但iml出现问题,求高手帮忙看看~~