DisabilityTable#
DisabilityTable extends DecrementTable
for disability incidence tables. The governing decrement is the inception rate
\(i_x\), which represents the probability that an active life aged \(x\) becomes disabled
within one year.
Important
Scope — incidence only. DisabilityTable exposes inception rates \(i_x\) and the
standard decrement machinery (lx, tpx, modify_ix, …). It does not implement
a full three-state Markov model: there are no recovery rates \(r_x\), no disabled-life
mortality \(q_x^d\), and no enforcement of \(i_x + q_x \le 1\) when combined with a
separate mortality table. For active-life decrements merged with mortality, use
LifeTable.modify_qx with table_combination (see Modifying Decrements).
Table files for DisabilityTable are expected to carry \(i_x\) columns
(prefixed ix_m, ix_f, or ix_u) and may include generational improvement
factors following the same conventions as life tables.
See also
Table Taxonomy — Overview of all table types and decrement conventions.
Using Actuarial Tables — Loading and inspecting tables.
Modifying Decrements — Scaling, aggravated risk, and table_combination.
Mortality Improvement (MI) — Generational tables and improvement factors.
- class lactuca.DisabilityTable(table_name: str | list | tuple, sex: Literal['m', 'f', 'u'] | Sequence[Literal['m', 'f', 'u']] | None = None, cohort: int | Sequence | None = None, unisex_blend: object = None, duration: int | str | Sequence | None = None, cartesian: bool = False, return_dict: bool = False, pending: bool = False, **_kw)#
Bases:
DecrementTableConcrete implementation of DecrementTable for disability incidence tables.
DisabilityTable represents actuarial tables for disability incidence (\(i_x\)), where \(i_x\) denotes the probability of becoming disabled between ages \(x\) and \(x+1\). It provides all standard actuarial functions (
lx,px,dx,tpx,tqx) but uses disability-specific nomenclature and blocks access to mortality-specific methods (qx,ox,ex).Construction accepts scalar arguments for a single instance, or sequences for vectorial creation (families, scenarios, pricing grids). See
__new__()for full dispatch details.- Parameters:
table_name (str, list, or tuple) – Name of one or more disability table files (without
.ltkextension). A list or tuple enables multi-table vectorial creation.sex (str or sequence of str) – Single sex (
'm','f','u') or sequence for vectorial creation.cohort (int, sequence of int, or None, optional) – Birth year(s) for generational tables. If
None, loads a period table. Broadcast and zip-alignment rules match__new__().unisex_blend (float, list of float, or None, optional) – Male weight for unisex blending in \([0, 1]\) (
0.0= all female,1.0= all male). A list is accepted in zip mode (cartesian=False) to assign a distinct blend to each instance; scalarsex='u'broadcasts to the list length. See__new__().duration (int,
'ult', sequence, or None, optional) – Duration slice for select-ultimate tables. Pass an integer>= start_durationfor a select column,'ult'for the ultimate column, orNonefor non-select tables.cartesian (bool, optional) – If
True, create the full Cartesian product of alltable_name,sex,cohort, anddurationvalues. All table names must share the same generational structure and the same select structure. Withcartesian=True, aunisex_blendsequence is allowed only when everysexvalue is'u'(fifth cartesian axis). A scalarunisex_blendis replicated uniformly to all combinations wheresex='u'. Default isFalse(zip/broadcast alignment).return_dict (bool, optional) – If
True, return adictmappingTableKeyto eachDisabilityTableinstance instead of a plaintuple. Default isFalse.
- Returns:
Single
DisabilityTablewhensexis a scalar string,table_nameis a bare string (not alist/tuple),cohortanddurationare scalar orNone, no sequence dimensions are provided, andreturn_dict=False. Atuplewhen any parameter is a sequence orcartesian=Trueandreturn_dict=False(including length-1 tuples). Adictkeyed byTableKeywhenreturn_dict=True.- Return type:
DisabilityTable or tuple[DisabilityTable, …] or dict
Notes
DisabilityTable uses \(i_x\) (disability incidence) where
LifeTableuses \(q_x\) (mortality).All probability calculations (
px,tpx,tqx) work identically toLifeTable.Inherits the modification system via
modify_ix().Zip mode (default):
table_name,sex,cohort, anddurationare aligned element-wise (or broadcast when length is 1).Cartesian mode (
cartesian=True): every combination is created — suited to sensitivity grids and pricing studies, not sparse portfolio processing.A
ResourceWarningis emitted when more than 100 instances are created in a single constructor call.
- Raises:
FileNotFoundError – If a table file does not exist in the actuarial tables directory.
ValueError – If the table is not a disability table; if
cohort,sex, ordurationsequences have incompatible lengths; ifunisex_blendis out of \([0, 1]\) or provided whensexis not'u'; ifsex='u'and the table lacks a native unisex column whileunisex_blendisNone; ifcartesian=Trueand table names mix generational and period tables or mix select and non-select tables; or ifcartesian=Trueandunisex_blendis a sequence whilesexcontains any value other than'u'.TypeError – If
cohort,duration,sex, orunisex_blendarguments have invalid types.NotImplementedError – If
qx(),ox(),ex(), ormodify_qx()are called.
See also
DecrementTableAbstract base class providing core decrement logic.
TableKeyStructured lookup key for
return_dict=Trueresults.LifeTableMortality table implementation.
ExitTableExit/withdrawal table implementation.
Examples
>>> from lactuca import DisabilityTable, TableKey >>> dt = DisabilityTable('DummySD2015Gen', sex='m', cohort=1970) >>> dt.ix(40) >= 0.0 True >>> # Zip mode: two sexes >>> dt_m, dt_f = DisabilityTable('DummySD2015', ('m', 'f')) >>> # Cartesian product: 2 sex × 2 cohorts → 4 instances >>> tables = DisabilityTable( ... 'DummySD2015Gen', ('m', 'f'), cohort=[1970, 1980], cartesian=True ... ) >>> len(tables) 4 >>> # Dict return keyed by TableKey >>> d = DisabilityTable('DummySD2015', ('m', 'f'), return_dict=True) >>> dt_m = d[TableKey('DummySD2015', 'm')]
- ex(x: object = None, m: Literal[1, 2, 3, 4, 6, 12, 14, 24, 26, 52, 365] = 1) None#
Blocked method: not available for DisabilityTable.
- Raises:
NotImplementedError – Always raised. Life expectancy (ex) is not applicable to disability tables.
Notes
Life expectancy is specific to mortality tables; use
LifeTableinstead.
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable('DummySD2015', sex='m') >>> try: ... dt.ex(40) ... except NotImplementedError: ... pass
See also
LifeTableMortality table class with
exsupport.
- ex_curtate(x: object = None) None#
Blocked method: not available for DisabilityTable.
- Raises:
NotImplementedError – Always raised. Curtate life expectancy is not applicable to disability tables.
Notes
Life expectancy is specific to mortality tables; use
LifeTableinstead.
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable('DummySD2015', sex='m') >>> try: ... dt.ex_curtate(40) ... except NotImplementedError: ... pass
See also
LifeTableMortality table class with
ex_curtatesupport.
- ix(x: object = None, m: Literal[1, 2, 3, 4, 6, 12, 14, 24, 26, 52, 365] = 1) object#
Return disability incidence probability at age x.
Computes the probability that an active life aged \(x\) becomes disabled before age \(x + 1/m\), using \(i_x = 1 - p_x\) where \(p_x\) is the probability of remaining active. For fractional periods, uses \(\ell_x\) interpolation.
- Parameters:
x (float, int, sequence of float, NDArray[np.float64], or None, optional) – Entry age(s). Pandas and Polars Series are accepted. If None, returns the full incidence array for all integer ages 0 to \(\omega\).
m (PaymentFrequencyLiteral, optional) – Number of periods per year (1, 2, 3, 4, 6, 12, 14, 24, 26, 52, or 365). Default is 1.
- Returns:
Disability incidence probability. Scalar when
xis a scalar integer; array whenxis a sequence or array. Rounded toconfig.decimals.ix.- Return type:
float or np.ndarray
Notes
For integer ages and m=1, returns the tabulated incidence rate \(i_x\).
For fractional ages or m>1, uses \(\ell_x\) interpolation: \(i_x = 1 - \frac{\ell_{x+1/m}}{\ell_x}\)
If
xis None, returns the full rounded incidence array for all ages.All results rounded to
config.decimals.ix.Consistent with international actuarial practice.
- Raises:
ValueError – If any age in
xis negative.TypeError – If
xis not numeric, or ifmis not a scalar integer.
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable('DummySD2015Gen', sex='m', cohort=1970) >>> dt.ix(40) >= 0.0 True >>> bool(dt.ix(40, m=12) >= 0.0) True >>> vals = dt.ix([40, 45, 50]) >>> vals.shape (3,)
See also
DecrementTable.pxProbability of not becoming disabled (complement of \(i_x\)).
DecrementTable.lxNumber of active lives at age \(x\).
DecrementTable.tqxProbability of disability within t years.
- modify_ix(modifications: ModifyDecrement) None#
Apply modifications to disability incidence rates (ix).
This method allows actuarial adjustments to the base disability table, such as scaling rates, shifting ages, applying aggravated risk factors, or combining with other tables. All modifications are applied to a copy of the base rates and can be reset with
reset_modifications().- Parameters:
modifications (dict) –
Dictionary specifying one or more modification operations. See ModifyDecrement TypedDict for supported keys:
- ’age_shift’int
Shift all ages by N years (drops first N ages).
- ’decrement_multiplier’float
Multiply all \(i_x\) values by a constant factor.
- ’decrement_geometric_increase’tuple[float, int]
Apply geometric growth to tail: (growth_rate, start_age).
- ’aggravated_risk’float
Apply aggravated risk transform: \(p_x \to p_x^{\text{factor}}\).
- ’table_combination’Union[DecrementTable, list, tuple]
Combine with an ExitTable (or list/tuple of ExitTables) using independent competitive risks (default) or UDD when
combination_mode='udd'. DisabilityTable can only combine with ExitTable. Age alignment, host length, implicit zero beyond shorter tables, and rejection rules are identical tomodify_qx()— see Modifying Decrements.
- ’combination_mode’
'independent'or'udd' Optional actuarial assumption for
table_combination; seemodify_qx().
- ’combination_mode’
- Raises:
ValueError – If modification parameters are invalid or produce non-actuarial results.
TypeError – If modification keys or values have incorrect types.
Notes
Modifications are applied in iteration order (dict order in Python 3.7+).
Combined tables must be compatible DecrementTable instances (typically ExitTable) with matching sex.
Final results are rounded to configured decimals (
config.decimals.ix).Non-accumulative: each call to
modify_ixreplaces any previous modification — it always restarts from the original unmodified base rates. To apply several operations together, pass all keys in a single dict. To run independent experiments without interference, callreset_modifications()between them.
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable("DummySD2015Gen", sex="m", cohort=1970) >>> base = dt.ix(40) >>> dt.modify_ix({"decrement_multiplier": 1.2}) >>> dt.ix(40) >= base True
See also
DecrementTable.reset_modificationsRestore original base rates.
- modify_qx(modifications=None) None#
Blocked method: not available for DisabilityTable.
- Raises:
NotImplementedError – Always raised. Use
modify_ix()instead.
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable('DummySD2015', sex='m') >>> try: ... dt.modify_qx({'decrement_multiplier': 1.1}) ... except NotImplementedError as exc: ... 'modify_ix' in str(exc) True
See also
DisabilityTable.modify_ixApply actuarial modifications to disability incidence rates.
- ox(x: object = None, m: Literal[1, 2, 3, 4, 6, 12, 14, 24, 26, 52, 365] = 1) None#
Blocked method: not available for DisabilityTable.
- Raises:
NotImplementedError – Always raised. Use
ix()instead.
Notes
DisabilityTable does not support exit rates (
ox).
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable('DummySD2015', sex='m') >>> try: ... dt.ox(40) ... except NotImplementedError as exc: ... 'ix' in str(exc) True
See also
DisabilityTable.ixDisability incidence probability.
ExitTableExit/withdrawal table class for exit rates.
- qx(x: object = None, m: Literal[1, 2, 3, 4, 6, 12, 14, 24, 26, 52, 365] = 1) None#
Blocked method: not available for DisabilityTable.
- Raises:
NotImplementedError – Always raised. Use
ix()instead.
Notes
DisabilityTable uses
ix(disability incidence) instead ofqx(mortality).
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable('DummySD2015', sex='m') >>> try: ... dt.qx(40) ... except NotImplementedError as exc: ... 'ix' in str(exc) True
See also
DisabilityTable.ixDisability incidence probability (replacement for \(q_x\)).
- summary() str#
Return a formatted summary of the disability table state and sample ix values.
Calls
summary()for the common header block, then appends:Decimals: ix=<n>Sample ix values for the first and last 5 ages. When a modification is active, each line shows both the current and the original base value:
ix(40) = 0.00600 (original: 0.00500)
Without a modification the parenthetical is omitted.
- Returns:
Multi-line summary string.
- Return type:
str
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable("DummySD2015", sex="m") >>> summary = dt.summary() >>> "Decimals: ix=" in summary True >>> "Sample ix values (first 5):" in summary True
See also
DecrementTable.reset_modificationsRestore base rates and clear modification state.
DisabilityTable.modify_ixApply modifications.
- property decimals: _DecimalsConfig#
Access decimal precision settings for disability table actuarial functions.
This property provides convenient attribute-based access to global decimal precision configuration. All values are proxied dynamically from the
Configsingleton — no state is stored locally in the table instance. Commutation functions, mortality, life-expectancy, and exit-rate attributes are blocked and raiseAttributeError.- Returns:
Decimal-precision proxy with attributes for disability-table actuarial columns. Available attributes:
ix: int — Disability incidence \(i_x\) precisionlx: int — Survival function \(\ell_x\) precisiondx: int — Decrements \(d_x\) precisionpx: int — Survival probability \(p_x\) precisiontpx: int — Multi-year survival \({}_t p_x\) precisiontqx: int — Multi-year decrement \({}_t q_x\) precision
- Return type:
object
- Raises:
AttributeError – If accessing a blocked property:
qx,ox,ex,Lx,Tx,Dx,Nx,Sx,Cx,Mx,Rx,annuities, orinsurances.
Notes
Read-only proxy:
self.decimals.xxx = valueraisesAttributeErrorby design; useConfig().decimals.xxx = valueto change precision globally.Global scope: Changes to
Config.decimalsare immediately visible through all table instances.For permanent changes, use
Config().decimals.ix = valueorConfig().set('decimals_ix', value).
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable('DummySD2015', sex='m') >>> isinstance(dt.decimals.ix, int) True >>> isinstance(dt.decimals.px, int) True
See also
Config.decimalsGlobal decimal precision configuration.
- property table_type: str#
Return the type identifier for this decrement table.
- Returns:
Always returns ‘disability’ for DisabilityTable instances.
- Return type:
str
Notes
Used for table identification and metadata display.
Immutable property; cannot be modified after instantiation.
Examples
>>> from lactuca import DisabilityTable >>> dt = DisabilityTable('DummySD2015', sex='m') >>> dt.table_type 'disability'
See also
DecrementTableBase class providing core decrement logic.
DisabilityTable-specific members#
These members are defined on DisabilityTable itself and are
not present on DecrementTable.
Actuarial methods#
Return disability incidence probability at age x. |
Modification#
Apply modifications to disability incidence rates (ix). |
Inherited from DecrementTable#
The following members are inherited from DecrementTable.
See the DecrementTable reference for full documentation
of each member.
Note
qx, ox, ex, ex_curtate, and modify_qx are not available on DisabilityTable — the primary
decrement is ix (disability incidence rate). Calling any of the blocked methods raises
NotImplementedError.
Actuarial methods#
Return lx values (number of lives at age x) for the specified age(s). |
|
Return probability of surviving one period (px) at age x. |
|
Return interval survival probability tpx for all (x, t) combinations. |
|
Return interval death probability tqx for all (x, t) combinations. |
|
Return \(d_x\) values (number of decrements between ages \(x\) and \(x+1\)). |
Modification#
Restore decrement to the original base values and clear all caches. |
|
Return a deep copy of the instance. |
Display#
State#
Current sex used for calculations. |
|
Current cohort (year of birth) for generational tables. |
|
Return the current policy duration for select or non-select tables. |
|
Male weight used to blend male/female rates into unisex rates. |
|
Current upper age limit (omega), accounting for modifications. |
|
True if a modification is currently active on this table. |
|
List of modification descriptors applied in the current call. |
|
Return True if the underlying table is a select-ultimate table. |
|
True when required metadata has not yet been supplied via configure() or setters. |
Deferred construction#
Configure table metadata atomically with a single rebuild. |
|
Context manager to batch multiple setter assignments into one rebuild. |
See also TableRegistry and configure_all() in
Table registry utilities and Deferred construction: pending, configure, and TableRegistry in Using Actuarial Tables.
Table metadata#
Name of the underlying actuarial table. |
|
Access the underlying TableSource instance with table data and metadata. |
|
Whether the table includes cohort-based improvement factors. |
|
Base year for generational improvement. |
|
Original terminal age from metadata (immutable). |
|
Minimum defined age in the original table. |
|
Human-readable table description from metadata. |
|
Valid sexes for this table (e.g. |
|
Whether rates are identical for both sexes. |
|
Generational improvement formula type. |
|
Whether this is a select-ultimate table. |
|
Select period in years. |
|
Calendar-year index for generational improvement on select columns. |
|
Minimum integer duration. |
|
Whether improvement factors are stored by policy duration. |
|
Mortality improvement column layout tag. |
|
Projection calendar years for year-indexed MI tables. |
|
Basename of the loaded table file. |
|
Absolute path to the loaded table file. |
|
Raw underlying table data (all columns, all sexes). |
|
Raw metadata dictionary from the table file. |