apply_caps: Apply rate-change caps to indicated premiums

View source: R/misc_helpers.R

apply_capsR Documentation

Apply rate-change caps to indicated premiums

Description

Limit indicated premiums so that they do not increase or decrease by more than specified percentages relative to prior premiums.

Usage

apply_caps(
  rating_data,
  prior_data,
  by,
  coverages,
  max_increase = NULL,
  max_decrease = NULL
)

Arguments

rating_data

A data frame containing indicated premium columns named ⁠indicated_<coverage>⁠.

prior_data

A data frame containing prior premium columns named ⁠prior_<coverage>⁠.

by

A character vector naming the column or columns used to join rating_data and prior_data.

coverages

A character vector naming the coverages to cap.

max_increase

An optional nonnegative numeric value giving the maximum permitted proportional increase. For example, 0.10 permits a 10 percent increase.

max_decrease

An optional numeric value giving the maximum permitted proportional decrease. Its absolute value is used.

Value

A merged data frame with one ⁠capped_<coverage>⁠ column for each requested coverage.

Examples

indicated <- data.frame(
  policy_id = c("P1", "P2"),
  indicated_BI = c(125, 80)
)

prior <- data.frame(
  policy_id = c("P1", "P2"),
  prior_BI = c(100, 100)
)

apply_caps(
  rating_data = indicated,
  prior_data = prior,
  by = "policy_id",
  coverages = "BI",
  max_increase = 0.10,
  max_decrease = 0.15
)

ratingtables documentation built on Sept. 6, 2026, 1:06 a.m.