Évaluation et analyse des obligations avec R
Clifford Ang
Senior Vice President, Compass Lexecon
uniroot() dans R pour automatiserytm <- function(cf) {
uniroot(bval, c(0, 1), cf = cf)$root
}
ytm() avec uniroot()cf) et utilise bvalc(0,1) borne la recherche à 0 %–100 %cf <- c(-92.64, 5, 5, 5, 5, 5, 5, 5, 5, 5, 105)
bval <- function(i, cf, t = seq(along = cf)) sum(cf / (1 + i)^t)
bval() utilisant le vecteur de flux modifié (cf)bondprc()t)i)Évaluation et analyse des obligations avec R