Fit a severity to grouped losses
grouped_fit.Rdgrouped_fit() fits a lognormal, gamma, Weibull, Burr or Lomax severity
to grouped losses, a count of losses in each size band, by maximum
likelihood on the bands (method = "ml") or by minimum chi-square
("chi_square"; Bahnemann, Distributions for Actuaries, section 2.4).
The losses are conditioned on lying within the bands: a first bound above
0 is a deductible's truncation and a finite last bound a truncation from
above. The covariance is the inverse of the grouped data's Fisher
information, which both methods attain asymptotically.
Usage
grouped_fit(family, bounds, counts, method = "ml")
grouped_goodness_of_fit(severity, bounds, counts)
lev_distance_fit(family, sizes, empirical, weights = NULL, start = NULL)Arguments
- family
"lognormal","gamma","weibull","loglogistic","exponential","burr"or"lomax": the body families.- bounds
The band bounds, one more than
counts, non-negative and strictly increasing; only the last may beInf.- counts
The count (or any weight) in each band
(bounds[k], bounds[k + 1]].- method
"ml"or"chi_square".- severity
A fitted or any other severity.
- sizes
Positive, strictly increasing limits.
- empirical
The empirical limited expected value at each size.
- weights
Optional non-negative weights, 1 by default.
- start
Optional starting parameters in the family's order.
Value
grouped_fit(): a list with distribution, named parameters
and standard_errors, covariance, chi_square, log_likelihood,
expected (the expected count in each band), degrees_of_freedom,
p_value and converged. grouped_goodness_of_fit(): a list with
probabilities, expected, chi_square and log_likelihood.
lev_distance_fit(): a list with distribution, named parameters,
distance, fitted (the limited means at sizes) and converged.
Details
grouped_goodness_of_fit() evaluates any severity on the bands.
lev_distance_fit() fits by minimizing sum(w * (lev(x) - e)^2), the
weighted squared distance between the family's limited expected values
and the empirical ones e at the sizes x (Bahnemann's minimum
distance, section 2.5). Empirical limited means are exact from grouped
data with each band's total, and stay exact under a policy limit at or
above the last size.
Examples
bounds <- c(0, 1000, 1500, 2000, 2500, 3000, Inf)
counts <- c(42, 61, 47, 26, 14, 10)
grouped_fit("gamma", bounds, counts, "chi_square")$parameters
#> shape scale
#> 4.743207 337.310168
grouped_goodness_of_fit(gamma_distribution(3.907288, 397.931), bounds, counts)$chi_square
#> [1] 3.094678
x <- c(500, 1000, 2000, 5000, 10000)
lev_distance_fit("lognormal", x, lev(lognormal(7, 1.2), x))$parameters
#> meanlog sdlog
#> 7.0 1.2