The function icfit
calculates the NPMLE of a distribution for interval censored data using an E-M algorithm
with polishing and checking the Kuhn-Tucker conditions (see icfit
help details).
It allows functions for the initfit option in order to calculate the starting value of the distribution in the E-M algorithm.
Because icfit
checks the Kuhn-Tucker conditions, we can try functions without doing extensive quality control,
since if the starting distribution is not close to the true NPMLE the only downside is a slower convergence. But if the
initfit function is the true NPMLE then convergence happens on the first iteration. Functions must input 5 objects, L,R, Lin, Rin,
and A, but need not use all of them.
initcomputeMLE(L,R,Lin,Rin,A=NULL,max.inner=10,max.outer=1000,tol=1e-9)
initEMICM(L=NULL,R=NULL,Lin=NULL,Rin=NULL,A=NULL,maxiter=1000,tol=1e-7)
The function initcomputeMLE
outputs an icfit object with 'pf' and 'intmap' values and some other values
defined in the help for computeMLE
.
The function initEMICM
outputs an icsurv object with a 'pf' element but no 'intmap' element, in addition to
some other values defined in the help for EMICM
.
Here we define pf and intmap:
vector of estimated probabilities of the distribution
2 by k matrix, where the ith column defines an interval corresponding to the probability, pf[i]
numeric vector of left endpoints of censoring interval (equivalent to first element of Surv when type='interval2', see icfit
details)
numeric vector of right endpoints of censoring interval (equivalent to second element of Surv function when type='interval2', see icfit
details)
logical vector, should L be included in the interval? (see icfit
details)
logical vector, should R be included in the interval? (see icfit
details)
clique matrix
see computeMLE
see computeMLE
see either computeMLE
or EMICM
see EMICM
In rare cases the computeMLE
function (and hence the initcomputeMLE
function) can cause R to crash
(at least for version 0.1-3 of the MLEcens
package).
The wrappers for the functions were written by M. Fay, but the real work are the calculation engines:
The calculation engine for initcomputeMLE
is computeMLE
and was written by Marloes Maathuis, with
part of the code for the optimization step is adapted from code that was written by Piet Groeneboom.
The calculation engine for initEMICM
is EMICM
and was written by Alain Vandal and Robert Gentleman
In order to work correctly within icfit
the function should output a list with at least a 'pf' element
giving the estimated mass of the distribution for a series of intervals.
Further, if an 'intmap' element is included (describing the series of intervals) it will be used by icfit
.
icfit
, computeMLE
, EMICM
## If you want speed and trust the MLEcens package, then there is no need to use icfit at all
## (but the convergence checks in icfit do not take much additional time)
data(bcos)
fit<-initcomputeMLE(bcos$left,bcos$right)
summary(fit)
plot(fit)
Run the code above in your browser using DataLab