![]() |
EpiNow2 Stan Functions
|
Classes | |
| struct | renewal_state |
Functions | |
| void | check_convolve_len (int n, int D, int len) |
| Eigen::VectorXd | convolve_forward (const Eigen::VectorXd &x, const Eigen::VectorXd &y, int len) |
| void | convolve_reverse (const Eigen::VectorXd &x, const Eigen::VectorXd &y, const Eigen::VectorXd &zbar, Eigen::VectorXd *xbar, Eigen::VectorXd *ybar) |
| void | R_to_r_sums (double r, const Eigen::VectorXd &g, double &s0, double &s1, Eigen::VectorXd *e=nullptr) |
| double | R_to_r_newton (double R, const Eigen::VectorXd &g, double abs_tol) |
| bool | renewal_depletes (int use_pop, int s, int nht) |
| template<typename State > | |
| void | renewal_forward (const Eigen::VectorXd &seed, const Eigen::VectorXd &R, const Eigen::VectorXd &g, double pop, int use_pop, double pop_floor, int nht, State &st) |
| template<typename State > | |
| void | renewal_reverse (const State &st, const Eigen::VectorXd &R, const Eigen::VectorXd &g, int use_pop, const Eigen::VectorXd &Ibar_in, Eigen::VectorXd &seedbar, Eigen::VectorXd &Rbar, Eigen::VectorXd &gbar, double &popbar) |
Variables | |
| constexpr int | R_to_r_max_steps = 100 |
|
inline |
Check that len is a valid output length for the convolution.
| n | Length of x. |
| D | Length of y. |
| len | Requested output length. |
| std::domain_error | if len < n or len > n + D - 1. |
Definition at line 51 of file convolve_with_rev_pmf.hpp.
Referenced by epinow2::convolve_with_rev_pmf().

|
inline |
Forward pass of the convolution on doubles.
Computes z_{d+1:d+m} += w_d x_{1:m} for each lag d, with w_d = y_{D - d}.
| x | Input vector of length n. |
| y | Reversed PMF of length D. |
| len | Output length, n <= len <= n + D - 1. |
Definition at line 71 of file convolve_with_rev_pmf.hpp.
Referenced by epinow2::convolve_with_rev_pmf().

|
inline |
Reverse pass of the convolution on doubles.
Accumulates xbar_{1:m} += w_d zbar_{d+1:d+m} and wbar_d += zbar_{d+1:d+m}^T x_{1:m}, writing wbar_d to ybar_{D - d}.
| x | Input vector of length n. |
| y | Reversed PMF of length D. |
| zbar | Adjoint of the output, of length len. |
| xbar | Adjoint of x, of length n, accumulated into. May be null. |
| ybar | Adjoint of y, of length D, accumulated into. May be null. |
Definition at line 98 of file convolve_with_rev_pmf.hpp.
Referenced by epinow2::convolve_with_rev_pmf().

|
inline |
Solve for the growth rate by Newton's method on doubles.
| R | Reproduction number. |
| g | Reversed generation time PMF. |
| abs_tol | Stop once a step is no larger than this in absolute value. |
Definition at line 88 of file R_to_r.hpp.
References R_to_r_max_steps, and R_to_r_sums().
Referenced by epinow2::R_to_r().


|
inline |
Sums used by the Newton step and the gradient.
Computes S0 = sum_k p_k exp(-r k) and S1 = sum_k k p_k exp(-r k), with p_k = g[G - 1 - k].
| r | Growth rate. |
| g | Reversed generation time PMF. |
| s0 | Set to S0. |
| s1 | Set to S1. |
| e | If not null, set to exp(-r k) in e[G - 1 - k]. |
Definition at line 61 of file R_to_r.hpp.
Referenced by epinow2::R_to_r(), and R_to_r_newton().

|
inline |
Whether susceptible depletion applies at a time step.
| use_pop | Population adjustment (0 none, 1 after nht, 2 all). |
| s | Zero-based time step after the seeds. |
| nht | Number of time steps before the adjustment starts when use_pop = 1. |
Definition at line 87 of file renewal_infections.hpp.
Referenced by renewal_forward().

|
inline |
Forward pass of the renewal equation on doubles.
Fills st with the infections and the values needed by renewal_reverse().
| seed | Seeding infections. |
| R | Reproduction numbers. |
| g | Reversed generation time PMF. |
| pop | Initial susceptible population. |
| use_pop | Population adjustment (0 none, 1 after nht, 2 all). |
| pop_floor | Minimum susceptible population. |
| nht | Number of time steps before the adjustment starts when use_pop = 1. |
| st | State to fill. |
Definition at line 107 of file renewal_infections.hpp.
References renewal_depletes().
Referenced by epinow2::renewal_infections().


|
inline |
Reverse pass of the renewal equation on doubles.
| st | State filled by renewal_forward(). |
| R | Reproduction numbers. |
| g | Reversed generation time PMF. |
| use_pop | Population adjustment (0 none, 1 after nht, 2 all). |
| Ibar_in | Adjoint of the infections, seeds included. |
| seedbar | Set to the adjoint of the seeds. |
| Rbar | Adjoint of R, accumulated into. |
| gbar | Adjoint of g, accumulated into. |
| popbar | Adjoint of pop, accumulated into. |
Definition at line 167 of file renewal_infections.hpp.
Referenced by epinow2::renewal_infections().

|
constexpr |
Maximum number of Newton steps taken by R_to_r_newton().
Definition at line 78 of file R_to_r.hpp.
Referenced by R_to_r_newton().