R Observatory
Search
install.packages("insurancerating")
CRAN 30-day downloads, method
685+2.2% up on the 30 days before, the better direction
Test coverage, method
81%of lines run by tests

Provides actuarial tools and building blocks for analysing, modelling, refining, and validating insurance rating models. Designed to support common GLM-based pricing tasks and the translation of statistical model output into practical tariff structures.

Full description

Provides actuarial tools and building blocks for analysing, modelling, refining, and validating insurance rating models. Designed to support common GLM-based pricing tasks and the translation of statistical model output into practical tariff structures. The package supports the construction of insurance tariff classes using a data-driven approach, based on the methodology of Antonio and Valdez (2012) <doi:10.1007/s10182-011-0152-7>.

Maintainer
Martin Haringa
Licence
GPL (>= 2)
Latest release
1 Sep 2026
First release
7 Feb 2019

Compare with another package

More details
Releases
26
Needs compilation
No
Needs R
>= 4.1.0
Config/roxygen2/version
8.0.0
Language
en-US
LazyData
true
Task views (1)
Subjects (1) Method, Subjects
Cite

Package

Run in R for the authors' preferred citation:

citation("insurancerating")
APA
Haringa, M. (2026). insurancerating: Actuarial Tools for Insurance Pricing Models (Version 0.8.2) [Computer software]. https://doi.org/10.32614/CRAN.package.insurancerating
About

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA
Balamuta, J. J. (2026). R Observatory: Metrics for insurancerating version 0.8.2 [Data set]. HJJB, LLC. Data release v2026-10-28. https://doi.org/10.5281/zenodo.21843040
About

From data release v2026-10-28, which the citation names so these numbers can be found later.

All 13 check platforms pass.

  • r-devel-linux-x86_64-debian-clang

    The unreleased R on Linux, x86_64, debian-clang

    OK

    Version checked
    0.8.2
    Time taken
    473 s
  • r-devel-linux-x86_64-debian-gcc

    The unreleased R on Linux, x86_64, debian-gcc

    OK

    Version checked
    0.8.2
    Time taken
    334 s
  • r-devel-linux-x86_64-fedora-clang

    The unreleased R on Linux, x86_64, fedora-clang

    OK

    Version checked
    0.8.2
    Time taken
    348 s
  • r-devel-linux-x86_64-fedora-gcc

    The unreleased R on Linux, x86_64, fedora-gcc

    OK

    Version checked
    0.8.2
    Time taken
    318 s
  • r-devel-windows-x86_64

    The unreleased R on Windows, x86_64

    OK

    Version checked
    0.8.2
    Time taken
    474 s
  • r-oldrel-macos-arm64

    The previous release of R on macOS, arm64

    OK

    Version checked
    0.8.2
    Time taken
    119 s
  • r-oldrel-macos-x86_64

    The previous release of R on macOS, x86_64

    OK

    Version checked
    0.8.2
    Time taken
    485 s
  • r-oldrel-windows-x86_64

    The previous release of R on Windows, x86_64

    OK

    Version checked
    0.8.2
    Time taken
    607 s
  • r-patched-linux-x86_64

    The patched release of R on Linux, x86_64

    OK

    Version checked
    0.8.2
    Time taken
    457 s
  • r-release-linux-x86_64

    The current release of R on Linux, x86_64

    OK

    Version checked
    0.8.2
    Time taken
    450 s
  • r-release-macos-arm64

    The current release of R on macOS, arm64

    OK

    Version checked
    0.8.2
    Time taken
    108 s
  • r-release-macos-x86_64

    The current release of R on macOS, x86_64

    OK

    Version checked
    0.8.2
    Time taken
    380 s
  • r-release-windows-x86_64

    The current release of R on Windows, x86_64

    OK

    Version checked
    0.8.2
    Time taken
    459 s
  • 13 OK

Over time

No change since 25 Oct 2026

As a list (10)
ChangedWorst statusOKNotesWarningsErrors
25 Oct 2026OK13000
24 Oct 2026Error12001
5 Aug 2026OK13000
1 Aug 2026Note12100
9 Jun 2026OK13000
8 Jun 2026Error12001
7 Jun 2026OK13000
8 May 2026Note11200
7 May 2026Warning11110
10 Mar 2026Note41000

Since March 2026

Check results on CRAN

Total downloads in the last 30 days
699It is the sum of 4 channels: CRAN, r2u, autoCRAN and c2d4u.

CRAN rank

4,588 of 26,530

CRAN

685 downloads in the last 30 days

Rank
4,588 of 26,530
Change
+2.2% up on the 30 days before, the better direction

