Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# MortalityTables.jl release notes

## v3.0.0

### Breaking changes

- Julia 1.10 or newer is required.
- Indexing a parametric model (`m[x]`) is removed. Use `hazard(m, x)` or `m(x)`.
- `UltimateTable` no longer forwards indexing or `lastindex`; index the rates directly with `table.ultimate[age]`. Tables are opaque containers, consistent with `survival`, `decrement`, and `life_expectancy` already rejecting a whole table.
- `survival` and `decrement` on rate vectors now require an `AbstractArray` first argument, and `decrement` is a single method that forwards to `survival`. This removes the method ambiguities that previously turned some misuse into an ambiguity error instead of the intended `ArgumentError`.
- Parametric laws have concrete, promoted field types (`Makeham{Float64}`). Constructors accept any mix of `Real` keywords (`Makeham(a=1, b=0.5, c=0)` is a `Makeham{Float64}`), and every default law is `isbits`. `survival` is roughly 20x faster for laws without a closed-form cumulative hazard.
- `MakehamGompertz` was removed from the export list (it was never defined).
- Loading a table from a CSV file is a package extension activated by `using CSV`; the call `MortalityTable(CSV.File(...))` is unchanged.

### Bug fixes

- Kannisto's `cumhazard`, and therefore its `survival`, returned wrong values in 2.x (`survival(Kannisto(), 0)` was 1.76). The closed form had its `a` and `b` parameters swapped.
- Two-age `survival` on a parametric model is now the difference of cumulative hazards rather than a ratio of survival probabilities, so it is well defined where survival underflows to zero (previously `NaN`).
- XTbML rates are placed by their age and duration labels instead of by position. Eight mort.SOA.org tables label grouped ages; for example, t352 ("1946-49 Basic Table, ANB") has issue ages 12, 17, 22, …. For these tables most ages returned another age's rates: `select[17]` gave issue age 37's. Each rate now sits at its own age, with `missing` between the groups. An empty cell inside a select row no longer shifts the later rates to earlier ages, and a repeated label throws.
- `Makeham`, `Gompertz`, and `Kannisto` with `b = 0` return the constant-hazard limit instead of `NaN`. At an infinite age a zero coefficient no longer turns the result into `NaN`: `survival(Gompertz(), Inf)` and a constant hazard's survival there are `0`, and a law with no hazard keeps survival `1`.
- 34 additional mort.SOA.org tables with an empty metadata element now load (for example `table(217)`).
- The `get_SOA_table` "not found" error message now includes the requested table name.
- Showing a custom table no longer prints a broken mort.SOA.org link.

### Other changes

- `cumhazard` is defined for every parametric law. It integrates `hazard` numerically unless the law provides a closed form, and `survival` follows from it.
- Parametric models accept and ignore a `DeathDistribution` in `survival`, `decrement`, and `life_expectancy`, and `omega` of a parametric model is `Inf`, so a model works wherever a table's rate vector does.
- `life_expectancy` on a rate vector is linear rather than quadratic in the number of remaining ages and allocation free. An age past omega returns `0.0`.
- `UltimateMortality` accepts any `AbstractVector` (ranges, views, vectors containing `missing`, or a vector already indexed by age) and wraps it without copying; `start_age` sets the first age whatever the input's own axes. `mortality_vector` is an alias for it.
- XTbML parsing uses [XML.jl](https://github.com/JuliaData/XML.jl): loading a table is about 2 to 3 times faster and `using MortalityTables` no longer loads libxml2.
- `Pkg`, `UnPack`, `Requires`, `Memoize`, `Parsers`, and `XMLDict` are no longer dependencies.
- The Dukes-MacDonald functions are documented on the Tables page.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MortalityTables"
uuid = "4780e19d-04b9-53dc-86c2-9e9aa59b5a12"
authors = ["Alec Loudenback <alecloudenback@gmail.com>"]
version = "2.6.0"
version = "3.0.0"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand Down
Loading