|
epinowcast
|
Go to the source code of this file.
Functions | |
| int | enw_to_pcens_dist_id (int dist) |
| array[] real | enw_to_pcens_params (real mu, real sigma, int dist) |
| vector | log_hazard_to_logit_hazard (vector lhaz) |
| vector | lprob_to_log_hazard (vector lprob, int u) |
| vector | discretised_pcens_logit_hazard (real mu, real sigma, int dmax, int dist, int ref_as_p) |
| vector discretised_pcens_logit_hazard | ( | real | mu, |
| real | sigma, | ||
| int | dmax, | ||
| int | dist, | ||
| int | ref_as_p ) |
Discretise a parametric delay distribution using primary event censoring
Computes the log probability mass function of a double interval censored delay distribution using the vendored primarycensored Stan functions and, optionally, converts it to logit hazards (the output contract of log_hazard_to_logit_hazard()).
| mu | Location parameter of the parametric distribution (epinowcast transformed scale). |
| sigma | Scale parameter of the parametric distribution (epinowcast transformed scale). |
| dmax | Maximum possible delay. The distribution is discretised over delays 0 to (dmax - 1) and normalised over that range. |
| dist | epinowcast model_refp distribution id (1: exponential, 2: lognormal, 3: gamma). |
| ref_as_p | Flag indicating whether to return log probabilities directly (1) or to convert to logit hazards (0). |
Definition at line 178 of file primarycensored_pmf.stan.
| int enw_to_pcens_dist_id | ( | int | dist | ) |
Primary event censored discretisation wrapper for epinowcast
Wraps the vendored primarycensored Stan functions (see primarycensored.stan) to discretise a parametric reference date delay distribution. This accounts for double interval censoring: a uniform primary event window convolved with a secondary reporting interval, with right truncation at the maximum delay. Translate an epinowcast distribution id to a primarycensored dist_id
epinowcast uses model_refp ids (1: exponential, 2: lognormal, 3: gamma) which differ from primarycensored's pcd_stan_dist_id() convention (1: lognormal, 2: gamma, 3: weibull, 4: exponential). This function maps the supported epinowcast ids onto the primarycensored ids.
| dist | epinowcast model_refp distribution id. |
Definition at line 33 of file primarycensored_pmf.stan.
| array[] real enw_to_pcens_params | ( | real | mu, |
| real | sigma, | ||
| int | dist ) |
Translate epinowcast (mu, sigma) parameters to primarycensored parameters
epinowcast parameterises its parametric reference delay distributions on a transformed scale (e.g. log rate for the exponential, log shape for the gamma). The vendored primarycensored functions expect the native Stan parameterisation. This function performs the translation.
| mu | Location parameter on the epinowcast transformed scale. |
| sigma | Scale parameter on the epinowcast transformed scale. |
| dist | epinowcast model_refp distribution id. |
Definition at line 60 of file primarycensored_pmf.stan.
| vector log_hazard_to_logit_hazard | ( | vector | lhaz | ) |
Convert log hazards to logit hazards
Transforms log hazards to logit hazards without converting to the natural scale.
| lhaz | Vector of log hazards. |
Definition at line 97 of file primarycensored_pmf.stan.
| vector lprob_to_log_hazard | ( | vector | lprob, |
| int | u ) |
Convert a proper discretised log PMF to logit hazards
Computes logit hazards from a non-overlapping discretised log PMF (such as the one returned by the primarycensored functions) using the standard discrete survival hazard h_d = p_d / S_{d-1}, where the survival function is S_{d-1} = 1 - sum_{i < d} p_i.
| lprob | Vector of log probabilities, one per discrete delay 0:(u - 1). |
| u | Number of discrete delays (length of lprob). |
Definition at line 124 of file primarycensored_pmf.stan.