This example fits a Weibull model and a lognormal model to the example given in Kalbfleisch and Prentice (1980, p. 5). An output data set called models
is specified to contain the parameter estimates. By default, the natural log of the variable time
is used by the procedure as the response. After this log transformation, the Weibull model is fit using the extreme-value
baseline distribution, and the lognormal is fit using the normal baseline distribution.
Since the extreme-value and normal distributions do not contain any shape parameters, the variable SHAPE1
is missing in the models
data set. An additional output data set, out
, is created that contains the predicted quantiles and their standard errors for values of the covariate corresponding to
temp
=130 and temp
=150. This is done with the control
variable, which is set to 1 for only two observations.
Using the standard error estimates obtained from the output data set, approximate 90% confidence limits for the predicted
quantities are then created in a subsequent DATA step for the log response. The logs of the predicted values are obtained
because the values of the P= variable in the OUT= data set are in the same units as the original response variable, time
. The standard errors of the quantiles of log(time
) are approximated (using a Taylor series approximation) by the standard deviation of time
divided by the mean value of time
. These confidence limits are then converted back to the original scale by the exponential function.
The following statements produce Output 57.1.1:
title 'Motorette Failures With Operating Temperature as a Covariate'; data motors; input time censor temp @@; if _N_=1 then do; temp=130; time=.; control=1; z=1000/(273.2+temp); output; temp=150; time=.; control=1; z=1000/(273.2+temp); output; end; if temp>150; control=0; z=1000/(273.2+temp); output; datalines; 8064 0 150 8064 0 150 8064 0 150 8064 0 150 8064 0 150 8064 0 150 8064 0 150 8064 0 150 8064 0 150 8064 0 150 1764 1 170 2772 1 170 3444 1 170 3542 1 170 3780 1 170 4860 1 170 5196 1 170 5448 0 170 5448 0 170 5448 0 170 408 1 190 408 1 190 1344 1 190 1344 1 190 1440 1 190 1680 0 190 1680 0 190 1680 0 190 1680 0 190 1680 0 190 408 1 220 408 1 220 504 1 220 504 1 220 504 1 220 528 0 220 528 0 220 528 0 220 528 0 220 528 0 220 ;
proc print data=motors; run;
Output 57.1.1: Motorette Failure Data
Motorette Failures With Operating Temperature as a Covariate |
Obs | time | censor | temp | control | z |
---|---|---|---|---|---|
1 | . | 0 | 130 | 1 | 2.48016 |
2 | . | 0 | 150 | 1 | 2.36295 |
3 | 1764 | 1 | 170 | 0 | 2.25632 |
4 | 2772 | 1 | 170 | 0 | 2.25632 |
5 | 3444 | 1 | 170 | 0 | 2.25632 |
6 | 3542 | 1 | 170 | 0 | 2.25632 |
7 | 3780 | 1 | 170 | 0 | 2.25632 |
8 | 4860 | 1 | 170 | 0 | 2.25632 |
9 | 5196 | 1 | 170 | 0 | 2.25632 |
10 | 5448 | 0 | 170 | 0 | 2.25632 |
11 | 5448 | 0 | 170 | 0 | 2.25632 |
12 | 5448 | 0 | 170 | 0 | 2.25632 |
13 | 408 | 1 | 190 | 0 | 2.15889 |
14 | 408 | 1 | 190 | 0 | 2.15889 |
15 | 1344 | 1 | 190 | 0 | 2.15889 |
16 | 1344 | 1 | 190 | 0 | 2.15889 |
17 | 1440 | 1 | 190 | 0 | 2.15889 |
18 | 1680 | 0 | 190 | 0 | 2.15889 |
19 | 1680 | 0 | 190 | 0 | 2.15889 |
20 | 1680 | 0 | 190 | 0 | 2.15889 |
21 | 1680 | 0 | 190 | 0 | 2.15889 |
22 | 1680 | 0 | 190 | 0 | 2.15889 |
23 | 408 | 1 | 220 | 0 | 2.02758 |
24 | 408 | 1 | 220 | 0 | 2.02758 |
25 | 504 | 1 | 220 | 0 | 2.02758 |
26 | 504 | 1 | 220 | 0 | 2.02758 |
27 | 504 | 1 | 220 | 0 | 2.02758 |
28 | 528 | 0 | 220 | 0 | 2.02758 |
29 | 528 | 0 | 220 | 0 | 2.02758 |
30 | 528 | 0 | 220 | 0 | 2.02758 |
31 | 528 | 0 | 220 | 0 | 2.02758 |
32 | 528 | 0 | 220 | 0 | 2.02758 |
The following statements produce Output 57.1.2 and Output 57.1.3:
proc lifereg data=motors outest=modela covout; a: model time*censor(0)=z; output out=outa quantiles=.1 .5 .9 std=std p=predtime control=control; run;
proc lifereg data=motors outest=modelb covout; b: model time*censor(0)=z / dist=lnormal; output out=outb quantiles=.1 .5 .9 std=std p=predtime control=control; run;
Output 57.1.2: Motorette Failure: Model A
Motorette Failures With Operating Temperature as a Covariate |
Model Information | |
---|---|
Data Set | WORK.MOTORS |
Dependent Variable | Log(time) |
Censoring Variable | censor |
Censoring Value(s) | 0 |
Number of Observations | 30 |
Noncensored Values | 17 |
Right Censored Values | 13 |
Left Censored Values | 0 |
Interval Censored Values | 0 |
Number of Parameters | 3 |
Name of Distribution | Weibull |
Log Likelihood | -22.95148315 |
Analysis of Maximum Likelihood Parameter Estimates | |||||||
---|---|---|---|---|---|---|---|
Parameter | DF | Estimate | Standard Error |
95% Confidence Limits | Chi-Square | Pr > ChiSq | |
Intercept | 1 | -11.8912 | 1.9655 | -15.7435 | -8.0389 | 36.60 | <.0001 |
z | 1 | 9.0383 | 0.9060 | 7.2626 | 10.8141 | 99.52 | <.0001 |
Scale | 1 | 0.3613 | 0.0795 | 0.2347 | 0.5561 | ||
Weibull Shape | 1 | 2.7679 | 0.6091 | 1.7982 | 4.2605 |
Output 57.1.3: Motorette Failure: Model B
Motorette Failures With Operating Temperature as a Covariate |
Model Information | |
---|---|
Data Set | WORK.MOTORS |
Dependent Variable | Log(time) |
Censoring Variable | censor |
Censoring Value(s) | 0 |
Number of Observations | 30 |
Noncensored Values | 17 |
Right Censored Values | 13 |
Left Censored Values | 0 |
Interval Censored Values | 0 |
Number of Parameters | 3 |
Name of Distribution | Lognormal |
Log Likelihood | -24.47381031 |
The following statements produce Output 57.1.4:
data models; set modela modelb; run;
proc print data=models; id _model_; title 'Fitted Models'; run;
Output 57.1.4: Motorette Failure: Fitted Models
Fitted Models |
_MODEL_ | _NAME_ | _TYPE_ | _DIST_ | _STATUS_ | _LNLIKE_ | time | Intercept | z | _SCALE_ |
---|---|---|---|---|---|---|---|---|---|
a | time | PARMS | Weibull | 0 Converged | -22.9515 | -1.0000 | -11.8912 | 9.03834 | 0.36128 |
a | Intercept | COV | Weibull | 0 Converged | -22.9515 | -11.8912 | 3.8632 | -1.77878 | 0.03448 |
a | z | COV | Weibull | 0 Converged | -22.9515 | 9.0383 | -1.7788 | 0.82082 | -0.01488 |
a | Scale | COV | Weibull | 0 Converged | -22.9515 | 0.3613 | 0.0345 | -0.01488 | 0.00632 |
b | time | PARMS | Lognormal | 0 Converged | -24.4738 | -1.0000 | -10.4706 | 8.32208 | 0.60403 |
b | Intercept | COV | Lognormal | 0 Converged | -24.4738 | -10.4706 | 7.6835 | -3.55566 | 0.03267 |
b | z | COV | Lognormal | 0 Converged | -24.4738 | 8.3221 | -3.5557 | 1.64897 | -0.01285 |
b | Scale | COV | Lognormal | 0 Converged | -24.4738 | 0.6040 | 0.0327 | -0.01285 | 0.01226 |
The following statements produce Output 57.1.5:
data out; set outa outb; run; data out1; set out; ltime=log(predtime); stde=std/predtime; upper=exp(ltime+1.64*stde); lower=exp(ltime-1.64*stde); run;
title 'Quantile Estimates and Confidence Limits'; proc print data=out1; id temp; run; title;
Output 57.1.5: Motorette Failure: Quantile Estimates and Confidence Limits
Quantile Estimates and Confidence Limits |
temp | time | censor | control | z | _PROB_ | predtime | std | ltime | stde | upper | lower |
---|---|---|---|---|---|---|---|---|---|---|---|
130 | . | 0 | 1 | 2.48016 | 0.1 | 16519.27 | 5999.85 | 9.7123 | 0.36320 | 29969.51 | 9105.47 |
130 | . | 0 | 1 | 2.48016 | 0.5 | 32626.65 | 9874.33 | 10.3929 | 0.30265 | 53595.71 | 19861.63 |
130 | . | 0 | 1 | 2.48016 | 0.9 | 50343.22 | 15044.35 | 10.8266 | 0.29884 | 82183.49 | 30838.80 |
150 | . | 0 | 1 | 2.36295 | 0.1 | 5726.74 | 1569.34 | 8.6529 | 0.27404 | 8976.12 | 3653.64 |
150 | . | 0 | 1 | 2.36295 | 0.5 | 11310.68 | 2299.92 | 9.3335 | 0.20334 | 15787.62 | 8103.28 |
150 | . | 0 | 1 | 2.36295 | 0.9 | 17452.49 | 3629.28 | 9.7672 | 0.20795 | 24545.37 | 12409.24 |
130 | . | 0 | 1 | 2.48016 | 0.1 | 12033.19 | 5482.34 | 9.3954 | 0.45560 | 25402.68 | 5700.09 |
130 | . | 0 | 1 | 2.48016 | 0.5 | 26095.68 | 11359.45 | 10.1695 | 0.43530 | 53285.36 | 12779.95 |
130 | . | 0 | 1 | 2.48016 | 0.9 | 56592.19 | 26036.90 | 10.9436 | 0.46008 | 120349.65 | 26611.42 |
150 | . | 0 | 1 | 2.36295 | 0.1 | 4536.88 | 1443.07 | 8.4200 | 0.31808 | 7643.71 | 2692.83 |
150 | . | 0 | 1 | 2.36295 | 0.5 | 9838.86 | 2901.15 | 9.1941 | 0.29487 | 15957.38 | 6066.36 |
150 | . | 0 | 1 | 2.36295 | 0.9 | 21336.97 | 7172.34 | 9.9682 | 0.33615 | 37029.72 | 12294.62 |