epinowcast
Loading...
Searching...
No Matches
expected_obs_from.stan File Reference

Go to the source code of this file.

Functions

vector expected_obs_from_index (int i, array[] vector imp_obs, array[,] int rdlurd, vector srdlh, matrix refp_lh, array[] int dpmfs, int ref_p, int rep_h, int ref_as_p, int g, int t, int l, vector refnp_lh, int ref_np, int p, int rep_agg_p, array[,,] int rep_agg_n_selected, array[,,,] int rep_agg_selected_idx)
 
vector expected_obs_from_snaps (int start, int end, array[] vector imp_obs, array[,] int rdlurd, vector srdlh, matrix refp_lh, array[] int dpmfs, int ref_p, int rep_h, int ref_as_p, array[] int sl, array[] int csl, array[] int sg, array[] int st, int n, vector refnp_lh, int ref_np, array[] int sdmax, array[] int csdmax, int rep_agg_p, array[,,] int rep_agg_n_selected, array[,,,] int rep_agg_selected_idx)
 

Function Documentation

◆ expected_obs_from_index()

vector expected_obs_from_index ( int i,
array[]vector imp_obs,
array int rdlurd[,],
vector srdlh,
matrix refp_lh,
array[]int dpmfs,
int ref_p,
int rep_h,
int ref_as_p,
int g,
int t,
int l,
vector refnp_lh,
int ref_np,
int p,
int rep_agg_p,
array int rep_agg_n_selected[,,],
array int rep_agg_selected_idx[,,,] )

Calculate expected observations for a given index

Computes the expected observations for a specific time index by combining final observed/imputed expected observation with time effects. This function integrates various hazard effects and reference adjustments to produce the expected observations.

Parameters
startStart index for the range of interest.
endEnd index for the range of interest.
obsArray of observed data, stored as a flat vector.
slArray of start index for each observation period.
cslArray of cumulative start indexes.
nslArray of next start indexes, indicating the start of the next period.
cnslArray of cumulative next start indexes.
obs_lookupArray of indexes linking observed data to modeled expectations.
imp_obsArray of imputed observed data, organized by group and time.
sgArray indicating group index for each observation.
stArray indicating time index for each observation.
rdlurdArray indicating reporting dates lookup reference data.
srdlhVector of standardized reporting date log hazards.
refp_lhMatrix of reference date logit hazards.
dpmfsArray of indices for accessing reference date effects in refp_lh.
ref_pBinary flag for reference date effects presence.
rep_hBinary flag for reporting hazard effects presence.
ref_as_pBinary flag indicating if reference date input should be treated as probability.
phiArray of dispersion parameters for negative binomial distribution.
model_obsBinary flag indicating if a negative binomial model is used.
refnp_lhVector of non-parametric reference log hazards.
ref_npBinary flag for non-parametric reference effects presence.
sdmaxArray of maximum start dates for each period.
csdmaxArray of cumulative start dates.
rep_agg_pBinary flag indicating whether reporting probabilities should be aggregated for structural reporting patterns (e.g., fixed reporting cycles).
rep_agg_n_selected3D array of counts of selected indices per row for probability aggregation, with dimensions [groups, times, max_delay].
rep_agg_selected_idx4D array of column indices for aggregation, with dimensions [groups, times, max_delay, max_delay].
iIndex for accessing elements in various arrays.
gGroup index for data access.
tTime index for data access.
lLength parameter for data processing.
pPosition parameter for data access.
Returns
A vector of expected observations for the given index.
Note
This function performs several steps:
  1. Retrieves the final observed/imputed expected observation for the given group and time.
  2. Aggregates various hazard effects using combine_logit_hazards.
  3. Combines the final expected observation with the time-varying effects to compute the expected observations using expected_obs.

Dependencies:

  • combine_logit_hazards
  • expected_obs

Definition at line 32 of file expected_obs_from.stan.

◆ expected_obs_from_snaps()

vector expected_obs_from_snaps ( int start,
int end,
array[]vector imp_obs,
array int rdlurd[,],
vector srdlh,
matrix refp_lh,
array[]int dpmfs,
int ref_p,
int rep_h,
int ref_as_p,
array[]int sl,
array[]int csl,
array[]int sg,
array[]int st,
int n,
vector refnp_lh,
int ref_np,
array[]int sdmax,
array[]int csdmax,
int rep_agg_p,
array int rep_agg_n_selected[,,],
array int rep_agg_selected_idx[,,,] )

Calculate expected observations for a set of indexes

Computes expected observations for a range of time indexes, effectively aggregating individual calculations over a specified range. This function considers various factors like hazard effects, reference adjustments, and grouping to produce expected observations for each index within the range.

Parameters
startStart index for the range of interest.
endEnd index for the range of interest.
obsArray of observed data, stored as a flat vector.
slArray of start index for each observation period.
cslArray of cumulative start indexes.
nslArray of next start indexes, indicating the start of the next period.
cnslArray of cumulative next start indexes.
obs_lookupArray of indexes linking observed data to modeled expectations.
imp_obsArray of imputed observed data, organized by group and time.
sgArray indicating group index for each observation.
stArray indicating time index for each observation.
rdlurdArray indicating reporting dates lookup reference data.
srdlhVector of standardized reporting date log hazards.
refp_lhMatrix of reference date logit hazards.
dpmfsArray of indices for accessing reference date effects in refp_lh.
ref_pBinary flag for reference date effects presence.
rep_hBinary flag for reporting hazard effects presence.
ref_as_pBinary flag indicating if reference date input should be treated as probability.
phiArray of dispersion parameters for negative binomial distribution.
model_obsBinary flag indicating if a negative binomial model is used.
refnp_lhVector of non-parametric reference log hazards.
ref_npBinary flag for non-parametric reference effects presence.
sdmaxArray of maximum start dates for each period.
csdmaxArray of cumulative start dates.
rep_agg_pBinary flag indicating whether reporting probabilities should be aggregated for structural reporting patterns (e.g., fixed reporting cycles).
rep_agg_n_selected3D array of counts of selected indices per row for probability aggregation, with dimensions [groups, times, max_delay].
rep_agg_selected_idx4D array of column indices for aggregation, with dimensions [groups, times, max_delay, max_delay].
nNumber of discrete points for observations.
Returns
A vector of expected observations across the specified range of indexes.
Note
This function executes the following steps:
  1. Iteratively processes each index in the specified range.
  2. For each index, it identifies the relevant group, time, and length parameters necessary for the calculation.
  3. Calls expected_obs_from_index for each index to compute the expected observations.
  4. Aggregates these individual expected observations into a single vector corresponding to the entire range.

Dependencies:

  • expected_obs_from_index

Definition at line 94 of file expected_obs_from.stan.