Compound moments to third order and moment approximations
compound_moments.Rdcompound_moments() is the mean, variance, third cumulant, cv and
skewness of S = X_1 + ... + X_N, from the count's cumulants and the
severity's first three moments. moment_approximation() fits a
distribution to them, as the Python package aggregate's approximate:
"normal", "gamma" or "lognormal" (mean and cv), "shifted_gamma",
"shifted_lognormal", "normal_power" or "wilson_hilferty" (mean, cv
and skewness, which must be positive; the last two are defined by their
quantiles, Bahnemann's section 4.4).
It takes a count and a severity, or a compound_moments() result alone
(moment_approximation(m, "gamma")).
approximation_cdf() and approximation_quantile() evaluate a fit.
Usage
compound_moments(frequency, severity)
moment_approximation(
frequency,
severity = NULL,
kind = c("shifted_lognormal", "shifted_gamma", "gamma", "lognormal", "normal",
"normal_power", "wilson_hilferty")
)
approximation_cdf(approximation, x)
approximation_quantile(approximation, p)Arguments
- frequency
A claim count, as for
simulate_events(); formoment_approximation()also acompound_moments()result, given without a severity.- severity
A severity with a closed-form third moment.
- kind
The family.
- approximation
A fit from
moment_approximation().- x
Values.
- p
Probabilities.
Value
compound_moments(): a named vector. moment_approximation(): a
list with kind, parameters (named: mean and sd; shape and
scale; meanlog and sdlog; plus shift; mean, sd and skew
for the normal power and Wilson-Hilferty) and moments. The others:
numeric vectors.
Examples
m <- compound_moments(poisson_count(10), gamma_distribution(1 / 0.49, 50 * 0.49))
m
#> mean variance third_cumulant cv skew
#> 5.000000e+02 3.725000e+04 3.687750e+06 3.860052e-01 5.129465e-01
fit <- moment_approximation(poisson_count(10), gamma_distribution(1 / 0.49, 50 * 0.49),
"shifted_gamma")
fit$parameters
#> shape scale shift
#> 15.20253 49.50000 -252.52525
approximation_quantile(fit, c(0.5, 0.99))
#> [1] 483.5659 1020.0960
moment_approximation(m, "gamma")$parameters
#> shape scale
#> 6.711409 74.500000