I have the following data:
mat <- c(88.96438,21.20548,53.06301,76.89863,112.99726,83.96712,119.80274,53.06301 ,112.99726,53.06301)
ytm <- c(0.09380442,0.07378878,0.08823629,0.09428388,0.10381418,0.09652231 ,0.10485382,0.08865775,0.10345890,0.09040975)
Where $mat$ are bond maturities (in months, as the function requires) and $ytm$ are the corresponding yields (in years).
I get however the following error when performing the estimation:
Nelson.Siegel(rate=ytm, maturity = mat)
Error in seq.default(maturity[1], maturity[pillars.number], by = 0.5) :
wrong sign in 'by' argument
Can anyone please tell me why?
Thanks