This method applies the expectation-maximization (EM) algorithm to estimate the parameters of a univariate Weibull mixture model. See 'Details'.

mixmod_em(x, ...)

# S3 method for wt_reliability_data
mixmod_em(
  x,
  distribution = "weibull",
  conf_level = 0.95,
  k = 2,
  method = "EM",
  n_iter = 100L,
  conv_limit = 1e-06,
  diff_loglik = 0.01,
  ...
)

Arguments

x

A tibble with class wt_reliability_data returned by reliability_data.

...

Further arguments passed to or from other methods. Currently not used.

distribution

"weibull" until further distributions are implemented.

conf_level

Confidence level for the intervals of the Weibull parameters of every component k.

k

Number of mixture components.

method

"EM" until other methods are implemented.

n_iter

Integer defining the maximum number of iterations.

conv_limit

Numeric value defining the convergence limit.

diff_loglik

Numeric value defining the maximum difference between log-likelihood values, which seems permissible.

Value

A list with classes wt_model and wt_mixmod_em. The length of the list depends on the number of specified subgroups k. The first k lists contain information provided by ml_estimation. The values of logL, aicand bic are the results of a weighted log-likelihood, where the weights are the posterior probabilities determined by the algorithm. The last list summarizes further results of the EM algorithm and is therefore called em_results. It contains the following elements:

  • a_priori : A vector with estimated prior probabilities.

  • a_posteriori : A matrix with estimated posterior probabilities.

  • groups : Numeric vector specifying the group membership of every observation.

  • logL : The value of the complete log-likelihood.

  • aic : Akaike Information Criterion.

  • bic : Bayesian Information Criterion.

Details

The EM algorithm is an iterative algorithm for which starting values must be defined. Starting values can be provided for the unknown parameter vector as well as for the posterior probabilities. This implementation employs initial values for the posterior probabilities. These are assigned randomly by using the Dirichlet distribution, the conjugate prior of a multinomial distribution (see Mr. Gelissen's blog post listed under references).

M-Step : On the basis of the initial posterior probabilities, the parameter vector is estimated with Newton-Raphson.

E-Step : The actual estimated parameter vector is used to perform an update of the posterior probabilities.

This procedure is repeated until the complete log-likelihood has converged.

References

Examples

# Reliability data preparation:
## Data for mixture model:
data_mix <- reliability_data(
  voltage,
  x = hours,
  status = status
)

# Example 1 - EM algorithm with k = 2:
mix_mod_em <- mixmod_em(
  x = data_mix,
  conf_level = 0.95,
  k = 2,
  n_iter = 150
)

# Example 2 - Maximum likelihood is applied when k = 1:
mix_mod_em_2 <- mixmod_em(
  x = data_mix,
  conf_level = 0.95,
  k = 1,
  n_iter = 150
)