Examples for 'survival::survreg'


Regression for a Parametric Survival Model

Aliases: survreg model.frame.survreg labels.survreg print.survreg.penal print.summary.survreg survReg anova.survreg anova.survreglist

Keywords: survival

### ** Examples

# Fit an exponential model: the two fits are the same
survreg(Surv(futime, fustat) ~ ecog.ps + rx, ovarian, dist='weibull',
                                    scale=1)
Call:
survreg(formula = Surv(futime, fustat) ~ ecog.ps + rx, data = ovarian, 
    dist = "weibull", scale = 1)

Coefficients:
(Intercept)     ecog.ps          rx 
  6.9618376  -0.4331347   0.5815027 

Scale fixed at 1 

Loglik(model)= -97.2   Loglik(intercept only)= -98
	Chisq= 1.67 on 2 degrees of freedom, p= 0.434 
n= 26 
survreg(Surv(futime, fustat) ~ ecog.ps + rx, ovarian,
        dist="exponential")
Call:
survreg(formula = Surv(futime, fustat) ~ ecog.ps + rx, data = ovarian, 
    dist = "exponential")

Coefficients:
(Intercept)     ecog.ps          rx 
  6.9618376  -0.4331347   0.5815027 

Scale fixed at 1 

Loglik(model)= -97.2   Loglik(intercept only)= -98
	Chisq= 1.67 on 2 degrees of freedom, p= 0.434 
n= 26 
#
# A model with different baseline survival shapes for two groups, i.e.,
#   two different scale parameters
survreg(Surv(time, status) ~ ph.ecog + age + strata(sex), lung)
Call:
survreg(formula = Surv(time, status) ~ ph.ecog + age + strata(sex), 
    data = lung)

Coefficients:
(Intercept)     ph.ecog         age 
 6.73234505 -0.32443043 -0.00580889 

Scale:
    sex=1     sex=2 
0.7834211 0.6547830 

Loglik(model)= -1137.3   Loglik(intercept only)= -1146.2
	Chisq= 17.8 on 2 degrees of freedom, p= 0.000137 
n=227 (1 observation deleted due to missingness)
# There are multiple ways to parameterize a Weibull distribution. The survreg 
# function embeds it in a general location-scale family, which is a 
# different parameterization than the rweibull function, and often leads
# to confusion.
#   survreg's scale  =    1/(rweibull shape)
#   survreg's intercept = log(rweibull scale)
#   For the log-likelihood all parameterizations lead to the same value.
y <- rweibull(1000, shape=2, scale=5)
survreg(Surv(y)~1, dist="weibull")
Call:
survreg(formula = Surv(y) ~ 1, dist = "weibull")

Coefficients:
(Intercept) 
   1.610367 

Scale= 0.5163178 

Loglik(model)= -2228.5   Loglik(intercept only)= -2228.5
n= 1000 
# Economists fit a model called `tobit regression', which is a standard
# linear regression with Gaussian errors, and left censored data.
tobinfit <- survreg(Surv(durable, durable>0, type='left') ~ age + quant,
                    data=tobin, dist='gaussian')

[Package survival version 3.5-3 Index]