
R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> options(na.action=na.exclude)  #preserve length of missings
> library(survival)
Loading required package: splines
> 
> #
> # Check out using a "user specified" distribution
> #
> mydist <- c(survreg.distributions$extreme, survreg.distributions$weibull[-1])
> mydist$name <- "Weibull2"
> mydist$dist <- NULL
> 
> fit1 <- survreg(Surv(time, status) ~ age + ph.ecog, lung)
> fit2 <- survreg(Surv(time, status) ~ age + ph.ecog, lung, dist=mydist)
> 
> all.equal(fit1$coef, fit2$coef)
[1] TRUE
> all.equal(fit1$var, fit2$var)
[1] TRUE
> 
> #
> # And with an data set containing interval censoring
> #
> idat <- read.table('data.interval', skip=3, header=T, sep=',')
> 
> fit1 <- survreg(Surv(ltime, rtime, type='interval2') ~ age + ecog.ps, idat)
> fit2 <- survreg(Surv(ltime, rtime, type='interval2') ~ age + ecog.ps, 
+                 data=idat, dist=mydist)
> 
> all.equal(fit1$coef, fit2$coef)
[1] TRUE
> all.equal(fit1$var, fit2$var)
[1] TRUE
> all.equal(fit1$log, fit2$log)
[1] TRUE
> 
> 
