extract_time()

Extract the times from an event-time vector.

Usage

Source

extract_time(x)

The shape depends on the data: a 1-D array when no element is interval-censored, otherwise a 2-D array with columns time and time_max, where time_max is missing (nan) for elements that aren’t interval-censored.

Parameters

x: Any
An EventTime vector.

Returns

numpy.ndarray
A 1-D float array of times, or a 2-D float array of shape (n, 2) holding time and time_max when any element is interval-censored.

Examples

import greenwood as gw

x = gw.event_time(time=[7, 5, 2], status=["e", "r", "i"], time_max=[None, None, 4])
gw.extract_time(x)
array([[ 7., nan],
       [ 5., nan],
       [ 2.,  4.]])

Without intervals, the result is 1-D:

gw.extract_time(x[0:2])
array([7., 5.])