全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1467 2
2009-12-29
1. Suppose the stock price
follows a geometric brownian motion of


,

where
is 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出现问题,求高手帮忙看看~~
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2009-12-29 21:43:56
1# qyj8888
data a;
do i=1 to 252;
do roll=1 to 10;
observation = i;
e=rannor(0);
pribeg=. ;
priend=. ;
output;
end;
end;
run;

%let mu=0.15 ;
%let sigma=0.20;
%let s0=50 ;
%let t=252;

proc iml;
use a;
read all var {observation e pribeg priend} into x;
x[1,3]=50;
x[1,4]=x[1,3]+&mu*(1/&t)*&s0+&sigma*sqrt(1/&t)*x[1,2]*&s0;
  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;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-12-29 23:00:38
谢谢LS的~~~~
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群