Title: | Left-Truncated Mixtures of Gamma, Weibull, and Lognormal Distributions |
---|---|
Description: | Mixture modelling of one-dimensional data using combinations of left-truncated Gamma, Weibull, and Lognormal Distributions. Blostein, Martin & Miljkovic, Tatjana. (2019) <doi:10.1016/j.insmatheco.2018.12.001>. |
Authors: | Martin Blostein <[email protected]> and Tatjana Miljkovic <[email protected]> |
Maintainer: | Martin Blostein <[email protected]> |
License: | GPL-3 |
Version: | 0.2.2 |
Built: | 2024-11-08 03:11:04 UTC |
Source: | https://github.com/martinblostein/ltmix |
This function is useful for omparing models produced using the ltmix package to models fit using other, or for computing fit criteria and risk measures for a known set of parameters.
createLtmmObj(x, distributions, trunc, Pars, Pi, npars = NULL)
createLtmmObj(x, distributions, trunc, Pars, Pi, npars = NULL)
x |
data vector |
distributions |
densities to combine |
trunc |
left truncation point (optional) |
Pars |
list of length G of parameter values |
Pi |
vector of length G of component proportions |
npars |
Can optionally be used to overwrite the number of free parameters (used in the calculation of AIC & BIC), if the model has additional constraints |
An ltmm model object
Mixture modelling of one-dimensional data using combinations of left-truncated Gamma, Weibull, and Lognormal Distributions.
This function generates a mixture model combining left-truncated lognormal, gamma, and weibull distributions
ltmm( x, G, distributions, trunc = NULL, EM_init_method = "emEM", EM_starts = 5, init_pars = NULL, init_pi = NULL, init_classes = NULL, one_group_reps = 50, eps = 1e-06, max.it = 1000, verbose = FALSE )
ltmm( x, G, distributions, trunc = NULL, EM_init_method = "emEM", EM_starts = 5, init_pars = NULL, init_pi = NULL, init_classes = NULL, one_group_reps = 50, eps = 1e-06, max.it = 1000, verbose = FALSE )
x |
data vector |
G |
number of components |
distributions |
densities to combine |
trunc |
left truncation point (optional) |
EM_init_method |
initialization method for EM algorithm |
EM_starts |
number of random starts for initialization of EM algorithm. (only for G > 1) |
init_pars |
initial parameter values (list of length G) |
init_pi |
manually specified initial component proportions (for init_method=specified) |
init_classes |
manually specified initial classes. will overwrite init_pars and init_pi |
one_group_reps |
number of random starts for each numerical optimization in 1-component model |
eps |
stopping tolerance for EM algoithm |
max.it |
maximum number of iterations of EM algorithm |
verbose |
print information as fitting progresses? |
An ltmm model object, with the following properties:
Copy of the input data
The selected distributions
The left truncation value, if specified
The probability density function of the fitted model
The cumulative density function of the fitted model
The value-at-risk of the fitted model (function with p taken as onl yargument)
The expected shortfall of the fitted model (function with p taken as onl yargument)
The number of components in the model
The estimated probabilites of component membership
The estimated model parameters
The log-likelihood of the fitted model
The BIC of the fitted model
The AIC of the fitted model
The MAP component membership for each observation
The number of iterations until convergence for the EM algorithm
The total number of model parameters for the fitted model
The value of log-likelihood at each iteration of the EM algorithm
x <- secura$Loss fit <- ltmm(x, G = 2, distributions = c('gamma', 'gamma', 'weibull'), trunc = 1.2e6) summary(fit) plot(fit)
x <- secura$Loss fit <- ltmm(x, G = 2, distributions = c('gamma', 'gamma', 'weibull'), trunc = 1.2e6) summary(fit) plot(fit)
This function fits a family of finite mixture models using every combination of the left-truncated lognormal, gamma, and weibull distributions.
ltmmCombo( x, G, distributions = c("lognormal", "gamma", "weibull"), trunc = NULL, EM_init_method = "emEM", EM_starts = 5, init_pars = NULL, init_pi = NULL, init_classes = NULL, one_group_reps = 50, eps = 1e-06, max.it = 1000, verbose = FALSE, parallel = FALSE, cores = NULL, save_each_fit = FALSE )
ltmmCombo( x, G, distributions = c("lognormal", "gamma", "weibull"), trunc = NULL, EM_init_method = "emEM", EM_starts = 5, init_pars = NULL, init_pi = NULL, init_classes = NULL, one_group_reps = 50, eps = 1e-06, max.it = 1000, verbose = FALSE, parallel = FALSE, cores = NULL, save_each_fit = FALSE )
x |
data vector |
G |
number of components |
distributions |
densities to combine |
trunc |
left truncation point (optional) |
EM_init_method |
initialization method for EM algorithm |
EM_starts |
number of random starts for initialization of EM algorithm. (only for G > 1) |
init_pars |
initial parameter values (list of length G) |
init_pi |
manually specified initial component proportions (for init_method=specified) |
init_classes |
manually specified initial classes. will overwrite init_pars and init_pi |
one_group_reps |
number of random starts for each numerical optimization in 1-component model |
eps |
stopping tolerance for EM algoithm |
max.it |
maximum number of iterations of EM algorithm |
verbose |
print information as fitting progresses? |
parallel |
fit models in parallel? |
cores |
number of processes used for parallel computation. if NULL detect.cores() used |
save_each_fit |
save each model as it is produced, in a time-stamped directory (safer) |
An ltmmCombo model object, with the following properties:
Copy of the input data
The selected distributions
List of all combinations of distributions considered
List of all ltmm fit objects
Vector of BIC values for each model
The best ltmm fit by BIC
The best BIC value of all fits
The combination of distributions used for the best fit by BIC
Vector of AIC value for each model
The best ltmm fit by AIC
The best AIC value of all fits
The combination of distributions used for the best fit by AIC
Vector of log-likelihood value for each model
Table summarizing the AIC, BIC, LL, and risk measures for each fitted model
Blostein, Martin & Miljkovic, Tatjana. (2019). On modeling left-truncated loss data using mixtures of distributions. Insurance Mathematics and Economics. 85. 35-46. 10.1016/j.insmatheco.2018.12.001.
x <- secura$Loss fits_GL <- ltmmCombo(x, G = 2, distributions = c('gamma', 'lognormal'), trunc = 1.2e6) summary(fits_GL)
x <- secura$Loss fits_GL <- ltmmCombo(x, G = 2, distributions = c('gamma', 'lognormal'), trunc = 1.2e6) summary(fits_GL)
"The Secura Belgian Re data set contains automobile claims from 1988 until 2001, which are at least as large as 1,200,000 Euros." (Beirlant, Goegebeur, Segers & Teugels, 2004).
secura
secura
An object of class data.frame
with 371 rows and 2 columns.
Beirlant, J., Goegebeur Y., Segers, J., & Teugels, J. Statistics of extremes : theory and applications. Hoboken, NJ: Wiley, 2004. Print.