楼主: yuan9913_cn
24220 43

[问答] 请教:R程序下怎样用蒙特卡洛模拟股市大盘指数,望高人指教 [推广有奖]

31
epoh 发表于 2011-12-17 18:16:56
yuan9913_cn 发表于 2011-12-17 17:32
epoh老师,那个程序能运行,就是最后要写出“SPaths.csv”文件时,软件提示不能更改“col names”,这是咋回 ...
利用function getwd()
了解你目前的Working Directory
我的就是 "C:/Users/.../Documents"
你应该可以找到程序执行后的SPaths.csv
那个错误不用理它,我的也是一样

32
yuan9913_cn 发表于 2011-12-17 18:19:52
谢谢!

33
hqs00000 在职认证  发表于 2011-12-17 21:40:31
这个老师是R神。。。
失去的东西太多了!

34
self. 发表于 2012-11-2 13:47:38
见识了·····我想问下的是模拟次数和模拟路径有什么区别吗?

35
self. 发表于 2012-11-2 23:11:22
epoh 发表于 2011-12-17 18:16
利用function getwd()
了解你目前的Working Directory
我的就是 "C:/Users/.../Documents"
我想问下那个npath[j+1]与npath[j]之间的关系是如何确定的?

36
epoh 发表于 2012-11-3 20:35:06
self. 发表于 2012-11-2 23:11
我想问下那个npath[j+1]与npath[j]之间的关系是如何确定的?
你可以参考 FRM Handbook page-136
#######matlab code
r=0.07;
step=100;
n=step+1;
delta=1/252;
simun=500;
sigma=0.5;
s0=10;  %stock price
stock(1)=s0;
for i=1:simun
    %FRM Handbook page-136
    for j=2:n     
      stock(j)=stock(j-1)*exp((r-sigma^2/2)*delta+sigma*random('normal',0,3.5,1)*delta^0.5);            
    end  %end stock
end
stock
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
南冰 + 5 + 5 + 5 热心帮助其他会员

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

37
杨胜Sai 发表于 2012-12-16 09:06:26
epoh 发表于 2011-12-17 18:16
利用function getwd()
了解你目前的Working Directory
我的就是 "C:/Users/.../Documents"
老师,您好~我有几个问题不懂,希望您能百忙之中能帮我解答一下~谢谢了啊 ~
一、上次您写的蒙特卡洛模拟股指,其中的mu,sigma,及exp(nudt + sidt*rnorm),这一部分,都是

假设的吗?如果是,那为什么是这样的呢?


二、如果假设股价服从正态分布,那方差和均值可以计算出来吗?如何计算呢?


三、如果设计的是股价与这支股票的前20期股价相关联,且随着时间的接近,关联度越大,这样的代码

怎么写呢?谢谢谢了啊!

期待您的回复。

38
epoh 发表于 2012-12-16 16:26:36
杨胜Sai 发表于 2012-12-16 09:06
老师,您好~我有几个问题不懂,希望您能百忙之中能帮我解答一下~谢谢了啊 ~
一、上次您写的蒙特卡洛模拟 ...
建议你看下options,futures and other derivatives (John c.hull_5e)
其实这本书已经是_8e,
但5e可能更适合你参考.

options,futures and other derivatives (John c.hull_5e).pdf
   https://bbs.pinggu.org/a-623552.html

11. A model of the behavior of stock prices 216
11.1 The Markov property 216
11.2 Continuous-time stochastic processes 217
11.3 The process for stock prices 222
11.4 Review of the model 223
11.5 The parameters 225
11.6 Ito's lemma 226
11.7 The lognormal property 227
     Summary 228
     Suggestions for further reading 229
     Questions and problems 229
     Assignment questions 230
     Appendix 11 A: Derivation of Ito's lemma 232
12. The Black-Scholes model 234
12.1 Lognormal property of stock prices 234
12.2 The distribution of the rate of return

39
杨胜Sai 发表于 2012-12-16 21:29:45
epoh 发表于 2012-12-16 16:26
建议你看下options,futures and other derivatives (John c.hull_5e)
其实这本书已经是_8e,
但5e可能更 ...
哦,好的。谢谢了啊!

40
axiaohuohu 发表于 2014-6-27 16:23:33
确实有用。谢谢老师

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 12:36