lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [4868] Redefine 'MaxMonthlyCoiRate' and 'NAARDiscount' as


From: Greg Chicares
Subject: [lmi-commits] [4868] Redefine 'MaxMonthlyCoiRate' and 'NAARDiscount' as reciprocals
Date: Wed, 28 Apr 2010 12:31:25 +0000

Revision: 4868
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4868
Author:   chicares
Date:     2010-04-28 12:31:24 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Redefine 'MaxMonthlyCoiRate' and 'NAARDiscount' as reciprocals

Modified Paths:
--------------
    lmi/trunk/dbnames.xpp
    lmi/trunk/ihs_basicval.cpp
    lmi/trunk/ihs_dbdict.cpp
    lmi/trunk/mec_server.cpp
    lmi/trunk/mortality_rates_fetch.cpp

Modified: lmi/trunk/dbnames.xpp
===================================================================
--- lmi/trunk/dbnames.xpp       2010-04-27 23:40:52 UTC (rev 4867)
+++ lmi/trunk/dbnames.xpp       2010-04-28 12:31:24 UTC (rev 4868)
@@ -73,7 +73,7 @@
 {DB_MCoiIsAnnual,DB_Topic_MortalityCharges,"MCoiIsAnnual","Midpoint cost of 
insurance table rates are: 0=monthly, 1=annual [not used--calculated as mean of 
current and guaranteed]",}, \
 {DB_COINYMinTable,DB_Topic_MortalityCharges,"COINYMinTable","New York minimum 
mortality table (index in mortality table database) [not yet implemented]",}, \
 {DB_UseNYCOIFloor,DB_Topic_MortalityCharges,"UseNYCOIFloor","Dynamically 
increase cost of insurance rates to COINYMinTable wherever they would otherwise 
be lower [not yet implemented]",}, \
-{DB_MaxMonthlyCoiRate,DB_Topic_MortalityCharges,"MaxMonthlyCoiRate","Maximum 
monthly COI rate per $1 of specified amount",}, \
+{DB_MaxMonthlyCoiRate,DB_Topic_MortalityCharges,"MaxMonthlyCoiRate","Reciprocal
 of maximum monthly COI rate per $1 of specified amount, e.g. 12.0 (typically 
the maximum is specified as a reciprocal such as 1/12)",}, \
 {DB_GuarCOICeiling,DB_Topic_MortalityCharges,"GuarCOICeiling","Dynamically 
decrease current cost of insurance rates to guaranteed wherever they would 
otherwise be higher [not yet implemented]",}, \
 {DB_COIGuarIsMin,DB_Topic_MortalityCharges,"COIGuarIsMin","[not used]",}, \
 {DB_SubstdTblMult,DB_Topic_MortalityCharges,"SubstdTblMult","Substandard 
table-rating multiplier applied to both guaranteed and current cost of 
insurance and term rider charges (also multiplied by 'SubstdTblMultTable')",}, \
@@ -84,10 +84,10 @@
 
{DB_AllowMortBlendSmoke,DB_Topic_MortalityCharges,"AllowMortBlendSmoke","Mortality
 rating can be blended by smoking/tobacco use: 0=no, 1=yes",}, \
 {DB_Topic_Interest,DB_FIRST,"Interest","Interest rates, limits, spreads, and 
bonuses",}, \
 {DB_GuarInt,DB_Topic_Interest,"GuarInt","Guaranteed interest rate",}, \
-{DB_NAARDiscount,DB_Topic_Interest,"NAARDiscount","Net amount at risk discount 
rate e.g. 1.0 / 1.00246627 for 3% annual rate",}, \
-{DB_GuarIntSpread,DB_Topic_Interest,"GuarIntSpread","Guaranteed interest 
spread e.g. .02 = 200bp [not yet implemented]",}, \
+{DB_NAARDiscount,DB_Topic_Interest,"NAARDiscount","Monthly rate (i over i 
upper 12) for discounting net amount at risk, e.g. 0.00246627 for 3% annual 
rate (because that's how it's often specified in contracts)",}, \
+{DB_GuarIntSpread,DB_Topic_Interest,"GuarIntSpread","Guaranteed interest 
spread, e.g. .02 = 200bp [not yet implemented]",}, \
 {DB_GuarMandE,DB_Topic_Interest,"GuarMandE","Guaranteed M&&E charge",}, \
-{DB_CurrIntSpread,DB_Topic_Interest,"CurrIntSpread","Current interest spread 
e.g. .01 = 100bp",}, \
+{DB_CurrIntSpread,DB_Topic_Interest,"CurrIntSpread","Current interest spread, 
e.g. .01 = 100bp",}, \
 {DB_CurrMandE,DB_Topic_Interest,"CurrMandE","Current M&&E charge",}, \
 {DB_GAIntBonus,DB_Topic_Interest,"GAIntBonus","Interest bonus added to the 
general account rate",}, \
 {DB_BonusInt,DB_Topic_Interest,"BonusInt","Bonus interest [not yet 
implemented]",}, \
@@ -227,7 +227,7 @@
 {DB_AllowPrefLoan,DB_Topic_Loans,"AllowPrefLoan","Preferred loans permitted: 
0=no, 1=yes [preferred loans not yet supported]",}, \
 {DB_AllowFixedLoan,DB_Topic_Loans,"AllowFixedLoan","Fixed-rate loans 
permitted: 0=no, 1=yes",}, \
 {DB_AllowVLR,DB_Topic_Loans,"AllowVLR","Variable-rate loans permitted: 0=no, 
1=yes",}, \
-{DB_FixedLoanRate,DB_Topic_Loans,"FixedLoanRate","Fixed loan rate e.g. .06 = 
6%",}, \
+{DB_FixedLoanRate,DB_Topic_Loans,"FixedLoanRate","Fixed loan rate, e.g. .06 = 
6%",}, \
 {DB_MaxVLRRate,DB_Topic_Loans,"MaxVLRRate","Maximum variable loan rate [not 
yet implemented]",}, \
 {DB_MaxLoanAVMult,DB_Topic_Loans,"MaxLoanAVMult","Maximum loan as proportion 
of account value, e.g. 1=100%",}, \
 {DB_MaxLoanDed,DB_Topic_Loans,"MaxLoanDed","Monthiversary deductions reflected 
in maximum loan: 0=12 times most recent, 1=to next anniversary, 2=to next modal 
premium due date, 3=18 times most recent",}, \

Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp  2010-04-27 23:40:52 UTC (rev 4867)
+++ lmi/trunk/ihs_basicval.cpp  2010-04-28 12:31:24 UTC (rev 4868)
@@ -37,6 +37,7 @@
 #include "database.hpp"
 #include "dbnames.hpp"
 #include "death_benefits.hpp"
+#include "et_vector.hpp"
 #include "global_settings.hpp"
 #include "ihs_dbdict.hpp"
 #include "ihs_funddata.hpp"
@@ -61,7 +62,6 @@
 #include <cmath>                 // std::pow()
 #include <cstring>               // std::strlen(), std::strncmp()
 #include <fstream>
-#include <functional>
 #include <limits>
 #include <numeric>
 #include <sstream>
@@ -457,16 +457,10 @@
 void BasicValues::Init7702()
 {
     Mly7702qc = GetIRC7702Rates();
-    // ET !! Mly7702qc = coi_rate_from_q(Mly7702qc, 
Database_->Query(DB_MaxMonthlyCoiRate));
-    std::transform
-        (Mly7702qc.begin()
-        ,Mly7702qc.end()
-        ,Mly7702qc.begin()
-        ,std::bind2nd
-            (coi_rate_from_q<double>()
-            ,Database_->Query(DB_MaxMonthlyCoiRate)
-            )
-        );
+    double max_coi_rate = Database_->Query(DB_MaxMonthlyCoiRate);
+    LMI_ASSERT(0.0 != max_coi_rate);
+    max_coi_rate = 1.0 / max_coi_rate;
+    assign(Mly7702qc, apply_binary(coi_rate_from_q<double>(), Mly7702qc, 
max_coi_rate));
 
     MlyDcvqc = Mly7702qc;
     std::transform
@@ -614,14 +608,7 @@
         ,i_upper_12_over_12_from_i<double>()
         );
 
-    // ET !! Mly7702ig = -1.0 + 1.0 / DBDiscountRate;
-    Mly7702ig = DBDiscountRate;
-    std::transform(Mly7702ig.begin(), Mly7702ig.end(), Mly7702ig.begin(),
-          std::bind1st(std::divides<double>(), 1.0)
-          );
-    std::transform(Mly7702ig.begin(), Mly7702ig.end(), Mly7702ig.begin(),
-          std::bind2nd(std::minus<double>(), 1.0)
-          );
+    Database_->Query(Mly7702ig, DB_NAARDiscount);
 
     // TODO ?? We should avoid reading the rate file again; but
     // the GPT server doesn't initialize a MortalityRates object
@@ -780,6 +767,12 @@
     Database_->Query(FreeWDProportion, DB_FreeWDProportion);
 
     Database_->Query(DBDiscountRate, DB_NAARDiscount);
+    LMI_ASSERT(DBDiscountRate.end() == std::find(DBDiscountRate.begin(), 
DBDiscountRate.end(), -1.0));
+// This would be more natural:
+//    assign(DBDiscountRate, 1.0 / (1.0 + DBDiscountRate));
+// but we avoid it for the nonce because it causes slight regression errors.
+    assign(DBDiscountRate, 1.0 + DBDiscountRate);
+    assign(DBDiscountRate, 1.0 / DBDiscountRate);
 
     Database_->Query(AssetComp , DB_AssetComp);
     Database_->Query(CompTarget, DB_CompTarget);

Modified: lmi/trunk/ihs_dbdict.cpp
===================================================================
--- lmi/trunk/ihs_dbdict.cpp    2010-04-27 23:40:52 UTC (rev 4867)
+++ lmi/trunk/ihs_dbdict.cpp    2010-04-28 12:31:24 UTC (rev 4868)
@@ -222,8 +222,10 @@
     Add(TDBValue(DB_SurrChgSADurFactor  , 1.0));
     Add(TDBValue(DB_SurrChgAVDurFactor  , 1.0));
 
-    // Generally you would want a value such as 1/12 or 1/11 here.
-    Add(TDBValue(DB_MaxMonthlyCoiRate   , 1.0 / 12.0));
+    // Usually the maximum is a reciprocal, e.g., 1/11 or 1/12; for
+    // greatest precision, store the reciprocal of that reciprocal,
+    // e.g., 11 or 12.
+    Add(TDBValue(DB_MaxMonthlyCoiRate   , 12.0));
 
     Add(TDBValue(DB_GuarIntSpread       , bignum));
 
@@ -321,7 +323,7 @@
     Add(TDBValue(DB_CurrPrefLoanSpread  , 0.0));
     Add(TDBValue(DB_CurrRegLoanSpread   , 0.02));
     Add(TDBValue(DB_GuarInt             , 0.03));
-    Add(TDBValue(DB_NAARDiscount        , 1.0 / 1.00246627));
+    Add(TDBValue(DB_NAARDiscount        , 0.00246627));
     Add(TDBValue(DB_GuarIntSpread       , 0.03));
     Add(TDBValue(DB_GuarMandE           , 0.009));
     Add(TDBValue(DB_CurrIntSpread       , 0.01));

Modified: lmi/trunk/mec_server.cpp
===================================================================
--- lmi/trunk/mec_server.cpp    2010-04-27 23:40:52 UTC (rev 4867)
+++ lmi/trunk/mec_server.cpp    2010-04-28 12:31:24 UTC (rev 4868)
@@ -30,6 +30,7 @@
 
 #include "actuarial_table.hpp"
 #include "alert.hpp"
+#include "assert_lmi.hpp"
 #include "basic_values.hpp"          // lowest_premium_tax_load()
 #include "configurable_settings.hpp"
 #include "data_directory.hpp"
@@ -168,8 +169,9 @@
         ,input.issue_age()
         ,input.years_to_maturity()
         );
-    double const max_coi_rate = database.Query(DB_MaxMonthlyCoiRate);
-    // ET !! Mly7702qc = coi_rate_from_q(Mly7702qc, 
Database_->Query(DB_MaxMonthlyCoiRate));
+    double max_coi_rate = database.Query(DB_MaxMonthlyCoiRate);
+    LMI_ASSERT(0.0 != max_coi_rate);
+    max_coi_rate = 1.0 / max_coi_rate;
     assign(Mly7702qc, apply_binary(coi_rate_from_q<double>(), Mly7702qc, 
max_coi_rate));
 
     std::vector<double> guar_int;
