Answered step by step
Verified Expert Solution
Question
1 Approved Answer
financial markets and instrument valuation I need the entire hole R code, please. Check with R how accurate the price approximations are when there are
financial markets and instrument valuation
I need the entire hole R code, please.
Check with R how accurate the price approximations are when there are variations in the rate of return for the following bond: - Face value $10,000 - Coupon rate 4.5% annual effective - Redemption value $10,000 - Rate of return 10% effective per year - Maturation 30 years Following the following steps: a) Create a function that calculates the price of the bond and store the value in the variable P. b) Create a function that calculates the modified duration of the bond and saves the value in the variable DM. (Remember that DM=1+iD ) c) Create a function that calculates the convexity of the bond and store the value in the variable C. d) Define a variable that contains the rate changes of 5% as follows: h=seq( rom =0.05, to =0.05, by =0.00001) Add the changes to the interest rate and store it in a vector called i_h (in R code: ih=0.1+h) e) Calculate the price vector for the rate vector i h and store it in the variable var price. Computes the vector of price approximations with modified duration as: aprox_dur =P[1hDM] Computes the vector of price approximations with duration and convexity as: aprox_d_c =P[1hDM+C2h2] f) Graph (h,var price), (h,aprox dur), (h,aprox d c). g) Use R's lines() function to look at all 3 in a single graph. h) What do vou observe? Give a small explanation of the shape of the curvesStep 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