EM algorithm for the TypeI right censored Weibull Mixture with two populations.
Description
EM algorithm to estimate the parameters of a mixture of two twoparameter Weibull distributions for possibly TypeI right censored data. The PDF of this mixture distribution is
f(x) = p (a_1/b_1)(x/b_1)^(a_11)exp((x/b_1)^a_1) + (1p)(a_2/b_2)(x/b_2)^(a_21)exp((x/b_2)^a_2),
p is the proportion of the first subpopulation. a_1, a_2 are the shape parameters for the two subpopulations. 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 = 1e06, 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 
The censoring threshold of Type I rightcensoring. If NULL, the uncensored mixture will be estimated. 
iniParam 
A vector of length six (p, 1p, a_1, a_2, b_1, b_2). All the elements must be postive. If not provided, the algorithm will generate them randomly. See 
useC 
See 
conCr 
See 
nIter 
See 
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

nllh 
The negative loglikelihood 
estimates 
A 2 by 3 matrix of the parameter estimates: p, a_1, b_1; 1p, 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)
