[R] Running cox models
tlumley at u.washington.edu
Sun Sep 3 21:50:01 CEST 2006
On Sun, 3 Sep 2006, Geoff Russell wrote:
> I'm reading van Belle et al "Biostatistics" and trying to run a cox test
> using a dataset from:
> (Primary Biliary Cirrhosis data link at top of the page),
> I'm using the following code:
> --------------- start of code
> liver <- scan("liver2.txt",list(age=0,albumin=0,alkphos=0,ascites=0,bili=0,
> ----------------- End of code
> but the answer is rather different from that in the book (p.688 - for
> anyone with the book).
A little further up the page (or on a previous page -- I don't have a
printed copy with me) the example specifies that in the model BILI,
ALBUMIN and PROTIME are log transformations of the data and AGE is in
I must admit that the need to take the 312 records with value for
treatment is not explicit in the book, though.
If you try
coxph(formula = Surv(obstime, status) ~ log(bili) + edmadj + log(albumin)
+ log(protime) + I(age/10), data = liver, subset = !is.na(treatmnt))
you will get something much more like the book.
More information about the R-help