epinowcast
log_expected_by_report.stan File Reference

Go to the source code of this file.

Functions

vector log_expected_by_report (vector log_exp, array[,] int obs_by_report)
 

Function Documentation

◆ log_expected_by_report()

vector log_expected_by_report ( vector  log_exp,
array int  obs_by_report[,] 
)

Calculate log of expected values by report date

Computes the logarithm of expected values aggregated by report date. This function takes a vector of logarithmic expected values and an array indicating observations by report date, and then calculates the log of the sum of exponentials of expected values for each report date.

Parameters
log_expVector of log expected values.
obs_by_reportArray indicating which observations correspond to each report date.
Returns
Vector of log expected values aggregated by report date.
Note
The computation for a report date i is given by:

\[ \text{log\_exp\_rep}_i = \log\left(\sum_{j \in \text{obs\_by\_report}[i]} \exp(\text{log\_exp}_j)\right) \]

This represents the log-sum-exp operation over the expected values corresponding to the observations reported on date i.

Definition at line 23 of file log_expected_by_report.stan.