Source code for statsmodels.sandbox.survival

import numpy as np

[docs]class SurvivalTime(object):
[docs] def __init__(self, time, delta): self.time, self.delta = time, delta
[docs] def atrisk(self, time): raise NotImplementedError
[docs]class RightCensored(SurvivalTime):
[docs] def atrisk(self, time): return np.less_equal.outer(time, self.time)
[docs]class LeftCensored(SurvivalTime):
[docs] def atrisk(self, time): return np.greater_equal.outer(time, self.time)