[R] Frailty and coxph

Göran Broström gb at stat.umu.se
Tue Oct 8 10:12:49 CEST 2002


Does someone know the rules by which 'coxph' returns 'frail', the
predicted frailty terms? In my test function:

-----------------------------------------------
fr <- function(){
  #testing(frailty terms in 'survival'
  require(survival)
  dat <- data.frame(exit = 1:6,
                    event = rep(1, 6),
                    x = rep(c(0, 1), 3),
                    id = rep(1:2, rep(3, 2))
                    )
   fit1 <- coxph(Surv(exit, event) ~ x +
                frailty(id, dist = "gaussian"), data = dat)
  return(fit$frail)
}
-----------------------------------------------

the result is 'NULL', but with 'real data', I usually get the predicted
frailties. The help pages doesn't even mention the component 'frail', but
in the code I can see that 'frail' is reurned if  'nfrail > 0'. And
(from 'coxpenal.fit.s'):

---------------------------
  if (any(sparse)) {
    ...
  }else{
     nfrail <- 0
    ...
  }
---------------------------
and
---------------------------
  sparse <- sapply(pattr, function(x) !is.null(x$sparse) &&  x$sparse)
---------------------------

but here I lose track (lost patience:() of what is happening. I would like
to have the predicted frailty terms _always_ when I have a frailty term in
the model. What can I do? Or can someone explain in simple words what the
rules are that decide whether I get the predicted vaues or not?

Göran


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list