KM-bias

This repository contains sample files (Maple codes, Maxima codes, and Jupyter Notebook) that may be used for computing the small-sample bias of the Kaplan-Meier estimator. The codes are similar to the Maple V codes discussed in the article “Exact Calculation of the Kaplan-Meier Bias Using Maple Software” (Gillespie, B. and J. Uro, 1993) that appeared in Mathematical Computation with Maple V: Ideas and Applications (Proceedings of the 1993 Maple Summer Workshop and Symposium), pp. 128-136.

For Python (Jupyter Notebook)

Please use the following link below pointing to a Binder server:

Binder

Jupyter notebook files for \(n=5,\ T=1.0\):
(Jupyter input file: km-n5-e1e1t1.ipynb; Jupyter output file: km-n5-e1e1t1-out.ipynb)


Computed Bias for \(T = 0.5\)

\(n = 10\)
Failure Time Distribution: \(f_X(x) = \exp(-x),\ x>0\)
Censoring Time Distribution: \(f_Y(y) = \exp(-y),\ y>0\)
Expected Lifetime: \(\exp(-0.5) = 0.6065306597126334 \)

Estimator Estimated Expected Value Bias
Efron \( 0.6048530839301303\) \(-0.00167757578250316\)
Gill \(0.6066478084305761\) \(\hspace{12px}0.00011714871794266\)

(Maxima input file: km-n10-e1e1t05.mac; Maxima output file: km-n10-e1e1t05-output.mac)
(Maple input file: km-n10-e1e1t05-Efron.mws; Maple output file: km-n10-e1e1t05-Efron-output.mw)


Computed Bias for \(T = 1.0\)

\(n = 10\)
Failure Time Distribution: \(f_X(x) = \exp(-x),\ x>0\)
Censoring Time Distribution: \(f_Y(y) = \exp(-y),\ y>0\)
Expected Lifetime: \(\exp(-1.0) = 0.36787944117144233 \)

Estimator Estimated Expected Value Bias
Efron \( 0.3339997005016279\) \(-0.03387974066981442\)
Gill \(0.37515976194249184\) \(\hspace{12px}0.007280320771049509\)

(Maxima input file: km-n10-e1e1t1.mac; Maxima output file: km-n10-e1e1t1-output.mac)
(Maple input file: km-n10-e1e1t1-Efron.mws; Maple output file: km-n10-e1e1t1-Efron-output.mw)


Computed Bias for \(T = 2.0\)

\(n = 10\)
Failure Time Distribution: \(f_X(x) = \exp(-x),\ x>0\)
Censoring Time Distribution: \(f_Y(y) = \exp(-y),\ y>0\)
Expected Lifetime: \(\exp(-2.0) = 0.1353352832366127 \)

Estimator Estimated Expected Value Bias
Efron \( 0.06114801462318425\) \(-0.07418726861342845\)
Gill \(0.20760745229019978\) \(\hspace{12px}0.07227216905358708\)

(Maxima input file: km-n10-e1e1t2.mac; Maxima output file: km-n10-e1e1t2-output.mac)
(Maple input file: km-n10-e1e1t2-Efron.mws; Maple output file: km-n10-e1e1t2-Efron-output.mw)


Acknowledgments:

Many thanks to:


License

KM-bias by Justine Leon A. Uro is licensed under Creative Commons Attribution 4.0 International
Based on a work at KM-bias.