Class KaplanMeierData

java.lang.Object
qupath.lib.analysis.stats.survival.KaplanMeierData

public class KaplanMeierData extends Object
Structure used to store data related to generating Kaplan-Meier survival curves.
Author:
Pete Bankhead
  • Constructor Details

    • KaplanMeierData

      public KaplanMeierData(String name)
      Create a new KaplanMeierData object with the specified display name.
      Parameters:
      name -
    • KaplanMeierData

      public KaplanMeierData(String name, Collection<KaplanMeierData.KaplanMeierEvent> events)
      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

      public KaplanMeierData addEvent(double time, boolean censored)
      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

      public String 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 from getAllTimes().
      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

      public String toString()
      Overrides:
      toString in class Object