epinowcast
|
Go to the source code of this file.
Functions | |
vector | prob_to_hazard (vector p) |
vector | cumulative_converse_log_hazard (vector h, int l) |
vector | hazard_to_log_prob (vector h, int l) |
vector cumulative_converse_log_hazard | ( | vector | h, |
int | l | ||
) |
Compute the cumulative converse log hazard
Calculates the cumulative sum of the converse of log hazards. This function shifts the hazard vector by one time unit, applies the converse log transformation, and then computes the cumulative sum.
h | Vector of hazards. |
l | Length of the vector. |
\[ ch_i = \sum_{j=1}^{i} \log(1 - h_{j-1}) \]
where\[ h_{0} \]
is considered to be 0.Definition at line 44 of file hazard.stan.
vector hazard_to_log_prob | ( | vector | h, |
int | l | ||
) |
Convert hazards to log probabilities
Transforms a vector of hazards into log probabilities. This function uses the hazards to compute the log probabilities for each time point. Internally it calls cumulative_converse_log_hazard
to compute part of the log probability.
h | Vector of hazards. |
l | Length of the vector. |
\[ p_i = \log(h_i) + \text{cumulative_converse_log_hazard}(h_i) \]
This function callscumulative_converse_log_hazard
for part of its computation.Dependencies:
Definition at line 78 of file hazard.stan.
vector prob_to_hazard | ( | vector | p | ) |
Convert probabilities to hazards
Transforms a vector of probabilities into hazards. This function calculates the hazard for each time point based on the given probabilities.
p | Vector of probabilities. |
\[ h_i = \frac{p_i}{1 - \sum_{j=1}^{i-1} p_j} \]
The final hazard (h_l) is set to 1.Definition at line 15 of file hazard.stan.