epinowcast
|
Go to the source code of this file.
Functions | |
array[] vector | log_expected_obs_from_latent (array[] vector exp_llatent, int rd_n, vector w, array[] int v, array[] int u, int t, int g, vector latent_obs_prop) |
array[] vector log_expected_obs_from_latent | ( | array[]vector | exp_llatent, |
int | rd_n, | ||
vector | w, | ||
array[]int | v, | ||
array[]int | u, | ||
int | t, | ||
int | g, | ||
vector | latent_obs_prop | ||
) |
Compute log of expected observations from latent values
This function calculates the expected observations in log scale based on latent expected values, weighting factors, and observational proportions. The weighting factors are derived from a sparse matrix, which is constructed using the csr_extract
and convolution_matrix
R functions in epinowcast
.
exp_llatent | Array of vectors of log latent expected values. |
rd_n | Length of the reporting delay (1 for immediate reporting). |
w | Vector of weighting factors derived from a sparse matrix. |
v,u | Arrays for sparse matrix representation, as obtained from csr_extract . |
t | Number of time periods. |
g | Number of groups. |
latent_obs_prop | Vector of observational proportions for latent values. |
rd_n
:rd_n
is 1 (immediate reporting): a. Directly adds the log latent values, log of weights, and observational proportions for each group.rd_n
> 1 (delayed reporting): a. Uses a convolution matrix constructed using convolution_matrix
or otherwise, representing reporting delays. b. Prior to being used as an input this is converted to a sparse matrix format using csr_extract
. c. Applies the sparse matrix multiplication to the latent values in a sparse matrix multiplication. d. Converts the resulting values back to the log scale and adds the observational proportions for each group.These steps account for different reporting delays and the distribution of observations over time.
csr_matrix
and convolution_matrix
stan function and epinowcast R function for details on sparse matrix construction and convolution matrix generation. Definition at line 50 of file log_expected_obs_from_latent.stan.