Displaying 1 result from an estimated 1 matches for "matrizpv".
Did you mean:
matriz
2011 Feb 09
1
help with operations inside matrix
...;
#start
rm(list=ls())
#test
yrt <- c(0.065,0.069,0.075,0.082)
coupon <- c(0.06, 0.07, 0.08, 0.09, 0.1, 0.11, 0.12)
term <- c(2:7)
#test#
PV <- function(coupon, term)
{
PV <- sum(coupon/(1+yrt)^(1:term)) + 1/((1+yrt[term])^term)
}
matrizPV <- matrix(, nrow=6, ncol=6)
for (j in 1:6)
{
for (i in 1:6)
{
matrizPV[i, j] = PV(coupon[i], term[j])
}
}
I would appreciate any help or advice received,
greetings
--
View this message in context: http://r.789695.n4.nab...