It is in the total. Take it out

r2u

11 downloads in the last 30 days

Rank
6,263 of 30,526
Change
+10% up on the 30 days before, the better direction

It is in the total. Take it out

autoCRAN

3 downloads in the last 30 days

Rank
17,776 of 29,212
Change
−81.3% down on the 30 days before, the worse direction

It is in the total. Take it out

c2d4u, no longer updated

0 downloads in the last 30 days

Rank
6,270 of 7,575
Change
−100% down on the 30 days before, the worse direction

It is in the total. Take it out

Over time

Compare downloads

Needs a package facing archival

DHARMain ImportsFix due 14 Nov 202617 days left
Needs
17
Dependent packages
0
Suggested by
0
Needs (17)
Optional extras (11)
Functions
396
Public exports
66
Lines of R code
28,743
Median complexity
4
Functions (396)
Size and composition

Lines by kind (49,369)

KindLinesShare
R code28,74358%
Tests9,91420%
Documentation8,11716%
Guides2,5955%

Lines by language

LanguageLinesShare
R38,65778%
Rd8,11716%
Vignettes2,5955%

Languages are counted from file extensions.

Files
183
R functions
396
Object systems
S3: 81 methods
Deprecated functions
44
Complexity
Median
4
Mean
7.79
Highest
79
Median lines per function
23
About complexity

Cyclomatic complexity counts the independent paths through a function: 1 is a straight line, higher is harder to test. R functions only.

Call graph figures
R functions
396
Calls
513
Unconnected
33
Groups
14
Growth (26 releases)
Total lines by release
482 on 6 Feb 201949,369 on 1 Sep 2026
Release changes

Coverage was measured, but at least one test failed during the run.

Lines run by tests
80.8%
Expressions run by tests
81.8%
Test cases
351
Exports named in tests
95.5%
Coverage by file (32)
Coverage run
Lines counted
13,795
Lines the tests ran
11,139
Tests passed
No
Measured with
covr 3.6.5 on R 4.6.1
Test suite
Has tests
Yes
Test frameworks
testthat
Test cases
351
Lines of tests
9,914
Test lines per line of code
0.34
Exports documented
100%
Arguments documented
90.7%
Return value documented
98.5%
Help pages with examples
54.1%
Examples run in checks
76.1%
Guides (5)
Other documentation
README
No
Release notes file
Yes
Help pages
85
Lines of documentation
8,117
DatasetSizeColumns
MTPLMotor Third Party Liability (MTPL) portfolio30,000 × 7age_policyholder, nclaims, exposure, amount, power, bm and 1 more
MTPL2Motor Third Party Liability (MTPL) portfolio (3,000 policyholders)3,000 × 6customer_id, area, nclaims, amount, exposure, premium

MHaringa / insurancerating on github.com

Stars
95+1.1% up on 30 days ago, the better direction
Forks
22
Open issues
0
Last commit
18 Oct 2026
Activity
Commits
329
Open pull requests
0
Tagged releases
26
Latest tagged release
v0.8.2, 1 Sep 2026
In development
Default branch at 0.8.2.9000, ahead of CRAN 0.8.2 (checked 2026-10-25)
Issues closed in
14 days (median)
Pull requests closed in
–
Pull requests merged
–
Created
3 Sep 2018
Licence file reads as
–
Development practices (7)
KindFound
Continuous integrationGitHub Actions
Docs sourceREADME.Rmd, pkgdown
GitHub Pages site last deployed 2026-10-18
The repository has a site deploy workflow
pkgdown site last built 2026-10-18
CRAN release processcran-comments.md
Lint, format, editorRStudio project

Method, repository practices

Across MHaringa

R releases
  • On CRAN
  • Release
VersionReleasedR
0.8.2 current1 Sep 20264.6.1
0.8.130 Jul 20264.6.1
0.8.02 Jun 20264.6.0
0.7.59 Oct 20244.4.1
0.7.420 May 20244.4.0
0.7.39 May 20244.4.0
0.7.220 Dec 20224.2.2
0.7.16 Sep 20224.2.1
Earlier versions (18)
VersionReleasedR
0.7.08 Jul 20224.2.1
0.6.911 Dec 20214.1.2
0.6.810 Nov 20214.1.2
0.6.728 Jul 20214.1.0
0.6.619 May 20214.1.0
0.6.522 Mar 20214.0.4
0.6.412 Jan 20214.0.3
0.6.328 Oct 20204.0.3
0.6.28 Jun 20204.0.0
0.6.129 Apr 20204.0.0
0.6.011 Apr 20203.6.3
0.5.231 Mar 20203.6.3
0.5.129 Mar 20203.6.3
0.5.012 Mar 20203.6.3
0.4.31 Nov 20193.6.1
0.4.231 May 20193.6.0
0.4.110 Apr 20193.5.3
0.4.07 Feb 20193.5.2
Release notes (0.8.2)

