Class KaplanMeierEstimator

java.lang.Object
adaa.analytics.rules.logic.representation.KaplanMeierEstimator
All Implemented Interfaces:
Serializable

public class KaplanMeierEstimator extends Object implements Serializable
Represents a Kaplan-Meier estimator of survival function.
See Also:
  • Field Details

    • NotAssigned

      public static final int NotAssigned
      Array of survival estimator points
      See Also:
    • times

      public double[] times
    • eventsCounts

      public int[] eventsCounts
    • censoredCounts

      public int[] censoredCounts
    • atRiskCounts

      public int[] atRiskCounts
    • probabilities

      public double[] probabilities
    • filled

      public int filled
  • Constructor Details

    • KaplanMeierEstimator

      public KaplanMeierEstimator()
      Creates empty instance.
    • KaplanMeierEstimator

      public KaplanMeierEstimator(IExampleSet data)
      Generates survival estimator function from survival data.
      Parameters:
      data - Example set with attribute of SurvivalRule.SURVIVAL_TIME_ROLE.
    • KaplanMeierEstimator

      public KaplanMeierEstimator(IExampleSet data, Set<Integer> indices)
      Generates survival estimator function from survival data.
      Parameters:
      data - Example set with attribute of SurvivalRule.SURVIVAL_TIME_ROLE.
      indices - Indices of the examples to be taken into account when building the estimator.
  • Method Details

    • save

      public String save()
      Converts estimator to the text.
      Returns:
      Estimator in the text form.
    • load

      public void load(String s)
      Loads estimator from the text.
      Parameters:
      s - Estimator in the text form.
    • reserve

      protected void reserve(int size)
    • average

      public static KaplanMeierEstimator average(KaplanMeierEstimator[] estimators)
      Average several estimators.
      Parameters:
      estimators - Array of estimators to be averaged.
      Returns:
      Average estimator.
    • getTimes

      public ArrayList<Double> getTimes()
      Extracts time points from estimator.
      Returns:
      Array of time points.
    • getProbabilityAt

      public double getProbabilityAt(double time)
      Calculates survival probability at given time.
      Parameters:
      time - Time.
      Returns:
      Survival probability.
    • getEventsCountAt

      public int getEventsCountAt(double time)
      Gets number of events at given time point.
      Parameters:
      time - Time.
      Returns:
      Number of events.
    • getRiskSetCountAt

      public int getRiskSetCountAt(double time)
      Gets risk at given time.
      Parameters:
      time - Time.
      Returns:
      Risk.
    • reverse

      public KaplanMeierEstimator reverse()
      Creates reveresed K-M estimator.
      Returns:
      Reversed estimator.
    • calculateProbability

      protected void calculateProbability()
      Fills the probabilities in K-M estimator.