lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [4831] Round DCV COI rates; print them with 'idiosyncrasy_


From: Greg Chicares
Subject: [lmi-commits] [4831] Round DCV COI rates; print them with 'idiosyncrasy_dcvq'
Date: Mon, 05 Apr 2010 19:40:53 +0000

Revision: 4831
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4831
Author:   chicares
Date:     2010-04-05 19:40:52 +0000 (Mon, 05 Apr 2010)
Log Message:
-----------
Round DCV COI rates; print them with 'idiosyncrasy_dcvq'

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/account_value.hpp
    lmi/trunk/basic_values.hpp
    lmi/trunk/ihs_acctval.cpp
    lmi/trunk/ihs_avmly.cpp
    lmi/trunk/ihs_basicval.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-04-05 19:39:15 UTC (rev 4830)
+++ lmi/trunk/ChangeLog 2010-04-05 19:40:52 UTC (rev 4831)
@@ -24763,3 +24763,32 @@
   product_data.hpp
 Improve documentation.
 
+20100405T1936Z <address@hidden> [761]
+
+  workhorse.make
+Fix defect introduced 20100323T1713Z: the 'fardel' code wasn't updated
+to include the new '.policy' files.
+
+20100405T1937Z <address@hidden> [761]
+
+  ihs_rnddata.hpp
+Improve access control (VS).
+
+20100405T1939Z <address@hidden> [761]
+
+  main_wx.cpp
+  my_prod.cpp
+  product_data.cpp
+  stratified_charges.cpp
+  stratified_charges.hpp
+Reimplement 'strata' (formerly 'tir') product files (VS).
+
+20100405T1940Z <address@hidden> [761]
+
+  account_value.hpp
+  basic_values.hpp
+  ihs_acctval.cpp
+  ihs_avmly.cpp
+  ihs_basicval.cpp
+Round DCV COI rates; print them with 'idiosyncrasy_dcvq'.
+

Modified: lmi/trunk/account_value.hpp
===================================================================
--- lmi/trunk/account_value.hpp 2010-04-05 19:39:15 UTC (rev 4830)
+++ lmi/trunk/account_value.hpp 2010-04-05 19:40:52 UTC (rev 4831)
@@ -510,7 +510,7 @@
     double       YearsCoiRate0;
     double       YearsCoiRate1;
     double       YearsCoiRate2;
-    double       Years7702CoiRate;
+    double       YearsDcvCoiRate;
     double       YearsAdbRate;
     double       YearsTermRate;
     double       YearsWpRate;

Modified: lmi/trunk/basic_values.hpp
===================================================================
--- lmi/trunk/basic_values.hpp  2010-04-05 19:39:15 UTC (rev 4830)
+++ lmi/trunk/basic_values.hpp  2010-04-05 19:40:52 UTC (rev 4831)
@@ -142,6 +142,7 @@
     std::vector<double> const& SpreadFor7702() const;
     std::vector<double> const& GetMly7702iGlp() const;
     std::vector<double> const& GetMly7702qc() const;
+    std::vector<double> const& GetMlyDcvqc() const;
 
     // COI and term rates are blended on the current basis, but not
     // the guaranteed basis. Midpoint rates reflect blending, as a
@@ -437,6 +438,7 @@
     std::vector<double> Mly7702iGsp;
     std::vector<double> Mly7702ig;
     std::vector<double> Mly7702qc;
+    std::vector<double> MlyDcvqc;
     mutable std::vector<double> Non7702CompliantCorridor;
 };
 

Modified: lmi/trunk/ihs_acctval.cpp
===================================================================
--- lmi/trunk/ihs_acctval.cpp   2010-04-05 19:39:15 UTC (rev 4830)
+++ lmi/trunk/ihs_acctval.cpp   2010-04-05 19:40:52 UTC (rev 4831)
@@ -1512,7 +1512,7 @@
     YearsCoiRate0           = 
MortalityRates_->MonthlyCoiRatesBand0(GenBasis_)[Year];
     YearsCoiRate1           = 
MortalityRates_->MonthlyCoiRatesBand1(GenBasis_)[Year];
     YearsCoiRate2           = 
MortalityRates_->MonthlyCoiRatesBand2(GenBasis_)[Year];
-    Years7702CoiRate        = GetMly7702qc                         ()         
[Year];
+    YearsDcvCoiRate         = GetMlyDcvqc                          ()         
[Year];
     YearsAdbRate            = MortalityRates_->AdbRates            ()         
[Year];
     YearsTermRate           = MortalityRates_->MonthlyTermCoiRates 
(GenBasis_)[Year];
     YearsWpRate             = MortalityRates_->WpRates             ()         
[Year];

Modified: lmi/trunk/ihs_avmly.cpp
===================================================================
--- lmi/trunk/ihs_avmly.cpp     2010-04-05 19:39:15 UTC (rev 4830)
+++ lmi/trunk/ihs_avmly.cpp     2010-04-05 19:40:52 UTC (rev 4831)
@@ -1888,7 +1888,7 @@
     YearsTotalCoiCharge += CoiCharge;
 
     // DCV need not be rounded.
