Question
USING R CODE/SCRIPT Suppose you are investing in a bond that has $1,091.5946 of current bond price, 5% of annual coupon rate, 5 years to
USING R CODE/SCRIPT Suppose you are investing in a bond that has $1,091.5946 of current bond price, 5% of annual coupon rate, 5 years to maturity, and 3% of yield (discount rate).
So, I have written these codes to calculate par value for you.
# Create time t
t <- seq(1, 5, 1)
# Create present value factor
pv_factor <- 1 / (1 + 0.03)^t
# Coupon rate times pv_factor
c_pv_factor <- 0.05 * pv_factor
# Current bond price
bond_value <- 1091.5946
# Par value par <- bond_value / (sum(c_pv_factor) + (1 / (1+0.03)^5))
par [1] 1000
Referring to the codes above, create your own function to calculate par value. That is, you have to complete the body of the following function (bond_value: current bond price, c: annual coupon rate, ttm: time to maturity, and y: yield).
par <- function (bond_value, c, ttm, y) {
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started