This example illustrates using a piecewise exponential model in a Bayesian analysis. Consider the Rats
data set in the section Getting Started: PHREG Procedure. In the following statements, PROC PHREG is used to carry out a Bayesian analysis for the piecewise exponential model. In
the BAYES statement, the option PIECEWISE stipulates a piecewise exponential model, and PIECEWISE=HAZARD requests that the
constant hazards be modeled in the original scale. By default, eight intervals of constant hazards are used, and the intervals
are chosen such that each has roughly the same number of events.
data Rats; label Days ='Days from Exposure to Death'; input Days Status Group @@; datalines; 143 1 0 164 1 0 188 1 0 188 1 0 190 1 0 192 1 0 206 1 0 209 1 0 213 1 0 216 1 0 220 1 0 227 1 0 230 1 0 234 1 0 246 1 0 265 1 0 304 1 0 216 0 0 244 0 0 142 1 1 156 1 1 163 1 1 198 1 1 205 1 1 232 1 1 232 1 1 233 1 1 233 1 1 233 1 1 233 1 1 239 1 1 240 1 1 261 1 1 280 1 1 280 1 1 296 1 1 296 1 1 323 1 1 204 0 1 344 0 1 ;
proc phreg data=Rats; model Days*Status(0)=Group; bayes seed=1 piecewise=hazard; run;
The “Model Information” table in Output 67.14.1 shows that the piecewise exponential model is being used.
Output 67.14.1: Model Information
Model Information | ||
---|---|---|
Data Set | WORK.RATS | |
Dependent Variable | Days | Days from Exposure to Death |
Censoring Variable | Status | |
Censoring Value(s) | 0 | |
Model | Piecewise Exponential | |
Sampling Algorithm | ARMS | |
Burn-In Size | 2000 | |
MC Sample Size | 10000 | |
Thinning | 1 |
By default the time axis is partitioned into eight intervals of constant hazard. Output 67.14.2 details the number of events and observations in each interval. Note that the constant hazard parameters are named Lambda1
,…, Lambda8
. You can supply your own partition by using the INTERVALS= suboption within the PIECEWISE=HAZARD option.
Output 67.14.2: Interval Partition
Constant Hazard Time Intervals | ||||
---|---|---|---|---|
Interval | N | Event | Hazard Parameter |
|
[Lower, | Upper) | |||
0 | 176 | 5 | 5 | Lambda1 |
176 | 201.5 | 5 | 5 | Lambda2 |
201.5 | 218 | 7 | 5 | Lambda3 |
218 | 232.5 | 5 | 5 | Lambda4 |
232.5 | 233.5 | 4 | 4 | Lambda5 |
233.5 | 253.5 | 5 | 4 | Lambda6 |
253.5 | 288 | 4 | 4 | Lambda7 |
288 | Infty | 5 | 4 | Lambda8 |
The model parameters consist of the eight hazard parameters Lambda1
, …, Lambda8
, and the regression coefficient Group
. The maximum likelihood estimates are displayed in Output 67.14.3. Again, these estimates are used as the starting values for simulation of the posterior distribution.
Output 67.14.3: Maximum Likelihood Estimates
Maximum Likelihood Estimates | |||||
---|---|---|---|---|---|
Parameter | DF | Estimate | Standard Error |
95% Confidence Limits | |
Lambda1 | 1 | 0.000953 | 0.000443 | 0.000084 | 0.00182 |
Lambda2 | 1 | 0.00794 | 0.00371 | 0.000672 | 0.0152 |
Lambda3 | 1 | 0.0156 | 0.00734 | 0.00120 | 0.0300 |
Lambda4 | 1 | 0.0236 | 0.0115 | 0.00112 | 0.0461 |
Lambda5 | 1 | 0.3669 | 0.1959 | -0.0172 | 0.7509 |
Lambda6 | 1 | 0.0276 | 0.0148 | -0.00143 | 0.0566 |
Lambda7 | 1 | 0.0262 | 0.0146 | -0.00233 | 0.0548 |
Lambda8 | 1 | 0.0545 | 0.0310 | -0.00626 | 0.1152 |
Group | 1 | -0.6223 | 0.3468 | -1.3020 | 0.0573 |
Without using the PRIOR= suboption within the PIECEWISE=HAZARD option to specify the prior of the hazard parameters, the default is to use the noninformative and improper prior displayed in Output 67.14.4.
Output 67.14.4: Hazard Prior
Improper Prior for Hazards | |
---|---|
Parameter | Prior |
Lambda1 | 1 / Lambda1 |
Lambda2 | 1 / Lambda2 |
Lambda3 | 1 / Lambda3 |
Lambda4 | 1 / Lambda4 |
Lambda5 | 1 / Lambda5 |
Lambda6 | 1 / Lambda6 |
Lambda7 | 1 / Lambda7 |
Lambda8 | 1 / Lambda8 |
The noninformative uniform prior is used for the regression coefficient Group
(Output 67.14.5), as in the section Bayesian Analysis.
Output 67.14.5: Coefficient Prior
Uniform Prior for Regression Coefficients |
|
---|---|
Parameter | Prior |
Group | Constant |
Summary statistics for all model parameters are shown in Output 67.14.6 and Output 67.14.7.
Output 67.14.6: Summary Statistics
Posterior Summaries | ||||||
---|---|---|---|---|---|---|
Parameter | N | Mean | Standard Deviation |
Percentiles | ||
25% | 50% | 75% | ||||
Lambda1 | 10000 | 0.000945 | 0.000444 | 0.000624 | 0.000876 | 0.00118 |
Lambda2 | 10000 | 0.00782 | 0.00363 | 0.00519 | 0.00724 | 0.00979 |
Lambda3 | 10000 | 0.0155 | 0.00735 | 0.0102 | 0.0144 | 0.0195 |
Lambda4 | 10000 | 0.0236 | 0.0116 | 0.0152 | 0.0217 | 0.0297 |
Lambda5 | 10000 | 0.3634 | 0.1965 | 0.2186 | 0.3266 | 0.4685 |
Lambda6 | 10000 | 0.0278 | 0.0153 | 0.0166 | 0.0249 | 0.0356 |
Lambda7 | 10000 | 0.0265 | 0.0151 | 0.0157 | 0.0236 | 0.0338 |
Lambda8 | 10000 | 0.0558 | 0.0323 | 0.0322 | 0.0488 | 0.0721 |
Group | 10000 | -0.6154 | 0.3570 | -0.8569 | -0.6186 | -0.3788 |
Output 67.14.7: Interval Statistics
Posterior Intervals | |||||
---|---|---|---|---|---|
Parameter | Alpha | Equal-Tail Interval | HPD Interval | ||
Lambda1 | 0.050 | 0.000289 | 0.00199 | 0.000208 | 0.00182 |
Lambda2 | 0.050 | 0.00247 | 0.0165 | 0.00194 | 0.0152 |
Lambda3 | 0.050 | 0.00484 | 0.0331 | 0.00341 | 0.0301 |
Lambda4 | 0.050 | 0.00699 | 0.0515 | 0.00478 | 0.0462 |
Lambda5 | 0.050 | 0.0906 | 0.8325 | 0.0541 | 0.7469 |
Lambda6 | 0.050 | 0.00676 | 0.0654 | 0.00409 | 0.0580 |
Lambda7 | 0.050 | 0.00614 | 0.0648 | 0.00421 | 0.0569 |
Lambda8 | 0.050 | 0.0132 | 0.1368 | 0.00637 | 0.1207 |
Group | 0.050 | -1.3190 | 0.0893 | -1.3379 | 0.0652 |
The default diagnostics—namely, lag1, lag5, lag10, lag50 autocorrelations (Output 67.14.8), the Geweke diagnostics (Output 67.14.9), and the effective sample size diagnostics (Output 67.14.10)—show a good mixing of the Markov chain.
Output 67.14.8: Autocorrelations
Posterior Autocorrelations | ||||
---|---|---|---|---|
Parameter | Lag 1 | Lag 5 | Lag 10 | Lag 50 |
Lambda1 | 0.0705 | 0.0015 | 0.0017 | -0.0076 |
Lambda2 | 0.0909 | 0.0206 | -0.0013 | -0.0039 |
Lambda3 | 0.0861 | -0.0072 | 0.0011 | 0.0002 |
Lambda4 | 0.1447 | -0.0023 | 0.0081 | 0.0082 |
Lambda5 | 0.1086 | 0.0072 | -0.0038 | -0.0028 |
Lambda6 | 0.1281 | 0.0049 | -0.0036 | 0.0048 |
Lambda7 | 0.1925 | -0.0011 | 0.0094 | -0.0011 |
Lambda8 | 0.2128 | 0.0322 | -0.0042 | -0.0045 |
Group | 0.5638 | 0.0410 | -0.0003 | -0.0071 |
Output 67.14.9: Geweke Diagnostics
Geweke Diagnostics | ||
---|---|---|
Parameter | z | Pr > |z| |
Lambda1 | -0.0705 | 0.9438 |
Lambda2 | -0.4936 | 0.6216 |
Lambda3 | 0.5751 | 0.5652 |
Lambda4 | 1.0514 | 0.2931 |
Lambda5 | 0.8910 | 0.3729 |
Lambda6 | 0.2976 | 0.7660 |
Lambda7 | 1.6543 | 0.0981 |
Lambda8 | 0.6686 | 0.5038 |
Group | -1.2621 | 0.2069 |
Output 67.14.10: Effective Sample Size
Effective Sample Sizes | |||
---|---|---|---|
Parameter | ESS | Autocorrelation Time |
Efficiency |
Lambda1 | 7775.3 | 1.2861 | 0.7775 |
Lambda2 | 6874.8 | 1.4546 | 0.6875 |
Lambda3 | 7655.7 | 1.3062 | 0.7656 |
Lambda4 | 6337.1 | 1.5780 | 0.6337 |
Lambda5 | 6563.3 | 1.5236 | 0.6563 |
Lambda6 | 6720.8 | 1.4879 | 0.6721 |
Lambda7 | 5968.7 | 1.6754 | 0.5969 |
Lambda8 | 5137.2 | 1.9466 | 0.5137 |
Group | 2980.4 | 3.3553 | 0.2980 |