Changes since 0.8.1

  • rating_table() gains estimate_name for assigning exact names to fitted coefficient or relativity columns. It accepts one name for one model, a vector in model order, or a named vector for multi-model comparisons; autoplot() and as_gt() retain the custom columns.
  • edit_smoothing() gains slope_adjustment, using from as its anchor, for changing the remaining development of an effective smoothing after a selected anchor. Values before the anchor remain unchanged and the edited curve is continuous at the anchor. The default slope_adjustment = 1 leaves the smoothing unchanged.
  • calibrate_model() adds a final multiplicative calibration step for refined log-link GLMs. It changes only the overall fitted level, records the applied factor and intercept shift, and remains compatible with rating_table() and add_prediction().
  • add_restriction() now warns when a newly added numeric interval overlaps the existing interval classification. The message identifies the conflicting levels and explains how a separate replacement variable can be supplied with replaces when the intention is to replace the original classification.
  • autoplot.rating_refinement() gains show_segments = FALSE for inspecting a continuous smoothing curve without displaying the proposed tariff segments.
  • premium_change() interprets the effective smoothing in a refinement using either the existing doubling comparison or a fixed increment supplied with increment. Current and historical refinement states can be selected with steps and compared with print and as_gt() methods. The default basis = "curve" evaluates the continuous effective smoothing; basis = "segments" compares the implemented tariff-interval relativities.
  • add_restriction() gains replaces, which allows a new fixed tariff factor to explicitly replace an existing standalone model term during refit(). The replacement is retained in refinement summaries and audits. The default replaces = NULL preserves the existing additive behaviour for new factors.
  • rating_grid_db() and merge_date_ranges_db() add lazy database variants for portfolios that should be reduced before they are imported into R. rating_grid_db() translates grouped counts and sums through dbplyr, while merge_date_ranges_db() implements temporal gaps-and-islands reduction in DuckDB. A new large-portfolio vignette compares local and database workflows and illustrates lazy reduction of portfolios with 10 and 50 million records.
  • rating_grid() and merge_date_ranges() are now documented together as portfolio-reduction functions. Both use grouped data.table operations internally and return ordinary data.frame objects for downstream use.
  • split_periods_to_months() and active_rows_by_date() are now documented as portfolio time operations. Their calculations use local data.table objects internally, while their public output is always a regular data.frame. split_periods_to_months() now uses data as its first argument (df remains available as a deprecated named argument) and expands periods without a row-wise R loop. active_rows_by_date() replaces the technical nomatch and mult arguments with unmatched and multiple_matches; the old names remain available with deprecation warnings.
  • merge_date_ranges() now uses merge_gap_days = 1 by default, so only overlapping and directly adjacent coverage periods are merged unless a wider administrative gap is selected explicitly. The interval reduction is now performed as a grouped data.table calculation, avoiding row-wise R loops for large portfolios. Empty inputs, nested intervals and aggregation functions without a na.rm argument are handled explicitly. The deprecated reduce() wrapper retains its historical default for compatibility. The first argument is now named data (df remains available as a deprecated named argument), and the result is a regular data.frame subclass while data.table remains an internal implementation detail. Together with rating_grid(), the function is documented as part of the portfolio reduction workflow.
  • rating_table() now distinguishes structural and comparative level order. Pure numeric levels and numeric intervals are ordered from low to high, explicitly ordered factors retain their declared level sequence, and nominal factors are ordered from the highest to the lowest fitted effect by default. Numeric and ordinal order are not displaced by the fitted reference level. The new level_order_by_risk_factor argument can preserve model order or select alphabetical or estimate-based ordering for individual factors. Risk factors can retain formula order or be sorted alphabetically, and comparisons with several models can select the model that determines the estimate ordering. The resulting order is retained by as_gt() and autoplot().
  • add_rebasing() can rescale the current relativities of a categorical tariff factor so that an explicit reference level equals 1. When no level is supplied, the level with the largest portfolio weight is selected. Rebasing preserves every ratio between factor levels and can be applied after restrictions, shrinkage or sublevel relativities.
  • add_shrinkage() can reduce differences between categorical tariff relativities before refitting. Relativities are blended with a weighted centre on the log scale and rescaled to preserve their weighted arithmetic mean. Explicit GLM weights or a simple exposure offset are detected when possible; a column name or weights = "equal" can be supplied directly. The selected credibility, weighting basis and before/after relativities are retained in the ordered refinement specification.
  • audit_refinement() now provides a reproducible comparison between the unrestricted and refined GLM on common observed model points. It records the package version, formulas and ordered refinement steps, and reports the portfolio and exposure-weighted level effects before and after refinement. summary() on a pre-refit rating_refinement object now gives a structured review of the proposed specification, while as_gt() formats the fitted audit for reporting.
  • bootstrap_coefficients() now assesses GLM coefficient stability by resampling the estimation portfolio rows and refitting the model. Individual failed fits are retained as missing replicates instead of stopping the full run. summary() reports link-scale or exponentiated results, with "relativity" available as an alias, and as_gt() provides a formatted coefficient table.
  • The function documentation, README and vignettes now use a consistent, practical actuarial style. The documentation distinguishes observed portfolio experience, fitted model effects, explicit tariff assumptions and model diagnostics, and states relevant interpretation limits more clearly. Experimental documentation badges have been removed, and the low-level rmse() helper is listed with the package utilities in the reference index.
  • add_smoothing() keeps "spline" as its general-purpose default and fits it as an unconstrained penalized cubic regression spline. Polynomial smoothing is selected explicitly with "poly", while "gam" provides a thin-plate GAM comparison. degree is limited to polynomial fits, k is limited to spline methods, and an omitted k is adapted to the available grouped model points. Its arguments now follow the modelling sequence of variables, required breaks, smoothing method, complexity and weights. Shape-constrained methods now use readable values such as "increasing", "decreasing", "increasing_convex" and "increasing_concave"; the former short SCOP codes remain accepted as compatibility aliases. add_smoothing() now focuses only on the initial smoothing and its structural shape. The former global strength adjustment has been removed. edit_smoothing() now supports a multiplicative local adjustment, such as 1.05 for an increase of up to 5 percent, together with continuous inherited or linear transitions and an explicit discontinuous "step" transition. Relative adjustments are anchored to the unchanged smoothing at both interval boundaries and remain separate from explicit target-value edits. Each edit_smoothing() call is stored as a separate cumulative refinement step. In addition, edit_smoothing() now supports slope_adjustment, with from as its anchor. This leaves the curve unchanged through the anchor and scales only its remaining change, allowing a continuous effect to become steeper or flatter above a selected source-variable value. In autoplot.rating_refinement(), step selects the cumulative smoothing state and show_initial_smoothing = TRUE overlays the original add_smoothing() curve for comparison.
  • add_restriction() recognises a split variable created by an earlier add_relativities() step without requiring allow_new_risk_factors = TRUE. A partial restriction changes the supplied levels and fixes all remaining levels at their current derived relativities.
  • add_relativities() now validates sublevels against the observed split_variable and parent categories against model_variable before storing a refinement step. Closely matching observed values are suggested for likely spelling or spacing errors. The resulting hybrid tariff factor is now named with output_variable; its default is the model variable followed by _refined, while application-specific names such as sbi_tariff_segment can be supplied explicitly.
  • split_level() and relativities() are now the primary helpers for defining named sublevel splits and share one reference page describing their combined use. The low-level split_relativities() constructor is deprecated because it does not record the parent model level required by add_relativities().
  • Spline, GAM and shape-constrained smoothing validate the requested basis dimension against the number of unique grouped covariate values before model fitting.
  • autoplot.rating_table() and autoplot.factor_analysis() abbreviate long risk-factor level labels by default. Shortened labels use one terminal period, can be disabled, and can be replaced by explicitly supplied display labels. Both methods now also provide legend_position for consistent legend placement.
  • autoplot.riskfactor_gam() and autoplot.tariff_segments() now use one shared plotting implementation and are documented on one reference page. Segment plots retain their boundaries by default and can show the underlying GAM curve alone with show_segments = FALSE.
  • derive_tariff_segments() now uses segmentation_penalty as its primary split-control argument; complexity remains available as a deprecated alias. The method divides the fitted GAM curve without applying a second exposure or claim-volume weight; these quantities have already informed the GAM estimate and remain available through summary() as diagnostics. Validation now covers malformed GAM objects, non-finite values and whole-number search controls. Tree splits are read from the fitted tree structure rather than parsed from printed rules. add_tariff_segments() reapplies stored boundaries to the continuous risk factor, so filtering or reordering rows no longer misaligns assignments and unsupported values outside the fitted range fail explicitly.