R vs SAS Recurrent Events
Recurrent Event Models
The following table shows the different recurrent event models, the capabilities of each language, and whether or not the results from each language match. For this comparison, we used the survival::coxph()
function in R and the phreg
procedure in SAS.
Analysis | Supported in R | Supported in SAS | Results Match | Notes |
---|---|---|---|---|
Original Andersen-Gill model | Yes (using ties = "breslow" ) |
Yes (default is ties = breslow) | Yes | You may also opt for the default tie handling in R and set ties = efron in SAS to make the results match |
Improved Andersen-Gill model (LWYY model or proportional means/rates model) | Yes (using ties = "breslow" ) |
Yes (default is ties = breslow) | Yes | You may also opt for the default tie handling in R and set ties = efron in SAS to make the results match |
Prentice-Williams-Peterson total time model | Yes (using ties = "breslow" ) |
Yes (default is ties = breslow) | Yes | You may also opt for the default tie handling in R and set ties = efron in SAS to make the results match |
Prentice-Williams-Peterson gap time model | Yes (using ties = "breslow" ) |
Yes (default is ties = breslow) | Yes | You may also opt for the default tie handling in R and set ties = efron in SAS to make the results match |
Wei-Lin-Weissfeld model | Yes (using ties = "breslow" ) |
Yes (default is ties = breslow) | Yes | You may also opt for the default tie handling in R and set ties = efron in SAS to make the results match |
The default methods for handling ties in Cox proportional hazards models are different in each language. R uses ties = "efron"
by default, while SAS uses ties = breslow
by default. If this argument remains unchanged in both languages, it can cause differences in outcome.
Comparison Results
Here is a table of comparison values of the overall hazard ratio for rx (1 = placebo, 2 = thiotepa) between the coxph()
function in R and the phreg
procedure in SAS. The Andersen-Gill and Prentice-Williams-Peterson models used the bladder2
dataset, while the Wei-Lin-Weissfeld model used the bladder
dataset. More information on the bladder
data can be found here.
Statistic | coxph() | phreg | Match |
---|---|---|---|
Improved Andersen-Gill model (LWYY model or proportional means/rates model) | |||
Hazard ratio | 0.631 | 0.631 | Yes |
Robust standard error | 0.258 | 0.258 | Yes |
P-value | 0.0747 | 0.0747 | Yes |
95% CI | 0.381 to 1.047 | 0.381 to 1.047 | Yes |
Original Andersen-Gill | |||
Hazard ratio | 0.631 | 0.631 | Yes |
Robust standard error | 0.229 | 0.229 | Yes |
P-value | 0.0447 | 0.0447 | Yes |
95% CI | 0.403 to 0.989 | 0.403 to 0.989 | Yes |
Prentice-Williams-Peterson: total time | |||
Hazard ratio (overall) | 0.716 | 0.716 | Yes |
Robust standard error | 0.197 | 0.197 | Yes |
P-value | 0.0898 | 0.0898 | Yes |
95% CI | 0.487 to 1.053 | 0.486 to 1.053 | Yes |
Prentice-Williams-Peterson: gap time | |||
Hazard ratio (overall) | 0.764 | 0.764 | Yes |
Robust standard error | 0.208 | 0.208 | Yes |
P-value | 0.1952 | 0.1952 | Yes |
95% CI | 0.508 to 1.148 | 0.508 to 1.148 | Yes |
Wei-Lin-Weissfeld | |||
Hazard ratio (overall) | 0.560 | 0.560 | Yes |
Robust standard error | 0.303 | 0.303 | Yes |
P-value | 0.0560 | 0.0560 | Yes |
95% CI | 0.309 to 1.015 | 0.309 to 1.015 | Yes |
The table below shows the same comparison, but for the event-specific hazard ratios for rx for the Prentice-Williams-Peterson and Wei-Lin-Weissfeld models.
Statistic | coxph() | phreg | Match |
---|---|---|---|
Prentice-Williams-Peterson: total time | |||
Hazard ratios | 0.664, 0.660, 0.867, 1.111 | 0.664, 0.659, 0.867, 1.111 | Yes |
Robust standard error | 0.287, 0.424, 0.405, 0.470 | 0.287, 0.424, 0.405, 0.470 | Yes |
P-value | 0.1529, 0.3257, 0.7243, 0.8225 | 0.1529, 0.3257, 0.7243, 0.8225 | Yes |
95% CI | 0.378 to 1.164, 0.288 to 1.513, 0.392 to 1.918, 0.443 to 2.790 |
0.378 to 1.164, 0.287 to 1.513, 0.392 to 1.918, 0.443 to 2.790 |
Yes |
Prentice-Williams-Peterson: gap time | |||
Hazard ratios | 0.646, 0.740, 1.015, 1.062 | 0.646, 0.739, 1.015, 1.062 | Yes |
Robust standard error | 0.284, 0.389, 0.498, 0.540 | 0.284, 0.389, 0.498, 0.540 | Yes |
P-value | 0.1239, 0.4379, 0.9762, 0.9112 | 0.1239, 0.4379, 0.9762, 0.9112 | Yes |
95% CI | 0.371 to 1.127, 0.345 to 1.585, 0.382 to 2.696, 0.369 to 3.059 |
0.371 to 1.127, 0.345 to 1.585, 0.382 to 2.696, 0.369 to 3.059 |
Yes |
Wei-Lin-Weissfeld | |||
Hazard ratios | 0.620, 0.523, 0.488, 0.570 | 0.619, 0.523, 0.488, 0.570 | Yes |
Robust standard error | 0.283, 0.368, 0.421, 0.496 | 0.283, 0.368, 0.421, 0.496 | Yes |
P-value | 0.0908, 0.0779, 0.0885, 0.2573 | 0.0908, 0.0780, 0.0886, 0.2573 | Yes |
95% CI | 0.356 to 1.079, 0.254 to 1.075, 0.214 to 1.114, 0.216 to 1.507 |
0.356 to 1.079, 0.254 to 1.075, 0.214 to 1.114, 0.216 to 1.507 |
Yes |
Summary and Recommendation
Comparison between the R function survival::coxph()
and SAS procedure phreg
show identical results for the investigated datasets.