楼主: aywinng
6961 15

[问答] 请教Toolbox中自带NS模型的问题,年付息频率如何处理 [推广有奖]

  • 0关注
  • 1粉丝

已卖:1份资源

硕士生

67%

还不是VIP/贵宾

-

威望
0
论坛币
344 个
通用积分
0.0928
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
951 点
帖子
121
精华
0
在线时间
241 小时
注册时间
2007-7-17
最后登录
2025-4-8

楼主
aywinng 发表于 2012-4-6 11:58:09 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
我想用Nelson-Siegel对国债数据进行处理。但是我看toolbox中的NS模型,默认的年付息频率是两次,也就是compounding这个参数。但是我国大部分都是付息一次。我要处理的数据中,同一天的国债数据中有付息一次的也有付息两次的,请问要怎样处理呢?

NSModel = IRFunctionCure.fitNelsonSiegel('Zero',CurveSettle,...
Instruments,'Compounding',1,'InstrumentPeriod',InstrumentPeriod);


函数如上,compounding现在赋值是‘1’,这个地方我不太懂,这个参数应该是付息频率吧?
二维码

扫码加我 拉你入群

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

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

关键词:toolbox Tool NS模型 box LBO 模型 频率 如何

沙发
epoh 发表于 2012-4-7 07:34:07
Compounding (Optional) Scalar that sets the compounding frequency per year for the IRFunctionCurve object:

-1 =  Continuous compounding

1 = Annual compounding

2 = Semiannual compounding (default)

3 = Compounding three times per year

4 = Quarterly compounding

6 = Bimonthly compounding

12 = Monthly compounding


http://www.mathworks.com/help/to ... rfunctioncurve.html

藤椅
aywinng 发表于 2012-4-7 14:37:03
epoh 发表于 2012-4-7 07:34
Compounding (Optional) Scalar that sets the compounding frequency per year for the IRFunctionCurve o ...
谢谢。这个地方我也看到了。但是我要同时处理几十个数据,有的是付息一次,有的是两次。我要什么设计参数呢。上面的函数中,compounding好像只能赋一个值。

板凳
epoh 发表于 2012-4-7 15:09:12
aywinng 发表于 2012-4-7 14:37
谢谢。这个地方我也看到了。但是我要同时处理几十个数据,有的是付息一次,有的是两次。我要什么设计参数 ...
你说对了
这里很清楚的指明
Compounding (Optional) Scalar that...

Compounding是个 Scalar不是Vcetor

报纸
aywinng 发表于 2012-4-7 21:54:01
epoh 发表于 2012-4-7 15:09
你说对了
这里很清楚的指明
Compounding (Optional) Scalar that...
您的意思是赋值的时候 [0;1;1;2] 这样的格式吗?我去试试。大菜鸟一个,好多都不懂。

地板
epoh 发表于 2012-4-7 23:10:53
aywinng 发表于 2012-4-7 21:54
您的意思是赋值的时候 [0;1;1;2] 这样的格式吗?我去试试。大菜鸟一个,好多都不懂。
呵呵,你误解了
scalar的意思,就是一个数目.
只能是右边中的一个 [-1,1,2 (default) ,3,4,6,12]
想想看Compounding,主要是用来计算vector of discount factors
DF =  zero2disc(ZeroRates, CurveDates, Settle, Compounding, Basis)
当然是scalar了

7
aywinng 发表于 2012-4-7 23:48:02
epoh 发表于 2012-4-7 23:10
呵呵,你误解了
scalar的意思,就是一个数目.
只能是右边中的一个 [-1,1,2 (default) ,3,4,6,12]
那我的问题还是没有搞明白。
我要用多个债券信息,每个债券的年付息频率都不一样,在程序中要怎么体现呢。我把要处理的债券信息放在附件里了,您帮我看看吧,数据不多,就八个债券。

我是想用NS模型来处理这几个债券,年付息频率应该怎么考虑呢?非常感谢。

20111230.xls (29.5 KB)

8
aywinng 发表于 2012-4-8 00:28:50
epoh 发表于 2012-4-7 23:10
呵呵,你误解了
scalar的意思,就是一个数目.
只能是右边中的一个 [-1,1,2 (default) ,3,4,6,12]
哦,我终于搞明白了,是我自己模型没有看懂。

还想请教您一个问题,这个函数里面Maturity都是日期格式,可是我想换成数值,比如还有5年到期,就用数值5来代替。这个怎么实现呢。

9
epoh 发表于 2012-4-8 09:00:40
aywinng 发表于 2012-4-8 00:28
哦,我终于搞明白了,是我自己模型没有看懂。

还想请教您一个问题,这个函数里面Maturity都是日期格式 ...
如果你是作这方面的研究
请仔细看finfixed.pdf  page 128/549 的范例
你的数据型态就像ukdata20080430一样建立
日期转换参考page 21/549
Settle = [datenum('1-Feb-2000');
datenum('1-Feb-2000');
datenum('1-Feb-2000')];
Maturity = [datenum('1-Feb-2030')];

  Using the Nelson-Siegel Method to Fit an IRFunctionCurve Object.
  The Nelson-Siegel model represents a dynamic three-factor model: level,
  slope, and curvature. However, the Nelson-Siegel factors are unobserved, or
  latent, which allows for measurement error, and the associated loadings have
  economic restrictions (forward rates are always positive, and the discount
  factor approaches zero as maturity increases).

%%%%%%
load ukdata20080430
%Convert repo rates to be equivalent zero coupon bonds:
RepoCouponRate = repmat(0,size(RepoRates));
RepoPrice = bndprice(RepoRates, RepoCouponRate, RepoSettle, RepoMaturity);
%Aggregate the data:
Settle = [RepoSettle;BondSettle];
Maturity = [RepoMaturity;BondMaturity];
CleanPrice = [RepoPrice;BondCleanPrice];
CouponRate = [RepoCouponRate;BondCouponRate];
Instruments = [Settle Maturity CleanPrice CouponRate];
InstrumentPeriod = [repmat(0,6,1);repmat(2,31,1)];
CurveSettle = datenum('30-Apr-2008');
%fit Nelson-Siegel curve
NSModel = IRFunctionCurve.fitNelsonSiegel('Zero',CurveSettle,...
Instruments,'Compounding',-1,'InstrumentPeriod',InstrumentPeriod);

%Plot the Nelson-Siegel interest-rate curve for forward rates:
PlottingDates = CurveSettle+20:30:CurveSettle+365*25;
TimeToMaturity = yearfrac(CurveSettle,PlottingDates);
NSForwardRates = NSModel.getForwardRates(PlottingDates);
plot(TimeToMaturity,NSForwardRates)
title('Nelson Siegel model of UK instantaneous nominal forward curve')

已有 1 人评分学术水平 热心指数 信用等级 收起 理由
ywh19860616 + 5 + 5 + 5 非常赞同

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

10
aywinng 发表于 2012-4-8 12:22:11
epoh 发表于 2012-4-8 09:00
如果你是作这方面的研究
请仔细看finfixed.pdf  page 128/549 的范例
你的数据型态就像ukdata2008043 ...
非常感谢,我仔细研究一下。

另外一个菜鸟问题:finfixed.pdf 是什么呀?是帮助文档吗?从什么地方可以下载?

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

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