Class KaplanMeierEstimator
java.lang.Object
adaa.analytics.rules.logic.representation.KaplanMeierEstimator
- All Implemented Interfaces:
Serializable
Represents a Kaplan-Meier estimator of survival function.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionint[]
int[]
int[]
int
static final int
Array of survival estimator pointsdouble[]
double[]
-
Constructor Summary
ConstructorsConstructorDescriptionCreates empty instance.Generates survival estimator function from survival data.KaplanMeierEstimator
(IExampleSet data, Set<Integer> indices) Generates survival estimator function from survival data. -
Method Summary
Modifier and TypeMethodDescriptionstatic KaplanMeierEstimator
average
(KaplanMeierEstimator[] estimators) Average several estimators.protected void
Fills the probabilities in K-M estimator.int
getEventsCountAt
(double time) Gets number of events at given time point.double
getProbabilityAt
(double time) Calculates survival probability at given time.int
getRiskSetCountAt
(double time) Gets risk at given time.getTimes()
Extracts time points from estimator.void
Loads estimator from the text.protected void
reserve
(int size) reverse()
Creates reveresed K-M estimator.save()
Converts estimator to the text.
-
Field Details
-
NotAssigned
public static final int NotAssignedArray 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
Generates survival estimator function from survival data.- Parameters:
data
- Example set with attribute ofSurvivalRule.SURVIVAL_TIME_ROLE
.
-
KaplanMeierEstimator
Generates survival estimator function from survival data.- Parameters:
data
- Example set with attribute ofSurvivalRule.SURVIVAL_TIME_ROLE
.indices
- Indices of the examples to be taken into account when building the estimator.
-
-
Method Details
-
save
Converts estimator to the text.- Returns:
- Estimator in the text form.
-
load
Loads estimator from the text.- Parameters:
s
- Estimator in the text form.
-
reserve
protected void reserve(int size) -
average
Average several estimators.- Parameters:
estimators
- Array of estimators to be averaged.- Returns:
- Average estimator.
-
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
Creates reveresed K-M estimator.- Returns:
- Reversed estimator.
-
calculateProbability
protected void calculateProbability()Fills the probabilities in K-M estimator.
-