emCenWbMix.T1: EM algorithm for the Type-I right censored Weibull Mixture...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/rv3.r

Description

EM algorithm to estimate the parameters of a mixture of two two-parameter Weibull distributions for possibly Type-I right censored data. The PDF of this mixture distribution is

f(x) = p (a_1/b_1)(x/b_1)^(a_1-1)exp(-(x/b_1)^a_1) + (1-p)(a_2/b_2)(x/b_2)^(a_2-1)exp(-(x/b_2)^a_2),

p is the proportion of the first sub-population. a_1, a_2 are the shape parameters for the two sub-populations. b_1, b_2 are the scale parameters. More details of the mixture model and this algorithm can be found in Liu (2012).

Usage

1
emCenWbMix.T1(dat, Cx=NULL, iniParam = NULL, useC = FALSE, conCr = 1e-06, nIter = 10000)

Arguments

dat

The data vector, should not contain any negative observations, but NA is allowed. The NA's and observations larger than the censoring threshold Cx will be censored in the calculation. The algorithm will decide the original sample size (before censoring) from the length of this vector.

Cx

The censoring threshold of Type I right-censoring. If NULL, the uncensored mixture will be estimated.

iniParam

A vector of length six (p, 1-p, a_1, a_2, b_1, b_2). All the elements must be postive. If not provided, the algorithm will generate them randomly. See Details.

useC

See cenWbMLE.T1

conCr

See cenWbMLE.T1

nIter

See cenWbMLE.T1

Details

It is well known that the EM algorithm is highly influenced by the initial value of the parameters. We strongly recommend the users provide some proper/reasonable initial values for their data sets. It is usually very difficult for EM algorithm to converge from the random initials generated in this function. Also, it is better to try starting this function from different initial values to obtain a "global" maximum of the likelihood.

Value

convergence

An integer indicating why the algorithm terminated

  • 0, successfully converged;

  • 1-4, Error in the maximization step. Same error code as in cenWbMLE.T1;

  • 5, Numerically under/over flow, maybe the current parameters do not fit the data;

  • 6, EM Iteration limit reached.

nllh

The negative log-likelihood

estimates

A 2 by 3 matrix of the parameter estimates:

p, a_1, b_1;

1-p, a_2, b_2;

iniParam

A copy of the iniParam

Note

Please report the numerical problems and inconvenience when using this function to the author.

Author(s)

Yang (Seagle) Liu <yang.liu@stat.ubc.ca>

References

Liu Y. (2012). Lower Quantile Estimation of Wood Strength Data. Master Thesis, Department of Statistics, UBC. Downloadable here.

See Also

rweibull, quanWbMix, simWbMix, cenWbMLE.T1, emCenWbMix.T2

Examples

1
2
3
4
5
6
7
8
mmix = rbind(c(0.7, 5, 7),c(0.3, 15, 6))
vmix = c(mmix) #A vector version of the paramters
set.seed(1)
y <- sort(simWbMix(300, mmix)) #Generate the data
#The uncensored mixture
emCenWbMix.T1(y, iniParam=vmix, useC=TRUE)
#The mixture if we censor the data around 9.
emCenWbMix.T1(y, Cx=9, iniParam=vmix, useC=TRUE) 

Example output

$convergence
[1] 0

$nllh
[1] 511.1865

$estimates
             Proportion     Shape    Scale
Population 1  0.7279865  4.720902 6.888439
Population 2  0.2720135 11.763734 6.115837

$iniParam
[1]  0.7  0.3  5.0 15.0  7.0  6.0

$convergence
[1] 0

$nllh
[1] 507.9849

$estimates
             Proportion     Shape    Scale
Population 1  0.7498951  4.834031 6.866480
Population 2  0.2501049 12.145552 6.091254

$iniParam
[1]  0.7  0.3  5.0 15.0  7.0  6.0

extWeibQuant documentation built on May 1, 2019, 10:31 p.m.