[R] help with coxme

Lei Liu ll9f at cms.mail.virginia.edu
Thu Jun 29 23:33:59 CEST 2006


Hi there,

I have a question on fitting data by coxme. In particular I want to fit a 
random intercept and random slope cox model. Using the rats dataset as an 
example, I generated another covariate x2 and want to specify a random slope 
for x2. Here is my code:

x2=matrix(rep(runif(50), 3), 50, 3)
x2=as.vector(t(x2))

rats2=cbind(rats, x2)

But when I used the coxme function as follows, it gave an error message. 
What is the right way to do it? Thanks a lot!

  coxme(Surv(time, status) ~ rx+x2, data=rats2, random=~ (1+x2)|litter )


Lei Liu
Assistant Professor
Division of Biostatistics and Epidemiology
Dept. of Public Health Sciences
School of Medicine
University of Virginia

3181 Hospital West Complex
Charlottesville, VA 22908-0717

1-434-982-3364 (o)
1-434-806-8086 (c)

liulei at virginia.edu
ll9f at virginia.edu



More information about the R-help mailing list