ltmm: Fit a Left-truncated mixture model (LTMM)

Description Usage Arguments Value Examples

View source: R/top_level.R

Description

This function generates a mixture model combining left-truncated lognormal, gamma, and weibull distributions

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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
)

Arguments

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?

Value

An ltmm model object, with the following properties:

x

Copy of the input data

distributions

The selected distributions

trunc

The left truncation value, if specified

fitted_pdf

The probability density function of the fitted model

fitted_cfd

The cumulative density function of the fitted model

VaR

The value-at-risk of the fitted model (function with p taken as onl yargument)

ES

The expected shortfall of the fitted model (function with p taken as onl yargument)

G

The number of components in the model

Pi

The estimated probabilites of component membership

Pars

The estimated model parameters

ll

The log-likelihood of the fitted model

bic

The BIC of the fitted model

aic

The AIC of the fitted model

id

The MAP component membership for each observation

iter

The number of iterations until convergence for the EM algorithm

npars

The total number of model parameters for the fitted model

ll.history

The value of log-likelihood at each iteration of the EM algorithm

Examples

1
2
3
4
5
6
x <- secura$Loss

fit <- ltmm(x, G = 2, distributions = c('gamma', 'gamma', 'weibull'), trunc = 1.2e6)

summary(fit)
plot(fit)

ltmix documentation built on July 5, 2021, 9:06 a.m.

Related to ltmm in ltmix...