title: R - differences between cindex function from pec package and coxph
body: <p>I'm comparing the cindex function from the pec package with the resulting concordance index from coxph (survival package). </p>
  
  <p>1) First the results between these two functions are different</p>
  
  <pre><code>library(pec)
  library(survival)
  library(prodlim)
  
  # Simulate survival data
  set.seed(12)
  dat &lt;- SimSurv(1000)
  
  # C-index from coxph    
  mod1 &lt;- coxph(Surv(time,status)~X1+X2, data=dat)
  summary(mod1)$concordance[1]
  
  0.846249
  
  # C-index from cindex    
  cindex(mod1,formula=Surv(time,status)~X1+X2,data=dat)
  
             AppCindex  Pairs Concordant
  coxph.model        83 915194     759712
  </code></pre>
  
  <p>2) If I use a counting process format, the cindex function give me an error</p>
  
  <pre><code>data(Melanoma)
  # Calculate age at entry
  Melanoma$age_entry &lt;- Melanoma$age-(Melanoma$time/365.25)
  # Use just one outcome (no competing risk scenario)
  Melanoma$out &lt;- ifelse(Melanoma$status==1,1,0) 
  
  mod1 &lt;- coxph(Surv(age_entry,age,out)~ulcer+thick, data=Melanoma)
  summary(mod1)$concordance[1]
  
  0.7661805 
  
  cindex(mod1,formula=Surv(age_entry,age,out)~ulcer+thick,data=Melanoma)
  
  Error: is.null(entry) | all(entry &lt;= time) is not TRUE
  </code></pre>
  
  <p>Does anyone have a clue why 1) the two C-indexes are different and 2) if it possible to use a counting process format in the cindex function?</p>
  
  <p>thanks!</p>