swh:1:snp:ff0951ca787d0b7f47dc2335f47fed43820a6324
Raw File
Tip revision: baa3a0f39e4ea7b973c6f69941906bb67bdcdd83 authored by Venkatraman E. Seshan on 24 March 2011, 00:00:00 UTC
version 0.9.6
Tip revision: baa3a0f
coxphQuantile.R
coxphQuantile <- function(phfit, xrange, p=0.5, whichx=1, otherx=NULL, ...)
{
  if (class(phfit) != "coxph") stop("phfit shoud be coxph class object")
  cvtmean <- phfit$means
  loghr <- phfit$coef
  S0 <- survfit(phfit)
  stime <- S0$time
  ssurv <- S0$surv
  if (!missing(otherx)) {
    ssurv <- ssurv^(exp(sum(loghr[-whichx]*(otherx-cvtmean[-whichx]))))
  }
  sx <- cvtmean[whichx] + log(log(p)/log(ssurv))/loghr[whichx]
  ii <- which(sx >= xrange[1] & sx <= xrange[2])
  lines(sx[ii], stime[ii], type="S", ...)
  invisible(as.data.frame(list(cvt=sx,time=stime)))
}
back to top