[R] coxme: model simplification using LR-test?

David Winsemius dwinsemius at comcast.net
Mon Feb 20 18:37:34 CET 2012


On Feb 20, 2012, at 11:41 AM, Simon Tragust wrote:

> Many thanks for the suggestion.
>
> I tried it already,

"it" means .. what exactly?

> but as I've never wrote a function, I had no luck.

"no luck" means ... what?

> If it's not asked too much, maybe you or somebody else could help me  
> getting the code for the function right.

He gave you a perfectly formed function. Were you thinking you had to  
fill in some blanks? Not so. That "..." is a meaningful construct in  
R. It says to take whatever arguments follow and pass them on to the  
next function.  So when you enter this at the console:

  m<-coxme(Surv(day,status) ~ condition*infection +
                             (1|infection/population), data=all)
  formula.coxme<- function(x, ...) x$call$formula
  m1<-update(m, ~.-condition:infection)

.... what happens?

-- 
david.

> Am 20/02/2012 14:52, schrieb Terry Therneau:
>> Summary of the query: "update" does not work on a coxme object
>>
>>  I ran into this bug myself 2 days ago -- I rarely use update() so
>> hadn't encountered it before.  The problem is that coxme breaks the
>> formula into fixed and random portions, and this confuses the default
>> method for formula.
>>
>> Solution: add the following function:
>>   formula.coxme<- function(x, ...) x$call$formula
>>
>>  This method will be included in my next update of coxme.
>>
>> Terry Therneau
>>
>>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list