0

Im trying to estimate the present value of a stream of payments using the fvm in the financial package.

y <- tvm(pv=NA,i=2.5,n=1:10,pmt=-c(5,5,5,5,5,8,8,8,8,8))

The result that I obtain is:

y

Time Value of Money model

    I% #N    PV FV PMT Days #Adv P/YR C/YR
1  2.5  1  4.99  0  -5   30    0   12   12
2  2.5  2  9.97  0  -5   30    0   12   12
3  2.5  3 14.94  0  -5   30    0   12   12
4  2.5  4 19.90  0  -5   30    0   12   12
5  2.5  5 24.84  0  -5   30    0   12   12
6  2.5  6 47.65  0  -8   30    0   12   12
7  2.5  7 55.54  0  -8   30    0   12   12
8  2.5  8 63.40  0  -8   30    0   12   12
9  2.5  9 71.26  0  -8   30    0   12   12
10 2.5 10 79.09  0  -8   30    0   12   12

There is a jump in the PV from 5 to 6 (when the price changes to 8) that appears to be incorrect. This affects the result in y[10,3] which is the result that I'm interested in obtaining.

The NPV formula in Excel produces similar results when the payments are the same throughout the whole stream, however, when the vector of paymets is variable, the resuls with the tvm formula and the NPV differ. I need to obtain the same result that the NPV formula provides in Excel.

What should I do to make this work?

Andrie
  • 176,377
  • 47
  • 447
  • 496
FAC
  • 193
  • 1
  • 1
  • 6
  • it's been a while since I used `tvm()`, but I think you have modelled 10 different scenarios, ranging from 1 to 10 years, not one scenario over 10 years with different payments. – Andrie May 25 '12 at 16:35
  • I think you need to use `cf()`, not `tvm()`. – Andrie May 25 '12 at 16:58
  • The cf formula helps but does not give me the same result as Excel. I solved my problem using the following function: npv<-function(a,b,c) sum(a/(1+b)^c) – FAC May 25 '12 at 18:28
  • I suggest you post that as an answer to your own question. – Andrie May 25 '12 at 18:57

1 Answers1

0

The cf formula helps but it is not always consistent with Excel.

I solved my problem using the following function:

npv<-function(a,b,c) sum(a/(1+b)^c) 
Jason Sturges
  • 15,855
  • 14
  • 59
  • 80
FAC
  • 193
  • 1
  • 1
  • 6