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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!