[R] Use of Lexis function to convert survival data to counting format

Robert A. LaBudde ral at lcfltd.com
Wed Apr 25 06:24:29 CEST 2007


I'm trying to convert a dataset from the time-independent analysis form

 > head(addicts)
   id clinic status survtime prison meth clinic01
1  1      1      1      428      0   50        1
2  2      1      1      275      1   55        1
3  3      1      1      262      0   55        1

into the "counting data format" necessary to perform extended Cox regression.

I got survSplit() to work, but it appears to have a problem with end 
times on the boundaries of the intervals. (My intervals are [0,183], 
[184,365], [366,548], [549,730], [730,Inf]). I looked in the 
searchable archives and found that others had also discovered 
problems with survSplit() and suggested Lexis() in the Epi package.

When I try to get Lexis to work, I get an error message that I cannot 
interpret:

 > 
addictscdf<-Lexis(entry=start,exit=stop,fail='status',breaks=c(184,366,549,730),
+   include=c('id','clinic','prison','meth','clinic01'),data=addicts)

         The following object(s) are masked from addicts :

          clinic id meth prison status survtime

Error: object is not subsettable


I'm sure I'm making some type of trivial error here, but I don't know 
how to find it. I would guess that it has something to do with 
'start' and 'stop', of which arguments I am apparently clueless as to 
the meaning.
================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: ral at lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"



More information about the R-help mailing list