# mixture_em_cpp: EM-Algorithm using Newton-Raphson Method In weibulltools: Statistical Methods for Life Data Analysis

## Description

This method uses the EM-Algorithm to estimate the parameters of a univariate mixture model. Until now, the mixture model can consist of k two-parametric Weibull distributions. The Weibull distributions are parameterized with scale η and shape β. In M-step these parameters are estimated using Newton-Raphson. This function is implemented in c++ and is called in function `mixmod_em`.

## Usage

 ```1 2``` ```mixture_em_cpp(x, event, post, distribution = "weibull", k = 2L, method = "EM", n_iter = 100L, conv_limit = 1e-06) ```

## Arguments

 `x` a numeric vector which consists of lifetime data. Lifetime data could be every characteristic influencing the reliability of a product, e.g. operating time (days/months in service), mileage (km, miles), load cycles. `event` a vector of binary data (0 or 1) indicating whether unit i is a right censored observation (= 0) or a failure (= 1). `post` a numeric matrix specifiying initial a-posteriori probabilities. The number of rows have to be in line with observations `x` and the number of columns must equal the mixture components `k`. `distribution` supposed distribution of mixture model components. The value must be `"weibull"`. Other distributions have not been implemented yet. `k` integer of mixture components, default is 2. `method` default method is `"EM"`. Other methods have not been implemented yet. `n_iter` integer defining the maximum number of iterations. `conv_limit` numeric value defining the convergence limit.

## Value

Returns a list with the following components:

• `coefficients` : A matrix with estimated Weibull parameters. In the first row the estimated scale parameters η and in the second the estimated shape parameters β are provided. The first column belongs to the first mixture component and so forth.

• `posteriori` : A matrix with estimated a-posteriori probabilities.

• `priori` : A vector with estimated a-priori probabilities.

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

## References

Doganaksoy, N.; Hahn, G.; Meeker, W. Q., Reliability Analysis by Failure Mode, Quality Progress, 35(6), 47-52, 2002

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19``` ```# Data is taken from given reference: hours <- c(2, 28, 67, 119, 179, 236, 282, 317, 348, 387, 3, 31, 69, 135, 191, 241, 284, 318, 348, 392, 5, 31, 76, 144, 203, 257, 286, 320, 350, 412, 8, 52, 78, 157, 211, 261, 298, 327, 360, 446, 13, 53, 104, 160, 221, 264, 303, 328, 369, 21, 64, 113, 168, 226, 278, 314, 328, 377) state <- c(1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1) post_dirichlet <- LearnBayes::rdirichlet(n = length(hours), par = rep(.1, 2)) mix_mod_em <- mixture_em_cpp(x = hours, event = state, post = post_dirichlet, distribution = "weibull", k = 2, method = "EM", n_iter = 150) ```

weibulltools documentation built on May 2, 2019, 11:01 a.m.