| el.cen.test2 | R Documentation |
This function is similar to el.cen.test but for several mean constraints.
(In short: for 1 sample, right censored data, testing several mean features)
This program computes the maximized (wrt p_i) empirical
log likelihood function for right censored data with
several MEAN constraints:
\sum_i [ d_i p_i g_k(x_i) ] = \int g_k(t) dF(t) = \mu_k ; k=1,...r
where p_i = \Delta F(x_i) is a probability,
d_i is the censoring indicator.
The fun input should take the vector x (survival times) as input
and returns a nxr matrix when there are n observations and r mean type constraints.
The d for the largest observation is always taken to be 1 (uncensored).
It then computes the -2 log
empirical likelihood ratio which should be approximately chi-square df=r
distributed if the constraints are all true.
Here F(t) is the (unknown) CDF;
g_k(t) can be any given left
continuous function in t.
\mu is a given constant vector of length r.
The data must contain some right censored observations (not all censored).
If there is no censoring or the only censoring is the largest
observation, the code will stop and tell us we should use
el.test( ) which is for uncensored data.
The log empirical likelihood been maximized is
\sum_{d_i=1} \log \Delta F(x_i) + \sum_{d_i=0} \log [ 1-F(x_i) ].
el.cen.test2(x,d,fun=function(x){cbind(x, pmin(x,3))},mu,error=1e-9,maxit=15)
x |
a vector containing the observed survival times. |
d |
a vector containing the censoring indicators, 1-uncensor; 0-censor. |
fun |
r left continuous (weight) functions used to calculate
the parameters mean as in |
mu |
a vector of length r, real numbers used in the constraints, sum to this value. |
error |
an optional positive real number specifying the tolerance of
iteration error in the SQP. This is the bound of the
|
maxit |
an optional integer, used to control maximum number of iterations. |
When the given constants \mu 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. It can be memory hungary for sample size over 3000.
A list with the following components:
llik00 |
log lik without mean constraints. |
llik11 |
log lik with mean constraints. |
"-2LLR" |
The -2Log Likelihood ratio. |
xtimes |
the location of the CDF jumps. |
prob1 |
the jump size of constrained NPMLE CDF at those locations. |
Pval |
P-value |
error |
the |
iteration |
number of iterations carried out |
Mai Zhou, Kun Chen
Pan, X. and Zhou, M. (1999). Using 1-parameter sub-family of distributions in empirical likelihood ratio with censored data. J. Statist. Plann. Inference. 75, 379-392.
Chen, K. and Zhou, M. (2000). Computing censored empirical likelihood ratio using Quadratic Programming. Tech Report, Univ. of Kentucky, Dept of Statistics
Chen, K. and Zhou, M. (2007). Computation of the empirical likelihood ratio from censored data. Journal of Statistical Computing and Simulation, 77, 1033-1042.
data(smallcell)
tempX <- smallcell$survival
tempD <- smallcell$indicator
el.cen.test2(x=tempX,d=tempD,fun=function(x){cbind(x, pmin(x,600))},mu=c(750,450))
## $llik00
## [1] -499.2049
##
## $llik11
## [1] -499.6615
##
## $`-2LLR`
## [1] 0.9131845
## ......
## #If we use the EM algorithm to compute the same problem, we get same '-2LLR'
## el.cen.EM2(x=tempX,d=tempD,fun=function(x){cbind(x, pmin(x,600))},mu=c(750, 450))
## $`-2LLR`
## [1] 0.9131845
##
## we should get same "-2LLR". Although loglik may be different due to "merge/not merge" data.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.