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
When I tried it, I seemed to get inconsistent results, the first of which was irreproducible. The first error message said that 'rats2' was not a data.frame. I don't know what I did to get that, but when I tried it again, I got the following: Error in max(kindex) : object "kindex" not found > traceback() 3: max(kindex) 2: max(kindex) 1: coxme(Surv(time, status) ~ rx + x2, data = rats2, random = ~(1 + x2) | litter) This sounds to me like a logic error in 'coxme'; I am therefore cc-ing the maintainer listed in help(package='kinship'). If it were my problem, I might list coxme and make a local copy of it. It's easy to find the offending 'max(kindex)'. It's harder to figure out what kindex should be in this context. To attempt that, I might request debug(coxme), then try again the 'coxme' call that produced the error message and trace through it line by line until I figured it out. Hope this helps. Spencer Graves Lei Liu wrote:> 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 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Many thanks. I am actually able to check for this with S-PLUS 7 for Linux and obtained the same error message concerning kindex in coxme. It is thus worthwhile to give a note to the S-PLUS author before looking into the details. Best, JH -----Original Message----- From: Spencer Graves [mailto:spencer.graves at pdf.com] Sent: 03 July 2006 17:56 To: Lei Liu Cc: r-help at stat.math.ethz.ch; Jing hua Zhao Subject: Re: [R] help with coxme When I tried it, I seemed to get inconsistent results, the first of which was irreproducible. The first error message said that 'rats2' was not a data.frame. I don't know what I did to get that, but when I tried it again, I got the following: Error in max(kindex) : object "kindex" not found > traceback() 3: max(kindex) 2: max(kindex) 1: coxme(Surv(time, status) ~ rx + x2, data = rats2, random = ~(1 + x2) | litter) This sounds to me like a logic error in 'coxme'; I am therefore cc-ing the maintainer listed in help(package='kinship'). If it were my problem, I might list coxme and make a local copy of it. It's easy to find the offending 'max(kindex)'. It's harder to figure out what kindex should be in this context. To attempt that, I might request debug(coxme), then try again the 'coxme' call that produced the error message and trace through it line by line until I figured it out. Hope this helps. Spencer Graves Lei Liu wrote:> Hi there, > > I have a question on fitting data by coxme. In particular I want tofit a> random intercept and random slope cox model. Using the rats dataset asan> example, I generated another covariate x2 and want to specify a randomslope> 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 errormessage.> 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 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html