epinowcast
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)
 
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)
 

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 
)

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
iIndex for accessing elements in various arrays.
imp_obsArray of imputed observed data, organized by group and time.
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_p,rep_h,ref_as_pFlags indicating presence of reference date, reporting hazards, and reference-as-probability.
g,t,l,pGroup, time, length, and position parameters for data access and processing.
refnp_lhVector of non-parametric reference log hazards.
ref_npFlag indicating presence of non-parametric reference effects.
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 46 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 
)

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
start,endStart and end indexes for the allocation range.
imp_obsArray of imputed observed data, organized by group and time.
rdlurdArray indicating reporting dates lookup reference data.
srdlhVector of standardized reporting date log hazards.
refp_lhMatrix of reference date logit hazards.
dpmfs,sl,csl,sg,stArrays for accessing various indices and supporting data.
ref_p,rep_h,ref_as_pFlags for presence of different hazard effects.
nNumber of discrete points for observations.
refnp_lhVector of non-parametric reference log hazards.
ref_npFlag for non-parametric reference effects.
sdmax,csdmaxArrays of maximum start dates and cumulative start dates.
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 117 of file expected_obs_from.stan.