Learn R Programming

RTL (version 1.0.0)

npv: NPV

Description

Computes NPV with discount factor interpolation. This function is used for teaching NPV and NPV at Risk and needs to be customized.

Usage

npv(
  init.cost = -375,
  C = 50,
  cf.freq = 0.25,
  TV = 250,
  T2M = 2,
  disc.factors = us.df,
  BreakEven = FALSE,
  BE.yield = 0.01
)

Arguments

init.cost

Initial investment cost

C

Periodic cash flow

cf.freq

Cash flow frequency in year fraction e.g. quarterly = 0.25

TV

Terminal Value

T2M

Time to Maturity in years

disc.factors

Data frame of discount factors using ir.df.us() function.

BreakEven

TRUE when using a flat discount rate assumption.

BE.yield

Set the flat IR rate when BreakEven = TRUE.

Value

List of NPV and NPV Data frame

Examples

Run this code
# NOT RUN {
us.df <- ir_df_us(quandlkey = quandlkey, ir.sens = 0.01)
npv(
  init.cost = -375, C = 50, cf.freq = .5, TV = 250, T2M = 2,
  disc.factors = us.df, BreakEven = TRUE, BE.yield = .0399
)$npv
npv(
  init.cost = -375, C = 50, cf.freq = .5, TV = 250, T2M = 2,
  disc.factors = us.df, BreakEven = TRUE, BE.yield = .0399
)$df
# }

Run the code above in your browser using DataLab