I'm trying to fit a yield curve using Nelson Siegel through the R Yield Curve package. However, the
Nelson.Siegel() function only takes two inputs of yield and maturity with the definition of maturity below.
maturity: vector which contains the maturity ( in months) of the rate. The vector's length must be the same of the number of columns of the rate.
Since a yield curve, like in the United States, can have multiple bonds with the same maturity, but different coupons (and therefore different durations), should I be using durations of the bonds as the input for the maturity part of the function? The idea being that two bonds with different coupons, but the same maturity will have different durations and the yield curve should be a function of duration.
There is a Fed paper referenced below that aims to accomplish a similar goal where they use NSS and say
"As described above, we estimate the six parameters, using maximum likelihood, to minimize the sum of the squared deviations between the actual prices of Treasury securities and the predicted prices, where the prices are weighted by the inverse of the duration of the securities."
Unfortunately, it looks like the function only takes yields. Does anyone know of alternative packages that could accept prices (ie minimize price differences rather than yields)?