Package io.github.ai4ci.util
Class DelayDistribution
java.lang.Object
io.github.ai4ci.util.DelayDistribution
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ImmutableDelayDistribution
The delay distribution is a probability distribution in time
conditional on an event happening. It is useful to generate a per
day conditional hazard.
Relationships are discrete versions of https://grodri.github.io/glms/notes/c7s1
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
affected
(int intValue) What proportion of individuals expected to have been affected by day X.double[]
the conditional probability density - which will sum to 1double
condDensity
(int x) conditionedOn
(double pAffected) double[]
convolveDensity
(double[] input) double[]
convolveProfile
(double[] input) double
cumulative
(int x) double[]
density()
the improper probability density - which will sum to pAffecteddouble
density
(int x) static DelayDistribution
discretisedGamma
(double mean, double sd) static DelayDistribution
discretisedGamma
(double mean, double sd, int length) static DelayDistribution
empty()
double
expected()
double
expected
(double sampleSize) double
The probability of being affected at time infinity (1-survival_Inf)abstract double[]
int
getQuantile
(double d) double[]
hazard()
the unconditional hazard function.double
hazard
(int x) double
profile
(int x) long
size()
double[]
survival()
the unconditional survival functiontoString()
double
total()
double
totalHazard
(double pEvent) The probability that a repeated event that occurs with pEvent on each day happens at some point over the delay distribution, given that the conditional probabilities on each day add to one, the result will be less than or equal to pEvent.static ImmutableDelayDistribution
unnormalised
(double... profile)
-
Constructor Details
-
DelayDistribution
public DelayDistribution()
-
-
Method Details
-
getProfile
public abstract double[] getProfile() -
total
@Derived public double total() -
getPAffected
@Default public double getPAffected()The probability of being affected at time infinity (1-survival_Inf) -
density
@Derived public double[] density()the improper probability density - which will sum to pAffected -
condDensity
@Derived public double[] condDensity()the conditional probability density - which will sum to 1 -
survival
@Derived public double[] survival()the unconditional survival function -
hazard
@Derived public double[] hazard()the unconditional hazard function. If the affected total (i.e. the hazard at time=infinity) is known then what is the hazard on each day and this is the density on that day divided by the number that survived to that day. -
profile
public double profile(int x) -
density
public double density(int x) -
condDensity
public double condDensity(int x) -
cumulative
public double cumulative(int x) -
hazard
public double hazard(int x) -
expected
public double expected() -
expected
public double expected(double sampleSize) -
conditionedOn
-
size
public long size() -
toString
-
affected
public double affected(int intValue) What proportion of individuals expected to have been affected by day X. (i.e. 1-prob(survived to day X)) -
convolveProfile
public double[] convolveProfile(double[] input) -
convolveDensity
public double[] convolveDensity(double[] input) -
unnormalised
-
empty
-
discretisedGamma
-
discretisedGamma
-
totalHazard
public double totalHazard(double pEvent) The probability that a repeated event that occurs with pEvent on each day happens at some point over the delay distribution, given that the conditional probabilities on each day add to one, the result will be less than or equal to pEvent. This is a way of calculating the total affected when the probability of the event is on a per day basis.- Parameters:
pEvent
-- Returns:
-
getQuantile
public int getQuantile(double d)
-