Skip to contents

Kaplan-Meier and Nelson-Aalen estimation, the log-rank test, Cox proportional-hazards regression with Efron tie handling, and Harrell's concordance index.

Value

The estimators return the estimate over the event times with its standard error and confidence band; morie_cox_ph returns coefficients with standard errors, hazard ratios and the likelihood-ratio test; morie_concordance_index returns the C-index with its pair counts.

Details

Verified against R's survival package. Note survival::survfit's std.err is the standard error of the CUMULATIVE HAZARD; this returns both, as se_cumhaz and se, which differ by a factor of \(S(t)\). Censoring is handled explicitly throughout: a subject still at risk at the end of follow-up contributes the information that it survived that long, and treating it either as an event or as absent biases every estimate. The same functions exist in the Python package as morie.fn._survival_core.

References

Kaplan, E. L. & Meier, P. (1958) Nonparametric estimation from incomplete observations. JASA 53, 457-481.

Cox, D. R. (1972) Regression models and life-tables. JRSS B 34, 187-220.

Efron, B. (1977) The efficiency of Cox's likelihood function for censored data. JASA 72, 557-565.

Harrell, F. E. et al. (1982) Evaluating the yield of medical tests. JAMA 247, 2543-2546.

Examples

# X must vary AMONG THE EVENTS: if every event shares one covariate
# value, or X is a linear function of the event times, the partial
# likelihood has no unique maximum and the Hessian is singular.
morie_cox_ph(time = c(1, 2, 3, 4, 5, 6, 7, 8),
             event = c(0, 1, 0, 1, 1, 0, 1, 0),
             X = c(0, 1, 0, 0, 1, 1, 0, 1))
#> $coef
#> [1] -0.4442129
#> 
#> $se
#> [1] 1.019836
#> 
#> $z
#> [1] -0.435573
#> 
#> $p_value
#> [1] 0.6631466
#> 
#> $hazard_ratio
#> [1] 0.6413289
#> 
#> $vcov
#>          [,1]
#> [1,] 1.040065
#> 
#> $loglik
#> [1] -5.540542
#> 
#> $loglik_null
#> [1] -5.63479
#> 
#> $lr_statistic
#> [1] 0.1884957
#> 
#> $lr_p_value
#> [1] 0.6641716
#> 
#> $n
#> [1] 8
#> 
#> $n_events
#> [1] 4
#> 
#> $ties
#> [1] "efron"
#>