最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

R語(yǔ)言和QuantLib中Nelson-Siegel模型收益曲線(xiàn)建模分析

2021-03-17 09:01 作者:拓端tecdat  | 我要投稿

?原文鏈接:http://tecdat.cn/?p=11803?

Nelson-Siegel- [Svensson]模型是擬合收益曲線(xiàn)的常用方法。它的優(yōu)點(diǎn)是其參數(shù)的經(jīng)濟(jì)可解釋性,被銀行廣泛使用。但它不一定在所有情況下都有效:模型參數(shù)有時(shí)非常不穩(wěn)定,無(wú)法收斂。

納爾遜(Nelson)和西格爾(Siegel)在其原始論文中從遠(yuǎn)期利率入手,然后推導(dǎo)了收益率至到期曲線(xiàn)的公式.

Nelson-Siegel模型是簡(jiǎn)約的,可以生成豐富的收益曲線(xiàn)。

但是,由于簡(jiǎn)單地使用它,它通常失去了經(jīng)濟(jì)上的可解釋性,甚至無(wú)法收斂。


上圖顯示了這種情況。


  1. plot(MATURITY_BASES, oldYields

  2. lines(MATURITY_BASES, oldYields)

  3. points(newMats, newYields, col="blue")

  4. lines(newMats, newYields, col="blue")

此代碼模仿了一個(gè)頻繁使用的案例,當(dāng)前的收益曲線(xiàn)與昨天的曲線(xiàn)進(jìn)行了比較。從某種意義上講,這是一個(gè)簡(jiǎn)單示例,因?yàn)閷?duì)于給定的到期日,我們已經(jīng)具有零收益率。實(shí)際上,我們通常與票息債券有關(guān),這會(huì)使事情變得更加復(fù)雜。

您可能會(huì)認(rèn)為,由于軟件的實(shí)施而導(dǎo)致收斂失敗。我要講的不是不好的實(shí)現(xiàn),而是要高度依賴(lài)所使用的數(shù)值方法,如下面的更實(shí)際的示例所示。

