%%HP:T(3)F(.);

@ PBGCANN - Programs for calculating PBGC annuities and lump sums.
@
@ When downloaded, this file creates a directory containing the
@ following functions for calculating PBGC deferred annuities.
@ QLIB/48 must be installed before you download the file.
@
@    PB100(x,r,n,m) = n-year certain and life annuity payable (m)thly;
@                     deferred from age x to age r with PBGC deferral rates
@    PB120(x,r,n,m) = PBGC annuity using 120% of the PBGC interest rates
@    LS(x,r,n,m,b)  = PBGC lump sum at age x for an n-year C&L annuity
@                     deferred to age r, paying $b per year
@
@ Notes:
@
@ - The above utilities all assume that the QLIB/48 X mortality table
@   and setback have been set, and the current interest rate is the
@   desired PBGC immediate rate.
@
@ - PB100 and PB120 return annual annuity factors for an annuity payable
@   (m)thly; that is, you would multiply the factors by the annual benefit,
@   not the (m)thly benefit, to get the lump sum present value.  This is
@   the same way the built-in QLIB/48 annuity functions like CLMX work.
@
@ - The factors are for benefits payable at the beginning of each (m)th.
@   For annuities payable at the END of each (m)th, use -m.  For
@   example, for a 100% annuity payable at the end of each month, you
@   would use PB100(x,r,n,-12).
@
@ - The annuity factors are calculated following the PBGC rules for deferred
@   annuities.  After benefit commencement, the payments are discounted using
@   the PBGC immediate interest rate.  For the deferral period, the PBGC
@   deferral interest rates are used: the immediate rate less 0.75% for the
@   first 7 years, the immediate rate less 2% for the next 8 years, and 4%
@   (or the immediate rate, if lower)  for the remaining years of the deferral
@   period.  None of the deferral rates are permitted to go below the final
@   rate.  For 120% factors, all four interest rates are increased 20%.
@
@ - The annuity payments are discounted for mortality in both the payment
@   period and the deferral period.  To remove the discounting for mortality
@   in the deferral period, remove the multiplication by the ratio of lX's in
@   the IFERR section of $PBANNF.
@
@ - If x>=r, an immediate annuity at age x is returned.
@

DIR



PB100
\<< \-> x r n m \<<
   x r n m 1.00 $PBANNF
   \>>
\>>



PB120
\<< \-> x r n m \<<
   x r n m 1.20 $PBANNF
   \>>
\>>



LS
\<< \-> x r n m b \<<
   @ Note: The 120% lump sum is computed first, under the assumption that
   @ in most cases this will be the correct lump sum.  If this is the case,
   @ then the calculation can stop and prevent the necessity for another
   @ recalculation of the assumptions.
   x r n m PB120 b * @ PBGC LS with 120% int.
   IF DUP 25000 < THEN
      DROP @ get rid of LS at 120% int. -- it's too small
      x r n m PB100 b * @ LS at 100% int.
      25000 MIN @ LS can be at most $25,000
      END
   \>>
\>>



$PBANNF @ compute a 100f% PBGC annuity factor
\<< \-> x r n m f \<<

   x r MAX 'r' STO @ set r=x if x>r

   @ Calculate deferred annuity at QINT*f interest
   @ Error trapping is used in case an error occurs before interest rate gets
   @ changed back.
   QINT \-> orgint \<<
      IFERR
         orgint f * QINTSTO @ rate to use for calcs
         r n m CLMX @ C&L annuity at retirement age r
         r lX x lX / * @ discount for mortality during deferral period
         @ Remove the above line to discount for interest only during the
         @ the deferral period.
         orgint QINTSTO @ restore interest rate
      THEN
         @ error occurred; restore interest rate and stop
         orgint QINTSTO
         ERRN DOERR @ report error to user and stop
      END
      \>>

   @ At this point, stack level 1 contains the deferred annuity with no
   @ interest in the deferral period.  The code below adds the appropriate
   @ interest to the deferral period, using graded PBGC interest rates.
   @ Note that QINT below refers to the original interest rate, before
   @ application of the 120% (f) factor if it applies.

   QINT .0075 - .04 MAX QINT MIN f * 1 + @ int. for first 7 years
   r x - 0 MAX 7 MIN @ years at (i-.75%)f int.
   ^ / @ def. anty with interest for up to 7 years in deferral period

   QINT .02 - .04 MAX QINT MIN f * 1 + @ int. for next 8 years
   r x - 7 - 0 MAX 8 MIN @ years of int. at (i-2%)f int.
   ^ / @ def. anty with interest for up to 15 years in deferral period

   QINT .04 MIN f * 1 + @ int for remaining years
   r x - 15 - 0 MAX @ years at 4%f int.
   ^ / @ deferred anty with correct interest in deferral period

   @ Stack level 1 now contains the desired annuity factor.
   \>>
\>>
