### Name: survreg.distributions ### Title: Parametric Survival Distributions ### Aliases: survreg.distributions ### Keywords: survival ### ** Examples # time transformation survreg(Surv(time, status) ~ ph.ecog + sex, dist='weibull', data=lung) # change the transformation to work in years # intercept changes by log(365), everything else stays the same my.weibull <- survreg.distributions$weibull my.weibull$trans <- function(y) log(y/365) my.weibull$itrans <- function(y) 365*exp(y) survreg(Surv(time, status) ~ ph.ecog + sex, lung, dist=my.weibull) # Weibull parametrisation y<-rweibull(1000, shape=2, scale=5) survreg(Surv(y)~1, dist="weibull") # survreg parameters are scale=1/shape, intercept=log(scale) # Cauchy fit mycauchy <- list(name='Cauchy', init= function(x, weights, ...) c(median(x), mad(x)), density= function(x, parms) { temp <- 1/(1 + x^2) cbind(.5 + atan(temp)/pi, .5+ atan(-temp)/pi, temp/pi, -2 *x*temp, 2*temp^2*(4*x^2*temp -1)) }, quantile= function(p, parms) tan((p-.5)*pi), deviance= function(...) stop('deviance residuals not defined') ) survreg(Surv(log(time), status) ~ ph.ecog + sex, lung, dist=mycauchy)