我是R的新手所以请记住这一点:) 我目前正在使用包'ycinterextra'并用几种方法插值收益率曲线。例如,
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)
我知道如何安装(yc),但我不知道如何获得特定成熟度的一个值。例如,如果我对4年期收益率或1。5年收益率感兴趣?我需要的只是一个与特定t(任何)相对应的值。
Thansk提前!
答案 0 :(得分:0)
不确定我是否理解正确且非常古老的问题,但这是我认为你应该做的。只需匹配t
中的值,然后根据拟合值找到它。
as.numeric(fitted(yc))[match(4.5,t)]
[1] 1.460163