interpolation - How to get specific fitted value of corresponding x in ycinterextra package in R -


i new r please keep in mind :) using package ‘ycinterextra’ , interpolating yield curve several methods. example,

maturity<- c(1,2,5,10) yield<- c(0.39,0.61,1.66,2.58) t<-seq(from=min(maturity), to=max(maturity), by=0.01)  yc <- ycinter(ym = yield, matsin = maturity, matsout = t, method="sw",typeres="rates") fitted(yc) 

i know how fitted(yc), don't know how 1 value specific maturity. example if interested in 4-year yield or 1.5-year yield? need 1 value correspond specific t (any).

thansk in advance!

not sure if understood correctly , old question, here think should do. match value t , find fitted values.

as.numeric(fitted(yc))[match(4.5,t)] [1] 1.460163 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -