The motors data frame has 40 rows and 3 columns. It describes an
accelerated life test at each of four temperatures of 10 motorettes,
and has rather discrete times.
Usage
motors
Format
This data frame contains the following columns:
temp
the temperature (degrees C) of the test.
time
the time in hours to failure or censoring at 8064 hours (= 336 days).
cens
an indicator variable for death.
Source
Kalbfleisch, J. D. and Prentice, R. L. (1980)
The Statistical Analysis of Failure Time Data.
New York: Wiley.
taken from
Nelson, W. D. and Hahn, G. J. (1972)
Linear regression of a regression relationship from censored data.
Part 1 – simple methods and their application.
Technometrics, 14, 247–276.
References
Venables, W. N. and Ripley, B. D. (2002)
Modern Applied Statistics with S. Fourth edition. Springer.
Examples
library(survival)
plot(survfit(Surv(time, cens) ~ factor(temp), motors), conf.int = FALSE)
# fit Weibull model
motor.wei <- survreg(Surv(time, cens) ~ temp, motors)
summary(motor.wei)
# and predict at 130C
unlist(predict(motor.wei, data.frame(temp=130), se.fit = TRUE))
motor.cox <- coxph(Surv(time, cens) ~ temp, motors)
summary(motor.cox)
# predict at temperature 200
plot(survfit(motor.cox, newdata = data.frame(temp=200),
conf.type = "log-log"))
summary( survfit(motor.cox, newdata = data.frame(temp=130)) )
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
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.
> library(MASS)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MASS/motors.Rd_%03d_medium.png", width=480, height=480)
> ### Name: motors
> ### Title: Accelerated Life Testing of Motorettes
> ### Aliases: motors
> ### Keywords: datasets
>
> ### ** Examples
>
> library(survival)
> plot(survfit(Surv(time, cens) ~ factor(temp), motors), conf.int = FALSE)
> # fit Weibull model
> motor.wei <- survreg(Surv(time, cens) ~ temp, motors)
> summary(motor.wei)
Call:
survreg(formula = Surv(time, cens) ~ temp, data = motors)
Value Std. Error z p
(Intercept) 16.3185 0.62296 26.2 3.03e-151
temp -0.0453 0.00319 -14.2 6.74e-46
Log(scale) -1.0956 0.21480 -5.1 3.38e-07
Scale= 0.334
Weibull distribution
Loglik(model)= -147.4 Loglik(intercept only)= -169.5
Chisq= 44.32 on 1 degrees of freedom, p= 2.8e-11
Number of Newton-Raphson Iterations: 7
n= 40
> # and predict at 130C
> unlist(predict(motor.wei, data.frame(temp=130), se.fit = TRUE))
fit.1 se.fit.1
33813.06 7506.36
>
> motor.cox <- coxph(Surv(time, cens) ~ temp, motors)
> summary(motor.cox)
Call:
coxph(formula = Surv(time, cens) ~ temp, data = motors)
n= 40, number of events= 17
coef exp(coef) se(coef) z Pr(>|z|)
temp 0.09185 1.09620 0.02736 3.358 0.000786 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
exp(coef) exp(-coef) lower .95 upper .95
temp 1.096 0.9122 1.039 1.157
Concordance= 0.84 (se = 0.076 )
Rsquare= 0.472 (max possible= 0.936 )
Likelihood ratio test= 25.56 on 1 df, p=4.299e-07
Wald test = 11.27 on 1 df, p=0.0007863
Score (logrank) test = 22.73 on 1 df, p=1.862e-06
> # predict at temperature 200
> plot(survfit(motor.cox, newdata = data.frame(temp=200),
+ conf.type = "log-log"))
> summary( survfit(motor.cox, newdata = data.frame(temp=130)) )
Call: survfit(formula = motor.cox, newdata = data.frame(temp = 130))
time n.risk n.event survival std.err lower 95% CI upper 95% CI
408 40 4 1.000 0.000254 0.999 1
504 36 3 1.000 0.000498 0.999 1
1344 28 2 0.999 0.001910 0.995 1
1440 26 1 0.998 0.002697 0.993 1
1764 20 1 0.996 0.005325 0.986 1
2772 19 1 0.994 0.007920 0.978 1
3444 18 1 0.991 0.010673 0.971 1
3542 17 1 0.988 0.013667 0.962 1
3780 16 1 0.985 0.016976 0.952 1
4860 15 1 0.981 0.020692 0.941 1
5196 14 1 0.977 0.024941 0.929 1
>
>
>
>
>
> dev.off()
null device
1
>