+1 (208) 254-6996 [email protected]

financial problem in R Studio

R-programming assignment:

Don't use plagiarized sources. Get Your Custom Essay on
RStudio Program
Just from $13/Page
Order Essay

1) Open a new R-script and create R commands for the following questions.

(a) Create a function that can value a semi-annual bond using the traditional approach.

The formula is

SemiAnnCoupBond <- function(C,r,N,M){



(b) Using the function from (a), compute a 6% semiannual coupon security maturing in 5 years. Assume that the discount rate is 8%. $1000 fixed income market.

(c) Using the function from (a) and the example in (b), draw a plot that shows the price/discount relationship (Hint: your result should be similar to a plot in Exhibit 4.1 (pp.85)).

Diagram  Description automatically generated

(d) Create another function that is able to value a bond following the arbitrage-free valuation approach.

AnnCoupBond1 <- function(C,r,N,M){

PVC = C*sum(1/(1+r)^(1:N))

PVM = M*1/(1+r)^N



(e) Using the function from (d), compute a 6% 15-year semi-annual bond price based on spot rates in Exhibit 4.8 on page 99.Table  Description automatically generated

(f) Provide your R command that is able to plot a chart in Exhibit 4.3. Note that use information in Exhibit 4.2.

Chart, line chart  Description automatically generated
Table  Description automatically generated

Order your essay today and save 10% with the discount code ESSAYHELP