This program computes the maximized (wrt p_i) empirical log likelihood function for right censored data with the MEAN constraint:
∑_i [ d_i p_i g(x_i) ] = \int g(t) dF(t) = μ
where p_i = Δ F(x_i) is a probability,
d_i is the censoring indicator.
The d for the largest observation is always taken to be 1.
It then computes the 2 log
empirical likelihood ratio which should be approximately chisquare
distributed if the constraint is true.
Here F(t) is the (unknown) CDF;
g(t) can be any given left
continuous function in t.
μ is a given constant.
The data must contain some right censored observations.
If there is no censoring or the only censoring is the largest
observation, the code will stop and we should use
el.test( )
which is for uncensored data.
The log empirical likelihood been maximized is
∑_{d_i=1} \log Δ F(x_i) + ∑_{d_i=0} \log [ 1F(x_i) ].
1  el.cen.test(x,d,fun=function(x){x},mu,error=1e8,maxit=15)

x 
a vector containing the observed survival times. 
d 
a vector containing the censoring indicators, 1uncensor; 0censor. 
fun 
a left continuous (weight) function used to calculate
the mean as in H_0.

mu 
a real number used in the constraint, sum to this value. 
error 
an optional positive real number specifying the tolerance of iteration error in the QP. This is the bound of the L_1 norm of the difference of two successive weights. 
maxit 
an optional integer, used to control maximum number of iterations. 
When the given constants μ is too far away from the NPMLE, there will be no distribution satisfy the constraint. In this case the computation will stop. The 2 Log empirical likelihood ratio should be infinite.
The constant mu
must be inside
( \min f(x_i) , \max f(x_i) )
for the computation to continue.
It is always true that the NPMLE values are feasible. So when the
computation cannot continue, try move the mu
closer
to the NPMLE, or use a different fun
.
This function depends on Wdataclean2(), WKM() and solve3.QP()
This function uses sequential Quadratic Programming to find the maximum. Unlike other functions in this package, it can be slow for larger sample sizes. It took about one minute for a sample of size 2000 with 20% censoring on a 1GHz, 256MB PC, about 19 seconds on a 3 GHz 512MB PC.
A list with the following components:
"2LLR" 
The 2Log Likelihood ratio. 
xtimes 
the location of the CDF jumps. 
weights 
the jump size of CDF at those locations. 
Pval 
Pvalue 
error 
the L_1 norm between the last two 
iteration 
number of iterations carried out 
Mai Zhou, Kun Chen
Pan, X. and Zhou, M. (1999). Using 1parameter subfamily of distributions in empirical likelihood ratio with censored data. J. Statist. Plann. Inference. 75, 379392.
Chen, K. and Zhou, M. (2000). Computing censored empirical likelihood ratio using Quadratic Programming. Tech Report, Univ. of Kentucky, Dept of Statistics
Zhou, M. and Chen, K. (2007). Computation of the empirical likelihood ratio from censored data. Journal of Statistical Computing and Simulation, 77, 10331042.
1 2 3 4 5 6  el.cen.test(rexp(100), c(rep(0,25),rep(1,75)), mu=1.5)
## second example with tied observations
x < c(1, 1.5, 2, 3, 4, 5, 6, 5, 4, 1, 2, 4.5)
d < c(1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1)
el.cen.test(x,d,mu=3.5)
# we should get "2LLR" = 1.246634 etc.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.