ROCnp                 package:emplik                 R Documentation

_T_e_s_t _t_h_e _R_O_C _c_u_r_v_e _b_y _E_m_p_i_r_i_c_a_l _L_i_k_e_l_i_h_o_o_d

_D_e_s_c_r_i_p_t_i_o_n:

     Use empirical likelihood ratio to test the hypothesis Ho: (1-b0)th
     quantile of sample 1 = (1-t0)th quantile  of sample 2. This is the
     same as testing Ho: R(t0)= b0, where R(.) is the ROC curve.

     The log empirical likelihood been maximized is

 sum_{d1=1} log Delta F_1(t1_i) + sum_{d1=0} log [1-F_1(t1_i)]  + sum_{d2=1} log Delta F_2(t2_j) + sum_{d2=0} log [1-F_2(t2_j)] .


     This empirical likelihood ratio has a chi square limit under Ho.

_U_s_a_g_e:

     ROCnp(t1, d1, t2, d2, b0, t0)

_A_r_g_u_m_e_n_t_s:

      t1: a vector of length n. Observed times, may be right censored.

      d1: a vector of length n, censoring status. d=1 means t is
          uncensored; d=0 means t is right censored. 

      t2: a vector of length m. Observed times, may be right censored.

      d2: a vector of length m, censoring status.

      b0: a scalar between 0 and 1. 

      t0: a scalar, betwenn 0 and 1. 

_D_e_t_a_i_l_s:

     Basically, we first test (1-b0)th quantile of sample 1 = c and
     also test (1-t0)th quantile of sample 2 = c.  This way we obtain
     two log likelihood ratios. 

     Then we minimize the sum of the two log likelihood ratio over c.

     See the tech report below for details on a similar setting.

_V_a_l_u_e:

     A list with the following components: 

 "-2LLR": the -2 loglikelihood ratio; have approximate chisq 
          distribution under H_o.

   cstar: the estimated common quantile.

_A_u_t_h_o_r(_s):

     Mai Zhou.

_R_e_f_e_r_e_n_c_e_s:

     Zhou, M. and Liang, H (2008).  Empirical Likelihood for Hybrid Two
     Sample Problem with Censored Data. Tech. Report.

_E_x_a_m_p_l_e_s:

     #### An example of testing the equality of two medians. No censoring.
     ROCnp(t1=rexp(100), d1=rep(1,100), t2=rexp(120), d2=rep(1,120), b0=0.5, t0=0.5)
     ##########################################################################
     #### Next, an example of finding 90
     ####  Note: We are finding confidence interval for R(0.5). So we are testing  R(0.5)= 0.35, 0.36, 0.37, 0.38, etc
     ####  try to find values so that testing R(0.5) = L , U  has p-value of 0.10,  then [L,  U] is the 90
     ###  for R(0.5)
     #set.seed(123)
     #t1 <- rexp(200)
     #t2 <- rexp(200)
     #ROCnp( t1=t1, d1=rep(1, 200), t2=t2, d2=rep(1, 200), b0=0.5, t0=0.5)$"-2LLR"
     #### since the -2LLR value is less than  2.705543 = qchisq(0.9, df=1),  so the confidence interval
     ####  contains 0.5.
     #gridpoints <- 350:650/1000
     #ELvalues <- gridpoints
     #for( i in 1:301 ) ELvalues[i] <- ROCnp( t1=t1, d1=rep(1, 200), t2=t2, d2=rep(1, 200), b0=gridpoints[i], t0=0.5)$"-2LLR"
     #myfun1 <- approxfun(x=gridpoints, y=ELvalues)
     #qchisq(0.9, df=1)
     #uniroot( f= function(x){myfun1(x)-2.705543}, interval= c(0.35, 0.5) )
     #uniroot( f= function(x){myfun1(x)-2.705543}, interval= c(0.5, 0.65) )
     #### So, taking the two roots, we see the 90
     #### this case is [0.4478605,   0.5883669]

