#========================================================# # Quantitative ALM, Financial Econometrics & Derivatives # ML/DL using R, Python, Tensorflow by Sang-Heon Lee # # https://kiandlee.blogspot.com #——————————————————–# # Nelson-Siegel fitted yield curve using rjags #========================================================# graphics.off() # clear all graphs rm(list = ls()) # remove all files from your workspace library(rjags) library(coda) # Prepare data mat – c(3, 6, 9, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 144, 180, 240) yield – c(5.638781, 5.857775, 6.062339, 6.232739, 6.533613, 6.586592, 6.604274, 6.672092, 6.643833, 6.636791, 6.621937, 6.608467, 6.608286, 6.631803, 6.640675, 6.569184) vnm – c(“beta0”,“beta1”,“beta2”,“la”,“sigma”) Data – list(x = mat, y = yield) # for use inside model Data$y_short – yield[1] Data$y_long – yield[16] Data$y_mid – yield[6] # Model string jags.script – “ model{ # priors beta0 ~ dnorm(y_long,0.01) … Read more