CashValue_ME_EX2

Created Diff never expires
17 removals
940 lines
24 additions
943 lines
"""The main Space in the :mod:`~savings.CashValue_ME` model.
"""The main Space in the :mod:`~savings.CashValue_ME` model.


:mod:`~savings.CashValue_ME.Projection` is the only Space defined
:mod:`~savings.CashValue_ME.Projection` is the only Space defined
in the :mod:`~savings.CashValue_ME` model, and it contains
in the :mod:`~savings.CashValue_ME` model, and it contains
all the logic and data used in the model.
all the logic and data used in the model.


.. rubric:: Parameters and References
.. rubric:: Parameters and References


(In all the sample code below,
(In all the sample code below,
the global variable ``Projection`` refers to the
the global variable ``Projection`` refers to the
:mod:`~savings.CashValue_ME.Projection` Space.)
:mod:`~savings.CashValue_ME.Projection` Space.)


Attributes:
Attributes:


model_point_table: All model points as a DataFrame.
model_point_table: All model points as a DataFrame.
By default, 4 model points are defined.
By default, 4 model points are defined.
The DataFrame has an index named ``point_id``.
The DataFrame has an index named ``point_id``.


* ``spec_id``
* ``spec_id``
* ``age_at_entry``
* ``age_at_entry``
* ``sex``
* ``sex``
* ``policy_term``
* ``policy_term``
* ``policy_count``
* ``policy_count``
* ``sum_assured``
* ``sum_assured``
* ``duration_mth``
* ``duration_mth``
* ``premium_pp``
* ``premium_pp``
* ``av_pp_init``
* ``av_pp_init``


Cells defined in :mod:`~savings.CashValue_ME.Projection`
Cells defined in :mod:`~savings.CashValue_ME.Projection`
with the same names as these columns return
with the same names as these columns return
the corresponding column's values for the selected model point.
the corresponding column's values for the selected model point.


.. code-block::
.. code-block::


>>> Projection.model_poit_table
>>> Projection.model_poit_table
spec_id age_at_entry sex ... premium_pp av_pp_init
spec_id age_at_entry sex ... premium_pp av_pp_init
poind_id ...
poind_id ...
1 A 20 M ... 500000 0
1 A 20 M ... 500000 0
2 B 50 M ... 500000 0
2 B 50 M ... 500000 0
3 C 20 M ... 1000 0
3 C 20 M ... 1000 0
4 D 50 M ... 1000 0
4 D 50 M ... 1000 0


[4 rows x 10 columns]
[4 rows x 10 columns]


The DataFrame is saved in the Excel file *model_point_samples.xlsx*
The DataFrame is saved in the Excel file *model_point_samples.xlsx*
placed in the model folder.
placed in the model folder.
:attr:`model_point_table` is created by
:attr:`model_point_table` is created by
Projection's `new_pandas`_ method,
Projection's `new_pandas`_ method,
so that the DataFrame is saved in the separate file.
so that the DataFrame is saved in the separate file.
The DataFrame has the injected attribute
The DataFrame has the injected attribute
of ``_mx_dataclident``::
of ``_mx_dataclident``::


>>> Projection.model_point_table._mx_dataclient
>>> Projection.model_point_table._mx_dataclient
<PandasData path='model_point_table_samples.xlsx' filetype='excel'>
<PandasData path='model_point_table_samples.xlsx' filetype='excel'>


.. seealso::
.. seealso::


* :func:`model_point`
* :func:`model_point`
* :func:`age_at_entry`
* :func:`age_at_entry`
* :func:`sex`
* :func:`sex`
* :func:`policy_term`
* :func:`policy_term`
* :func:`pols_if_init`
* :func:`pols_if_init`
* :func:`sum_assured`
* :func:`sum_assured`
* :func:`duration_mth`
* :func:`duration_mth`
* :func:`premium_pp`
* :func:`premium_pp`
* :func:`av_pp_init`
* :func:`av_pp_init`


model_point_10000: Alternative model point table
model_point_10000: Alternative model point table


This model point table contains 10000 model points and
This model point table contains 10000 model points and
is saved as the Excel file *model_point_10000.xlsx*
is saved as the Excel file *model_point_10000.xlsx*
placed in the folder. To use this table, assign it to
placed in the folder. To use this table, assign it to
:attr:`model_point_table`::
:attr:`model_point_table`::


>>> Projection.model_point_table = Projection.model_point_10000
>>> Projection.model_point_table = Projection.model_point_10000




disc_rate_ann: Annual discount rates by duration as a pandas Series.
disc_rate_ann: Annual discount rates by duration as a pandas Series.


.. code-block::
.. code-block::


>>> Projection.disc_rate_ann
>>> Projection.disc_rate_ann
year
year
0 0.00000
0 0.00000
1 0.00555
1 0.00555
2 0.00684
2 0.00684
3 0.00788
3 0.00788
4 0.00866
4 0.00866


146 0.03025
146 0.03025
147 0.03033
147 0.03033
148 0.03041
148 0.03041
149 0.03049
149 0.03049
150 0.03056
150 0.03056
Name: disc_rate_ann, Length: 151, dtype: float64
Name: disc_rate_ann, Length: 151, dtype: float64


The Series is saved in the Excel file *disc_rate_ann.xlsx*
The Series is saved in the Excel file *disc_rate_ann.xlsx*
placed in the model folder.
placed in the model folder.
:attr:`disc_rate_ann` is created by
:attr:`disc_rate_ann` is created by
Projection's `new_pandas`_ method,
Projection's `new_pandas`_ method,