{"id":200073,"date":"2023-12-14T08:45:28","date_gmt":"2023-12-14T13:45:28","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=200073"},"modified":"2025-02-12T10:43:19","modified_gmt":"2025-02-12T15:43:19","slug":"r-using-differential-evolution-to-the-nelson-siegel-model","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/","title":{"rendered":"R: Using Differential Evolution to the Nelson-Siegel Model"},"content":{"rendered":"\n<p>This post demonstrates the application of Differential Evolution (DE) to estimate Nelson-Siegel parameters using the&nbsp;<strong>NMOF<\/strong>&nbsp;R package.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-differential-evolution-de\">Differential Evolution (DE)<\/h2>\n\n\n\n<p>Gilli et al. (2010) applied the Differential Evolution algorithm to the Nelson-Siegel (NS) or Nelson-Siegel-Svensson (NSS) model. The authors implemented and tested this optimization and showed that it is capable of reliably solving the numerical problem of the NS or NSS model.<\/p>\n\n\n\n<p>This DE optimization algorithm can be used from the R package, NMOF, and the authors kindly provided the R code in the appendix of their working paper. This allowed me to apply this code to some data and verify that the estimation results match those obtained using existing algorithms such as the Nelder-Mead.<\/p>\n\n\n\n<p>Following Gilli et al. (2010), there are two notational differences from what I have been accustomed to. First, maturity is expressed in years. Second, the time decay parameter is in reciprocal form, denoted as&nbsp;<img decoding=\"async\" width=\"15\" height=\"32\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/12\/Differential-Evolution-SHLee-AI-Financial-Model-1.png\" alt=\"\" class=\"wp-image-200075 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 15px; aspect-ratio: 15\/32;\">. Therefore, the NS model is represented as follow.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"600\" height=\"82\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/12\/Differential-Evolution-SHLee-AI-Financial-Model-2.png\" alt=\"\" class=\"wp-image-200076 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/12\/Differential-Evolution-SHLee-AI-Financial-Model-2.png 600w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/12\/Differential-Evolution-SHLee-AI-Financial-Model-2-300x41.png 300w\" data-sizes=\"(max-width: 600px) 100vw, 600px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; aspect-ratio: 600\/82;\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">R code<\/h3>\n\n\n\n<p>The following R code estimates the Nelson-Siegel parameters by using the DE.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#========================================================#\n# Quantitative Financial Econometrics &amp; Derivatives \n# ML\/DL using R, Python, Tensorflow by Sang-Heon Lee \n#\n# https:\/\/shleeai.blogspot.com\n#--------------------------------------------------------#\n# Estimating the Nelson-Siegel model \n# using Differential Evolution (DE)\n#========================================================#\n \ngraphics.off(); rm(list = ls())\nlibrary(NMOF) # Differential Evolution\n    \n#-----------------------------------------------\n# Objective function\n#-----------------------------------------------\n    OF &lt;- function(param, data) {\n        y &lt;- data$model(param, data$tm)\n        maxdiff &lt;- y - data$yM\n        \n        # max absolute error\n        # maxdiff &lt;- max(abs(maxdiff)) \n        \n        # Sum of Squares\n        maxdiff &lt;- sum(maxdiff^2) \n        \n        if (is.na(maxdiff))\n            maxdiff &lt;- 1e10\n        maxdiff\n    }\n        \n#=======================================================\n# 1. Read data\n#=======================================================\n    \n    # b1, b2, b3, lambda, RMSE for comparisons\n    ns_reg_para_rmse1 &lt;- c(\n        4.26219396, -4.08609206, -4.90893865,  \n        3.060792,  0.04883786)\n    ns_reg_para_rmse2 &lt;- c(\n        4.97628654, -4.75365297, -6.40263059,  \n        1.651215,  0.04157326)\n    \n    str.zero &lt;- \"\n        mat     rate1      rate2\n        3       0.0781     0.0591\n        6       0.1192     0.0931\n        9       0.1579     0.1270\n        12      0.1893     0.1654\n        24      0.2669     0.3919\n        36      0.3831     0.8192\n        48      0.5489     1.3242\n        60      0.7371     1.7623\n        72      0.9523     2.1495\n        84      1.1936     2.4994\n        96      1.4275     2.7740\n        108     1.6424     2.9798\n        120     1.8326     3.1662\n        144     2.1715     3.4829\n        180     2.5489     3.7827\n        240     2.8093     3.9696\"\n    \n    df &lt;- read.table(text = str.zero, header=TRUE)\n    m  &lt;- df$mat\n    y1 &lt;- df$rate1; y2 &lt;- df$rate2\n \n#=======================================================\n# 2. Estimation\n#=======================================================\n    \n    #-------------------------------------------------------\n    # NS estimation with 1st data\n    #-------------------------------------------------------\n    data &lt;- list(yM = y1,   # percent\n                 tm = m\/12, # in years\n                 model = NS,\n                 ww = 0.1,\n                 min = c( 0,-15,-30, 0),\n                 max = c(15, 30, 30,10)\n                 )\n    \n    f_penalty &lt;- function(mP, data) {\n        minV &lt;- data$min\n        maxV &lt;- data$max\n        ww &lt;- data$ww\n        ## if larger than maxV, element in A is positiv\n        A &lt;- mP - as.vector(maxV)\n        A &lt;- A + abs(A)\n        ## if smaller than minV, element in B is positiv\n        B &lt;- as.vector(minV) - mP\n        B &lt;- B + abs(B)\n        # ## beta 1 + beta2 > 0\n        C &lt;- ww*((mP[1L, ] + mP[2L, ]) - abs(mP[1L, ] + mP[2L, ]))\n        A &lt;- ww * colSums(A + B) - C\n        A\n    }\n    \n    algo &lt;- list(nP = 100L,  ## population size\n                 nG = 500L,  ## number of generations\n                 F = 0.50,   ## step size\n                 CR = 0.99,  ## prob. of crossover\n                 min = c( 0,-15,-30, 0),\n                 max = c(15, 30, 30,10),\n                 pen = f_penalty,\n                 repair = NULL,\n                 loopOF = TRUE,    ## loop over popuation? yes\n                 loopPen = FALSE,   ## loop over popuation? no\n                 loopRepair = TRUE, ## loop over popuation? yes\n                 printBar = FALSE)\n    \n    set.seed(90)\n    deopt &lt;- DEopt(OF = OF, algo = algo, data = data)\n    nsdtim_out1 &lt;- c(deopt$xbest, \n                     sqrt(deopt$OFvalue\/length(m)))\n    \n    #-------------------------------------------------------\n    # NS estimation with 2nd data\n    #-------------------------------------------------------\n    data$yM &lt;- y2\n    \n    f_penalty &lt;- function(mP, data) {\n        minV &lt;- data$min\n        maxV &lt;- data$max\n        ww &lt;- data$ww\n        ## if larger than maxV, element in A is positiv\n        A &lt;- mP - as.vector(maxV)\n        A &lt;- A + abs(A)\n        ## if smaller than minV, element in B is positiv\n        B &lt;- as.vector(minV) - mP\n        B &lt;- B + abs(B)\n       \n        # beta 1 + beta2 > 0 is not applied\n        \n        A &lt;- ww * colSums(A + B) \n        A\n    }\n    \n    # new penalty without beta 1 + beta2 > 0\n    algo$pen &lt;- f_penalty\n \n    set.seed(90)\n    deopt &lt;- DEopt(OF = OF, algo = algo, data = data)\n    nsdtim_out2 &lt;- c(deopt$xbest, \n                     sqrt(deopt$OFvalue\/length(m)))\n    \n#=======================================================\n# 3. Results and Comparisons\n#=======================================================\n    \n    ns_reg_para_rmse1\n    nsdtim_out1\n    \n    ns_reg_para_rmse2\n    nsdtim_out2<\/pre>\n\n\n\n<p>As can be seen in the following results, It seems that parameter estimates from the DE algorithm are the same as the benchmark results.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"713\" height=\"392\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/12\/Differential-Evolution-SHLee-AI-Financial-Model-3.png\" alt=\"\" class=\"wp-image-200077 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/12\/Differential-Evolution-SHLee-AI-Financial-Model-3.png 713w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/12\/Differential-Evolution-SHLee-AI-Financial-Model-3-700x385.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/12\/Differential-Evolution-SHLee-AI-Financial-Model-3-300x165.png 300w\" data-sizes=\"(max-width: 713px) 100vw, 713px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 713px; aspect-ratio: 713\/392;\" \/><\/figure>\n\n\n\n<p>I believe this approach is highly effective in terms of avoiding local minima and achieving fast convergence.<\/p>\n\n\n\n<p><strong>Reference<\/strong><\/p>\n\n\n\n<p>Gilli, M., S. Gro\u00dfe, and E. Schumann (2010). Calibrating the Nelson\u2013Siegel\u2013Svensson model. COMISEF Working Paper Series No. 31.<\/p>\n\n\n\n<p><em>Originally posted on <a href=\"https:\/\/shleeai.blogspot.com\/2023\/08\/r-using-differential-evolution-to.html\">SHLee AI Financial Model<\/a> blog.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post demonstrates the application of Differential Evolution (DE) to estimate Nelson-Siegel parameters using the NMOF R package.<\/p>\n","protected":false},"author":662,"featured_media":195313,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[343,338,341,342],"tags":[16418,16419,16420,16421,487,6591],"contributors-categories":[13728],"class_list":{"0":"post-200073","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-programing-languages","8":"category-ibkr-quant-news","9":"category-quant-development","10":"category-r-development","11":"tag-differential-evolution","12":"tag-nelson-siegel-parameters","13":"tag-nelson-siegel-svensson-nss-model","14":"tag-nmof-r-package","15":"tag-r","16":"tag-rstats","17":"contributors-categories-sh-fintech-modeling"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>R: Using Differential Evolution to the Nelson-Siegel Model<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/200073\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R: Using Differential Evolution to the Nelson-Siegel Model\" \/>\n<meta property=\"og:description\" content=\"This post demonstrates the application of Differential Evolution (DE) to estimate Nelson-Siegel parameters using the NMOF R package.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-14T13:45:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-12T15:43:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-sample-code-light-blue.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sang-Heon Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sang-Heon Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Sang-Heon Lee\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/0a959ff9de7f0465a07baa1fe1ae0200\"\n\t            },\n\t            \"headline\": \"R: Using Differential Evolution to the Nelson-Siegel Model\",\n\t            \"datePublished\": \"2023-12-14T13:45:28+00:00\",\n\t            \"dateModified\": \"2025-02-12T15:43:19+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/\"\n\t            },\n\t            \"wordCount\": 250,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/08\\\/r-programming-sample-code-light-blue.jpg\",\n\t            \"keywords\": [\n\t                \"Differential Evolution\",\n\t                \"Nelson-Siegel parameters\",\n\t                \"Nelson-Siegel-Svensson (NSS) model\",\n\t                \"NMOF R package\",\n\t                \"R\",\n\t                \"rstats\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Programming Languages\",\n\t                \"Quant\",\n\t                \"Quant Development\",\n\t                \"R Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/\",\n\t            \"name\": \"R: Using Differential Evolution to the Nelson-Siegel Model | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/08\\\/r-programming-sample-code-light-blue.jpg\",\n\t            \"datePublished\": \"2023-12-14T13:45:28+00:00\",\n\t            \"dateModified\": \"2025-02-12T15:43:19+00:00\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-using-differential-evolution-to-the-nelson-siegel-model\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/08\\\/r-programming-sample-code-light-blue.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/08\\\/r-programming-sample-code-light-blue.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Quant\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/0a959ff9de7f0465a07baa1fe1ae0200\",\n\t            \"name\": \"Sang-Heon Lee\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/sang-heonlee\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"R: Using Differential Evolution to the Nelson-Siegel Model","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/200073\/","og_locale":"en_US","og_type":"article","og_title":"R: Using Differential Evolution to the Nelson-Siegel Model","og_description":"This post demonstrates the application of Differential Evolution (DE) to estimate Nelson-Siegel parameters using the NMOF R package.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/","og_site_name":"IBKR Campus US","article_published_time":"2023-12-14T13:45:28+00:00","article_modified_time":"2025-02-12T15:43:19+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-sample-code-light-blue.jpg","type":"image\/jpeg"}],"author":"Sang-Heon Lee","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sang-Heon Lee","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/"},"author":{"name":"Sang-Heon Lee","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/0a959ff9de7f0465a07baa1fe1ae0200"},"headline":"R: Using Differential Evolution to the Nelson-Siegel Model","datePublished":"2023-12-14T13:45:28+00:00","dateModified":"2025-02-12T15:43:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/"},"wordCount":250,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-sample-code-light-blue.jpg","keywords":["Differential Evolution","Nelson-Siegel parameters","Nelson-Siegel-Svensson (NSS) model","NMOF R package","R","rstats"],"articleSection":["Programming Languages","Quant","Quant Development","R Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/","name":"R: Using Differential Evolution to the Nelson-Siegel Model | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-sample-code-light-blue.jpg","datePublished":"2023-12-14T13:45:28+00:00","dateModified":"2025-02-12T15:43:19+00:00","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-using-differential-evolution-to-the-nelson-siegel-model\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-sample-code-light-blue.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-sample-code-light-blue.jpg","width":1000,"height":563,"caption":"Quant"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/0a959ff9de7f0465a07baa1fe1ae0200","name":"Sang-Heon Lee","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/sang-heonlee\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-sample-code-light-blue.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/200073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/662"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=200073"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/200073\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/195313"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=200073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=200073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=200073"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=200073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}