提供更逼真的建模

  1. #include <ql/qldefines.hpp>

  2. #ifdef BOOST_MSVC

  3. #? include <ql/auto_link.hpp>

  4. #endif

  5. #include <ql/termstructures/yield/fittedbonddiscountcurve.hpp>

  6. #include <ql/termstructures/yield/piecewiseyieldcurve.hpp>

  7. #include <ql/termstructures/yield/flatforward.hpp>

  8. #include <ql/termstructures/yield/bondhelpers.hpp>

  9. #include <ql/termstructures/yield/nonlinearfittingmethods.hpp>



  10. using namespace QuantLib;


  11. int main(int, char*[]) {

  12. ????try {

  13. ????????Calendar calendar = NullCalendar();

  14. ????????Date today = Date(18, December, 2017);

  15. ????????Settings::instance().evaluationDate() = today;


  16. ????????//市場(chǎng)數(shù)據(jù)

  17. ????????double cleanPrices1[] = { 107.96, 135.88, 110.6,?? 133.46, 135.8,? 142.155, 121.045, 134.97, 117.04,

  18. ????????????101.61, 128.67, 106.615, 106.36, 99.515, 101.21,? 105.655, 114.828 };

  19. ????????double cleanPrices2[] = { 107.9,? 134.965, 110.37,? 132.89, 135.62,140.845, 120.585, 133.995, 116.745,

  20. ????????????101.58, 128.115,105.985, 105.395,99.385, 100.79,104.955, 114.7985 };

  21. ????????double cleanPrices3[] = { 107.96, 134.625, 110.58, 132.65, 135.145, 140.585, 120.385, 133.735, 116.635,

  22. ????????????101.62, 127.925, 105.6, 105.085, 99.29, 100.6, 104.945, 114.7415 };

  23. ????????double cleanPrices4[] = { 107.78, 134.39, 110.175, 132.445, 134.905, 139.515, 120.115, 133.475, 116.455,

  24. ????????????101.58, 127.845, 105.53,104.805, 99.07, 100.46, 104.885, 114.6225 };



  25. ????????std::vector<boost::shared_ptr<BondHelper> > bondHelpersA;

  26. ????????std::vector< boost::shared_ptr<SimpleQuote> > quoteA;

  27. ????????std::vector<boost::shared_ptr<BondHelper> > bondHelpersB;


  28. ????????for (Size i = 0; i < numberOfBonds; i++) {

  29. ????????????boost::shared_ptr<SimpleQuote> cp1(new SimpleQuote(cleanPrices1<em class="d4pbbc-italic"></em>));

  30. ????????????quoteA.push_back(cp1);

  31. ????????????boost::shared_ptr<SimpleQuote> cp2(new SimpleQuote(cleanPrices2<em class="d4pbbc-italic"></em>));

  32. ????????????quoteB.push_back(cp2);

  33. ????????????boost::shared_ptr<SimpleQuote> cp3(new SimpleQuote(cleanPrices3<em class="d4pbbc-italic"></em>));

  34. ????????????quoteC.push_back(cp3);

  35. ????????????boost::shared_ptr<SimpleQuote> cp4(new SimpleQuote(cleanPrices4<em class="d4pbbc-italic"></em>));

  36. ????????????quoteD.push_back(cp4);

  37. ????????}


  38. ????????RelinkableHandle<Quote> quoteHandleA[numberOfBonds];




  39. ????????//Nelson-Siegel模型擬合

  40. ????????Real tolerance = 1.0e-14;

  41. ????????Size max = 10000;


  42. ????????boost::shared_ptr<FittedBondDiscountCurve> tsA(

  43. ????????????new FittedBondDiscountCurve(curveSettlementDays,

  44. ????????????????calendar,

  45. ????????????????instrumentsA,

  46. ????????????????ActualActual(),

  47. ????????????????NelsonSiegelFitting(),

  48. ????????????????tolerance,

  49. ????????????????max));



  50. ????????boost::shared_ptr<FittedBondDiscountCurve> tsB(

  51. ????????????new FittedBondDiscountCurve(curveSettlementDays,

  52. ????????????????calendar,

  53. ????????????????instrumentsB,

  54. ????????????????ActualActual(),

  55. ????????????????NelsonSiegelFitting(),

  56. ????????????????tolerance,

  57. ????????????????max));


  58. ????????boost::shared_ptr<FittedBondDiscountCurve> tsC(

  59. ????????????new FittedBondDiscountCurve(curveSettlementDays,

  60. ????????????????calendar,

  61. ????????????????instrumentsC,

  62. ????????????????ActualActual(),

  63. ????????????????NelsonSiegelFitting(),

  64. ????????????????tolerance,

  65. ????????????????max));


  66. ????????boost::shared_ptr<FittedBondDiscountCurve> tsD(

  67. ????????????new FittedBondDiscountCurve(curveSettlementDays,

  68. ????????????????calendar,

  69. ????????????????instrumentsD,

  70. ????????????????ActualActual(),

  71. ????????????????NelsonSiegelFitting(),

  72. ????????????????tolerance,

  73. ????????????????max));


  74. ????????std::cout << tsA->fitResults().numberOfIterations() << std::endl;

  75. ????????std::cout << tsB->fitResults().numberOfIterations() << std::endl;

?


正式而言,收益曲線(xiàn)每天的變化并不顯著,但是模型參數(shù)卻可以:

?

Nelson-Siegel意識(shí)到了這些問(wèn)題,并提供了解決這些問(wèn)題的方法。特別是,他們考慮了Taus的時(shí)間序列,并確定了Taus的最佳擬合值的中值和合理范圍。
但是,與往常一樣,原始論文被引用的次數(shù)可能多于閱讀次數(shù)。此外,如果需要按時(shí)間順序排列的收益率數(shù)據(jù),可能會(huì)感到困惑,而不是僅僅考慮相關(guān)日期的數(shù)據(jù)。即使處理時(shí)間序列不是問(wèn)題,Nelson和Siegel也沒(méi)有指定正式的算法來(lái)選擇的最佳值。

?

最受歡迎的見(jiàn)解

1.在python中使用lstm和pytorch進(jìn)行時(shí)間序列預(yù)測(cè)

2.python中利用長(zhǎng)短期記憶模型lstm進(jìn)行時(shí)間序列預(yù)測(cè)分析

3.使用r語(yǔ)言進(jìn)行時(shí)間序列(arima,指數(shù)平滑)分析

4.r語(yǔ)言多元copula-garch-模型時(shí)間序列預(yù)測(cè)

5.r語(yǔ)言copulas和金融時(shí)間序列案例

6.使用r語(yǔ)言隨機(jī)波動(dòng)模型sv處理時(shí)間序列中的隨機(jī)波動(dòng)

7.r語(yǔ)言時(shí)間序列tar閾值自回歸模型

8.r語(yǔ)言k-shape時(shí)間序列聚類(lèi)方法對(duì)股票價(jià)格時(shí)間序列聚類(lèi)

9.python3用arima模型進(jìn)行時(shí)間序列預(yù)測(cè)

?


R語(yǔ)言和QuantLib中Nelson-Siegel模型收益曲線(xiàn)建模分析的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
吴桥县| 景谷| 堆龙德庆县| 大足县| 平罗县| 长泰县| 乌拉特后旗| 根河市| 手游| 海原县| 南乐县| 丽江市| 肇庆市| 绩溪县| 科技| 商南县| 蓝田县| 民县| 舞钢市| 宜昌市| 临桂县| 固始县| 富民县| 都江堰市| 铜梁县| 兴化市| 嘉善县| 孟村| 凌云县| 合作市| 那坡县| 安庆市| 衢州市| 临安市| 辽宁省| 新化县| 长兴县| 双流县| 苗栗市| 朝阳区| 娱乐|