-    DcvCoiCharge = DcvNaar * (Years7702CoiRate  + CoiRetentionRate);
+    DcvCoiCharge = DcvNaar * (YearsDcvCoiRate + CoiRetentionRate);
 }
 
 //============================================================================
@@ -1916,8 +1916,8 @@
     DcvTermCharge = 0.0;
     if(TermRiderActive && yare_input_.TermRider)
         {
-        TermCharge    = YearsTermRate    * TermDB * DBDiscountRate[Year];
-        DcvTermCharge = Years7702CoiRate * TermDB * DBDiscountRate[Year];
+        TermCharge    = YearsTermRate   * TermDB * DBDiscountRate[Year];
+        DcvTermCharge = YearsDcvCoiRate * TermDB * DBDiscountRate[Year];
         }
 
     WpCharge = 0.0;

Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp  2010-04-05 19:39:15 UTC (rev 4830)
+++ lmi/trunk/ihs_basicval.cpp  2010-04-05 19:40:52 UTC (rev 4831)
@@ -32,6 +32,7 @@
 #include "alert.hpp"
 #include "assert_lmi.hpp"
 #include "calendar_date.hpp"
+#include "configurable_settings.hpp"
 #include "data_directory.hpp"
 #include "database.hpp"
 #include "dbnames.hpp"
@@ -47,18 +48,22 @@
 #include "interest_rates.hpp"
 #include "loads.hpp"
 #include "math_functors.hpp"
+#include "miscellany.hpp" // ios_out_trunc_binary()
 #include "mortality_rates.hpp"
 #include "outlay.hpp"
 #include "product_data.hpp"
 #include "stratified_charges.hpp"
 #include "surrchg_rates.hpp"
+#include "value_cast.hpp"
 
 #include <algorithm>
-#include <cmath>        // std::pow()
-#include <cstring>      // std::strlen(), std::strncmp()
+#include <cmath>          // std::pow()
+#include <cstring>        // std::strlen(), std::strncmp()
+#include <fstream>
 #include <functional>
 #include <limits>
 #include <numeric>
+#include <sstream>
 #include <stdexcept>
 
 namespace
@@ -441,7 +446,27 @@
     return z;
 }
 
-//============================================================================
+// To be moved soon.
+
+template<typename T>
+std::string mce_string(T t)
+{
+    return mc_enum<T>(t).str();
+}
+
+/// Initialize 7702 object.
+///
+/// This function is called unconditionally, even for CVAT cases that
+/// read CVAT corridor factors from a table, for two reasons:
+///   - GLP and GSP premium and specamt strategies are always offered;
+///   - at least one known product uses GLP as a handy proxy for a
+///     minimum no-lapse premium, even when the GPT is not elected.
+///
+/// To conform to the practices of certain admin systems, DCV COI
+/// rates are stored in a rounded table, but calculations from first
+/// principles (GLP, GSP, 7PP, e.g.) use unrounded monthly rates;
+/// thus, necessary premium uses both. But this is immaterial.
+
 void BasicValues::Init7702()
 {
     Mly7702qc = GetIRC7702Rates();
@@ -456,6 +481,46 @@
             )
         );
 
+    MlyDcvqc = Mly7702qc;
+    std::transform
+        (MlyDcvqc.begin()
+        ,MlyDcvqc.end()
+        ,MlyDcvqc.begin()
+        ,round_coi_rate
+        );
+    if(std::string::npos != yare_input_.Comments.find("idiosyncrasy_dcvq"))
+        {
+        std::ostringstream oss;
+        oss
+            << yare_input_.ProductName
+            << '_'
+            << mce_string(yare_input_.Gender)
+            << '_'
+            << mce_string(yare_input_.Smoking)
+            << ".dcvq"
+            << configurable_settings::instance().spreadsheet_file_extension()
+            ;
+        std::ofstream os(oss.str().c_str(), ios_out_trunc_binary());
+        int const minimum_age  = 
static_cast<int>(Database_->Query(DB_MinIssAge));
+        int const maturity_age = static_cast<int>(Database_->Query(DB_EndtAge  
));
+        if(minimum_age != yare_input_.IssueAge)
+            {
+            warning()
+                << "Issue age is "
+                << yare_input_.IssueAge
+                << ", but the minimum is "
+                << minimum_age
+                << ". Use the minimum instead."
+                << LMI_FLUSH
+                ;
+            }
+        for(int j = 0; j < maturity_age - minimum_age; ++j)
+            {
+            std::string s = value_cast<std::string>(MlyDcvqc[j]);
+            os << j + minimum_age << '\t' << s << '\n';
+            }
+        }
+
     // Monthly guar net int for 7702, with 4 or 6% min, is
     //   greater of {4%, 6%} and annual guar int rate
     //   less 7702 spread
@@ -1951,6 +2016,11 @@
     return Mly7702qc;
 }
 
+std::vector<double> const& BasicValues::GetMlyDcvqc() const
+{
+    return MlyDcvqc;
+}
+
 // Only current (hence midpoint) COI and term rates are blended
 
 std::vector<double> BasicValues::GetCvatCorridorFactors() const





reply via email to

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