@@ -190,11 +192,11 @@
             )
         );
 
-    std::vector<double> DBDiscountRate;
-    database.Query(DBDiscountRate, DB_NAARDiscount);
-    // ET !! Mly7702ig = -1.0 + 1.0 / DBDiscountRate;
-    std::vector<double> Mly7702ig(input.years_to_maturity());
-    assign(Mly7702ig, -1.0 + 1.0 / DBDiscountRate);
+    std::vector<double> Mly7702ig;
+    database.Query(Mly7702ig, DB_NAARDiscount);
+    LMI_ASSERT(Mly7702ig.end() == std::find(Mly7702ig.begin(), 
Mly7702ig.end(), -1.0));
+    std::vector<double> DBDiscountRate(input.years_to_maturity());
+    assign(DBDiscountRate, 1.0 / (1.0 + Mly7702ig));
 
     // Use zero if that's the guaranteed rate; else use the statutory rate.
     // ET !! Use each_equal() here because PETE seems to interfere with

Modified: lmi/trunk/mortality_rates_fetch.cpp
===================================================================
--- lmi/trunk/mortality_rates_fetch.cpp 2010-04-27 23:40:52 UTC (rev 4867)
+++ lmi/trunk/mortality_rates_fetch.cpp 2010-04-28 12:31:24 UTC (rev 4868)
@@ -28,6 +28,7 @@
 
 #include "mortality_rates.hpp"
 
+#include "assert_lmi.hpp"
 #include "basic_values.hpp"
 #include "database.hpp"
 #include "dbnames.hpp"
@@ -61,7 +62,10 @@
         oe_modal_table == basic_values.Database_->Query(DB_TgtPremType)
         ;
 
-    MaxMonthlyCoiRate_ = basic_values.Database_->Query(DB_MaxMonthlyCoiRate);
+    double max_coi_rate = basic_values.Database_->Query(DB_MaxMonthlyCoiRate);
+    LMI_ASSERT(0.0 != max_coi_rate);
+    max_coi_rate = 1.0 / max_coi_rate;
+    MaxMonthlyCoiRate_ = max_coi_rate;
 
     basic_values.Database_->Query(GCoiMultiplier_, DB_GCOIMultiplier);
     basic_values.Database_->Query(CCoiMultiplier_, DB_CCOIMultiplier);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]