# insurance.rating-factors
A premium from a base rate multiplied by rating factors (relativities) looked
up for the risk, then by loadings and discounts, held within a minimum and a
maximum premium. This is the multiplicative model most personal-lines and
many commercial rating engines use.
## Inputs
- **tables**: one per rating factor (area, driver age band, vehicle group,
occupation...), each a list of `key -> multiplier` rows. Multipliers are
basis points: 10000 is 1.0, 13500 is 1.35, 9000 is 0.9. The tables are the
insurer's own and change by the insurer's release, so they are arguments
rather than data in this package.
- **risk**: the risk's value for each table, by table name. Every table
needs a value, every value needs a row, and a value for a factor no table
rates is an error rather than being ignored (a misspelt factor name would
otherwise silently rate at 1.0). Numeric factors are banded first, e.g.
with `insurance.age-banding`.
- **adjustments**: loadings and discounts after the tables, as changes: 2500
is a 25% loading, multiplying by 1.25; -1000 a 10% discount, multiplying by
0.9. They multiply, one after another, like the table factors: a 25%
loading and a 10% discount come to 1.125, not 1.15. -10000 (free) is the
lowest allowed.
## One rounding
The base is multiplied by every multiplier in exact integer arithmetic
(math.big-integer in Rust, native big integers in TypeScript and Python),
and rounded to a minor unit once, in the caller's mode. Rounding after each
factor drifts: 1.01 at 1.005 three times is 1.0252, so 1.03, but 1.04 when
rounded at every step. Order therefore does not change the answer.
## Minimum and maximum premium
Applied last, to the rounded result. `calculated` is the premium before
them, `premium` after, and `cap` says which one, if either, set it. A result
exactly equal to a cap is not reported as capped.
Not covered: additive loadings in money (a flat 25.00 policy fee), which are
added after rating, and IPT, which is `insurance.ipt` on the final premium.