17 return -log1p((y / alpha) ^-beta);
41 vector[u] integer_lcdf;
45 integer_lcdf[i] = exponential_lcdf(i | emu);
47 }
else if (dist == 2) {
49 integer_lcdf[i] = lognormal_lcdf(i | mu, sigma);
51 }
else if (dist == 3) {
54 integer_lcdf[i] = gamma_lcdf(i | emu, sigma);
56 }
else if (dist == 4) {
62 reject(
"Unknown distribution function provided.");
86 vector[u] adjusted_lcdf;
92 }
else if (max_strat == 1) {
97 adjusted_lcdf = adjusted_lcdf - log(2);
98 }
else if (max_strat == 2) {
109 adjusted_lcdf = lcdf - lcdf[1];
112 adjusted_lcdf = lcdf - log_sum_exp(lcdf[u], lcdf[u-1]);
115 reject(
"Unknown strategy to handle probability mass beyond the maximum value.");
117 return(adjusted_lcdf);
147 lpmf[3:u] = log_diff_exp(lcdf[3:u], lcdf[1:(u-2)]);
208 lccdf = log1m_exp(lcdf[1:(u-2)]);
209 lhaz[2] = lprob[2] - lccdf[1];
214 lhaz[3:(u-1)] = lprob[3:(u-1)] - log_diff_exp(lccdf[2:(u-2)], lcdf[1:(u-3)]);
234 int n = num_elements(lhaz);
237 logit_haz[1:(n-1)] = lhaz[1:(n-1)] - log1m_exp(lhaz[1:(n-1)]);
239 logit_haz[n] = positive_infinity();
287 int max_strat,
int ref_as_p) {
290 vector[dmax] logit_haz;
vector lcdf_to_uniform_double_censored_log_prob(vector lcdf, int u)
real loglogistic_lcdf(real y, real alpha, real beta)
vector normalise_lcdf_as_uniform_double_censored(vector lcdf, int u, int max_strat)
vector lprob_to_uniform_double_censored_log_hazard(vector lprob, vector lcdf, int u)
Compute discretised logit hazard.
vector discretised_logit_hazard(real mu, real sigma, int dmax, int dist, int max_strat, int ref_as_p)
vector log_hazard_to_logit_hazard(vector lhaz)
vector lcdf_discretised(real mu, real sigma, int u, int dist)