楼主: denlison1983
2665 1

[求助]建构各天期公债殖利率的程序(Svensson model) [推广有奖]

  • 0关注
  • 0粉丝

初中生

9%

还不是VIP/贵宾

-

威望
0
论坛币
64 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
156 点
帖子
5
精华
0
在线时间
0 小时
注册时间
2008-9-18
最后登录
2008-12-31

楼主
denlison1983 发表于 2008-9-22 00:21:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币

请问有人有写过建构各天期公债殖利率的程序吗?是Svensson(1994)

在Nelson-Siegel model多加一个额外的驼峰,请大家帮个忙,谢谢。

二维码

扫码加我 拉你入群

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

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

关键词:Svensson model mode son ODE 利率 程序 model 公债 Svensson

沙发
DM小菜鸟 发表于 2015-1-22 22:06:27
Nelson-Siegel model用的是YieldCurve包 Nelson.Siegel()函数  
不过你要Svensson model,那就用OptionsPdf包 OptionsPdf-package()

#strike prices
X <- matrix( c(92.00, 94.00, 94.50, 95.00, 95.50, 96.00, 96.50, 97.00,
        97.50, 98.00, 98.50, 99.00, 99.50, 100.0, 100.5, 101.0,
        101.5, 102.0, 102.5, 103.0, 103.5 ) )
        
#call prices; Mx1 vector
C <- matrix( c( 5.13,   3.25,   2.83,   2.40,  2.00,  1.64,   1.31,   1.02,
        0.770,  0.570,  0.400,  0.280,  0.190, 0.130, 0.0800, 0.0500,
        0.0400, 0.0300, 0.0200, 0.0100, 0.0100 ) )

#Forward price, scalar or Mx1 vector
F <- 97.05               

#time to expiry in years, scalar
k <- 48/365               

#Interest rate: LIFFE margining&lt;-&gt;no discounting
r <- 0                    

#weight matrix for price errors
W <- diag( length(F)+length(X) )  


#  Two states: solving for 2 means, 2 standard deviations, and
#  one probability of the first normal distribution.
#  Estimation: (a) Assuming a probability and then optimizing wrt.
#                     mean1, mean2, std1, and std2.
#                     (b) (a) is repeated for (Nprob) different values of
#                     the probability between 0.01 and 0.49.
#  Uses forward rate and option data.
  
#initial parameter guess
par0 <- c(4.58, 4.58, 0.025, 0.005)  

#Number of different probabilites in [0.01,0.49] to try
#NProb x 5 matrix to store loop results in NProb <- 43         
                     
#probabilities to try   
Prob   <- matrix(c( linspace(0.03,0.47,NProb) ))   
Par2M  <- repmat( NaN,NProb,4)

#NProb x 1 vector to store loss fn values
Loss2M <- repmat( NaN,NProb,1 )   

i <- 1;                              
  #looping over different probabilities
  for (i in 1:NProb) {

        #[Prob(i);1-Prob(i)][[PROB(i)的1-PROB(ⅰ)]]
        Probi <- matrix(c( Prob, 1-Prob ) )
  
        results2 <- optim(par0, OptionMixLNormLoss,
                        gr=NULL, Probi, k, r, X, F, C, W)

        Par2M[i,] <- t(c( results2$par ))
        Loss2M <- t(c( results2$value ))
  }

  #index of iteration with minimum loss
  MinLossIndex <- find( Loss2M==min(Loss2M) )

  #Parameters at minimum loss
  par2 <- matrix(c(Par2M[MinLossIndex,], Prob[MinLossIndex]))

  S <- linspace(4.47, 4.68, 100)

  pdf2 <- MixedNormalPdf( matrix(S), matrix(c(par2[1:2])),
                matrix(c(par2[3:4]^2)), matrix(c(par2[5],1-par2[5])) )

  plot( S, pdf2$pdf, type="b", col="red",  xlab="log Bund price",
                main="Pdf from LIFFE Bunds option data, 6 April 1994 - 2")   

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

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