A new blog on various actuarial stuffs...

The aim of this blog is sharing information of interest in the actuarial world. We consider informative contents as well as implementation tools in financial, life and pension actuarial matters.

Friday 31 December 2010

Python - R interop : RPy2 2.2 offers more powerful interactions capabilities


Among the new features in the upcoming version 2.2.0, there is the possibility to write in Python the functions to be passed to higher-order R functions. In other words, it is becoming possible to write a Python function and expose it to R in such a way that the embedded R engine can call it.
As an example, let's consider the R function optim() that looks for optimal parameters for a given cost function. The cost function should be passed in the call to optim() as it will be repeatedly called as the parameter space is explored, and it is now possible to write that cost function in Python, as the code below demonstrates it.

from rpy2.robjects.vectors import FloatVector
from rpy2.robjects.packages import importr
import rpy2.rinterface as ri
stats = importr('stats')

# Rosenbrock Banana function as a cost function
# (as in the R man page for optim())
def cost_f(x):
    x1 = x[0]
    x2 = x[1]
    return 100 * (x2 - x1 * x1)**2 + (1 - x1)**2

# wrap the function f so it can be exposed to R
cost_fr = ri.rternalize(cost_f)

# starting parameters
start_params = FloatVector((-1.2, 1))

# call R's optim()
res = stats.optim(start_params, cost_fr)
The example is working verbatim with today's snapshot of the code repository (branch version_2.2.x), although few modifications might be needed in the future. Although this is development code and version 2.2.0 is scheduled to be released some time next year, the documentation already outlines this feature

Thursday 23 December 2010

IAS 19 Employee Benefits : From the Board - Belgian DC plans saved?

The IASB has tentatively decided to keep the criterion to classify a plan as "back-end loaded" unchanged (see yellow paragraph hereunder). As a result, the Belgian DC schemes would not result in undesired and artificial accounting liabilities.
Hereunder, excerpt from IASB Update December 2010 http://media.iasb.org/December%202010%20IASB%20Update.html
The IASB discussed the proposals in the exposure draft Defined Benefit Plans relating to settlements and curtailments, multi-employer plans and other matters addressed in the exposure draft or arising from the comment letters on the ED.
Settlements and curtailments
The Board tentatively decided:
          to amend the definition of curtailment to limit it to a significant reduction in the number of employees covered by a plan. The definition of a curtailment would no longer include a reduction in benefits for future service. However, in some cases, past service cost arises if a change in benefits for future service results in a change in benefits attributed to past service.
          to amend the definition of settlements to exclude plan amendments that result in past service cost and curtailments and to amend the definition of non-routine settlements to exclude benefit payments in accordance with the terms of the plan.
          to require past service cost and gains and losses on curtailments and non-routine settlements to be presented in the service cost component.
          to require gains and losses on routine settlements to be presented in the remeasurements component.
          to confirm the proposals in the exposure draft for the disclosure of past service cost, curtailments and non-routine settlements but not to require distinguishing between these items if they occur together and are presented in the same component.
Multi-employer plans
The Board tentatively decided:
          to retain the requirement in IAS 19 Employee Benefits that an entity should account for its participation in a defined benefit multi-employer plan in the same way as for any other defined benefit plan unless insufficient information is available, in which case an entity should account for the plan as if it were a defined contribution plan;
          to confirm the disclosure requirements proposed in the exposure draft for multi-employer plans, but amended to limit the disclosure of the withdrawal liability to qualitative information and to specify that an entity should recognise and measure any withdrawal liability in accordance with IAS 37 Provisions, Contingent Liabilities and Contingent Assets; and
          to confirm the disclosures proposed in the ED for multi employer plans treated as if they were defined contribution plans with the following amendments:
          to reduce the period for the required disclosure of future contributions from 5 years to 1 year.
          to require an indication of an entity's level of participation in a plan. Such a requirement could be met by disclosing the proportion of total members or the proportion of total contributions.
Other issues
The Board tentatively decided:
          to require plan administration costs to be expensed as incurred, for practical reasons. The Board directed the staff to seek feedback on this decision from the Employee Benefits Working Group.
          to confirm the proposals in the ED for the accounting for taxes payable by the plan.
          to confirm the proposed clarification in the ED that mortality assumptions include current estimates of expected changes in mortality.
          to withdraw the proposal in the ED to incorporate IFRIC 14 The Limit on a Defined Benefit Asset, Minimum Funding Requirements and their Interaction into IAS 19.
          to withdraw the proposal in the ED that would have required entities to consider expected future salary increases in determining whether a benefit formula allocates a materially higher level of benefit in later years.
          not to make any additional amendments regarding interim reporting.
          to confirm the proposal in the ED to update the disclosures:
          for defined benefit state plans to be consistent with the disclosures for defined benefit multi-employer plans if the information for the state plans is available.
          for group plans to be consistent with the disclosures for defined benefit plans, and for group plans to allow the information to be included by cross-reference to disclosures in the parent's financial statements if:
          the parent's financial statements separately identify and disclose the information required for the group plan, and
          the parent's financial statements are available to users of the financial statements on the same terms as the financial statements of the entity and at the same time

Tuesday 14 December 2010

Quantitative modeling: for those coders not willing to reinvent the wheel

Some interesting pieces of code can be found at  http://www.quantcode.com/modules/mydownloads/. Mainly Matlab, C++ and VBA. Some examples of Quantlib use in C++.

Nothing in Python although the US gov is well interested to use Python to address the lack of transparency of Asset-backed securities (see http://www.oscon.com/oscon2010/public/schedule/detail/15589).

Friday 10 December 2010

Python for actuarial modelling

We'll be very soon investigating how Python (www.python.org) in combination with Scipy and Numpy (www.scipy.org) could be used to easily build QIS 5 simple models.

We believe Python's object oriented features with the scientific tools offered by the numpy/scipy libraries can rapidly lead to a very flexible actuarial model prototype for QIS 5 modeling purposes.

IAS Board to rediscuss some points proposed by the IAS 19 ED

In the week of 13 December, the IASB Board will discuss the following topics:
  • settlements and curtailments
  • multi-employer plans
  • tax and administration costs
The April ED submitted new approach for these specific issues. Many comments followed in reaction to these propositions. They will be now re-discussed.

More information can be found in the forthcoming "IAS 19 Employee Benefits: les prémices d'une mutation" (authored by J.-Ph. Aoust and R. Renard) to be published by Kluwer.