title: Calculate the payment for the interest rate effective per period
body: <p>I have one fibo.seq function and try to write a program with three arguments: one called n (with no default value), one called i (with no default value), and one called arrears (with default value set to TRUE). assume that n≥3.</p>
  <p>Present Value of a stream of n payments F1,F2,…,Fn , where the kth payment Fk corresponds to the kth number in the Fibonacci sequence (1≤k≤n), and where payments happen at regular time intervals.</p>
  <p>The interest rate effective per period is equal to argument i. Example: if i=0.05, the rate of interest effective per period is 5%.</p>
  <p>If arguments arrears=TRUE, then the first payment happens at the end of the first period. Otherwise, the first payment happens immediately.</p>
  <p>I can call a function (e.g. fibo.seq) for fibonacci sequence</p>
  <p>Clarification (added on 03/10/2020): fibo.PV must return the total Present Value of payments (i.e. a single number).</p>
  <p>Can we use the annuity for it?</p>
  <pre><code>fibo.PV &lt;- function(n, i, arrears=TRUE) {
    if (arrears) {
      PV &lt;- numeric(n)
      PV &lt;- annuity(i=0.05, n=5, type=&quot;immediately&quot;)
    } else {
      PV &lt;- annuity(i=0.06/12, n=5*12)
    }
    return(PV)
  }
  </code></pre>