Class KaplanMeierData
java.lang.Object
qupath.lib.analysis.stats.survival.KaplanMeierData
Structure used to store data related to generating Kaplan-Meier survival curves.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSimple class to store event time and censored flag. -
Constructor Summary
ConstructorsConstructorDescriptionKaplanMeierData(String name) Create a new KaplanMeierData object with the specified display name.KaplanMeierData(String name, Collection<KaplanMeierData.KaplanMeierEvent> events) Create a new KaplanMeierData object with the specified display name and events. -
Method Summary
Modifier and TypeMethodDescriptionaddEvent(double time, boolean censored) Insert a new event.Add a collection of events.double[]Retrieve a sorted array containing all times where 'something happened' (observed or censored).intgetAtRisk(double t) Get the number at risk at a specified time.Get an unmodifiable list of all events.intgetEventsAtTime(double t) Get the number of events at a specified time (exactly).doubleGet the time of the last event, or -1 if there are no events.getName()Get the name of this data, generally used for display.double[]Retrieve a sorted array containing the value corresponding to a time fromgetAllTimes().booleanisEmpty()Returns true if there are no events included.intGet the number of censored events.intnEvents()Get the number of events, either observed or censored.intGet the number of observed (not censored) events.toString()
-
Constructor Details
-
KaplanMeierData
Create a new KaplanMeierData object with the specified display name.- Parameters:
name-
-
KaplanMeierData
Create a new KaplanMeierData object with the specified display name and events.- Parameters:
name-events-
-
-
Method Details
-
addEvents
Add a collection of events.- Parameters:
events-- Returns:
-
addEvent
Insert a new event.- Parameters:
time- the time of the event (units are not specified, but should be consistent for all events added)censored- if true the event is censored, if false the event is observed.- Returns:
-
getName
Get the name of this data, generally used for display.- Returns:
-
isEmpty
public boolean isEmpty()Returns true if there are no events included.- Returns:
-
getEvents
Get an unmodifiable list of all events.- Returns:
-
getAllTimes
public double[] getAllTimes()Retrieve a sorted array containing all times where 'something happened' (observed or censored).- Returns:
- See Also:
-
getStatistic
public double[] getStatistic()Retrieve a sorted array containing the value corresponding to a time fromgetAllTimes().- Returns:
- See Also:
-
getMaxTime
public double getMaxTime()Get the time of the last event, or -1 if there are no events.- Returns:
-
getAtRisk
public int getAtRisk(double t) Get the number at risk at a specified time. This includes events that occur precisely at the time specified.- Parameters:
t-- Returns:
-
getEventsAtTime
public int getEventsAtTime(double t) Get the number of events at a specified time (exactly).- Parameters:
t-- Returns:
-
nEvents
public int nEvents()Get the number of events, either observed or censored.- Returns:
-
nObserved
public int nObserved()Get the number of observed (not censored) events.- Returns:
-
nCensored
public int nCensored()Get the number of censored events.- Returns:
-
toString
-