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

Go to the source code of this file.

Functions

real delay_snap_lpmf (array[] int dummy, int start, int end, array[] int obs, array[] int sl, array[] int csl, array[] int nsl, array[] int cnsl, array[] int obs_lookup, array[] vector imp_obs, array[] int sg, array[] int st, array[,] int rdlurd, vector srdlh, matrix refp_lh, array[] int dpmfs, int ref_p, int rep_h, int ref_as_p, array[] real phi, int model_obs, vector refnp_lh, int ref_np, array[] int sdmax, array[] int csdmax)
 
real delay_group_lpmf (array[] int groups, int start, int end, array[] int obs, array[] int sl, array[] int csl, array[] int nsl, array[] int cnsl, array[] int obs_lookup, array[] vector imp_obs, int t, array[] int sg, array[,] int ts, array[] int st, array[,] int rdlurd, vector srdlh, matrix refp_lh, array[] int dpmfs, int ref_p, int rep_h, int ref_as_p, array[] real phi, int model_obs, int model_miss, int miss_obs, array[] int missing_reference, array[,] int obs_by_report, vector miss_ref_lprop, array[] int sdmax, array[] int csdmax, array[] int miss_st, array[] int miss_cst, vector refnp_lh, int ref_np)
 

Function Documentation

◆ delay_group_lpmf()

real delay_group_lpmf ( array[]int  groups,
int  start,
int  end,
array[]int  obs,
array[]int  sl,
array[]int  csl,
array[]int  nsl,
array[]int  cnsl,
array[]int  obs_lookup,
array[]vector  imp_obs,
int  t,
array[]int  sg,
array int  ts[,],
array[]int  st,
array int  rdlurd[,],
vector  srdlh,
matrix  refp_lh,
array[]int  dpmfs,
int  ref_p,
int  rep_h,
int  ref_as_p,
array[]real  phi,
int  model_obs,
int  model_miss,
int  miss_obs,
array[]int  missing_reference,
array int  obs_by_report[,],
vector  miss_ref_lprop,
array[]int  sdmax,
array[]int  csdmax,
array[]int  miss_st,
array[]int  miss_cst,
vector  refnp_lh,
int  ref_np 
)

Log probability mass function for delayed group data

Computes the log probability mass for a range of time indexes in delayed group data. It manages data filtering, allocation for expected log observations, and handles missing data if applicable.

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.
groupsArray of group identifiers.
tInteger representing the current time index.
groupsArray of group identifiers.
tsArray of snapshot indices by time and group.
model_missBinary flag indicating if missing observations should be modeled (0 = no, 1 = yes).
miss_obsNumber of observations with missing reference dates.
missing_referenceArray of observations reported without a reference date (by reporting time).
obs_by_reportArray of observation indices by reference date for entries in missing_reference.
miss_ref_lpropVector of log probabilities for missing reference dates.
miss_stArray of start indices for observations by group in missing_reference.
miss_cstArray of cumulative start indices for observations by group in missing_reference.
Returns
Log probability mass of the observations for the specified range.
Note
This function performs the following operations:
  1. Determines the relevant range for observed and missing data.
  2. Filters and allocates expected log observations, handling missing data.
  3. Computes expected log observations using expected_obs_from_snaps.
  4. Applies the observation error model using obs_lpmf.
  5. Additionally, handles missing data using apply_missing_reference_effects and log_expected_by_report if model_miss is 1.

Dependencies:

  • filt_obs_indexes
  • expected_obs_from_snaps
  • obs_lpmf
  • allocate_observed_obs
  • apply_missing_reference_effects
  • log_expected_by_report.

This function is similar to delay_snap_lpmf but is specifically designed for group data and includes additional steps for missing data.

Definition at line 122 of file delay_lpmf.stan.

◆ delay_snap_lpmf()

real delay_snap_lpmf ( array[]int  dummy,
int  start,
int  end,
array[]int  obs,
array[]int  sl,
array[]int  csl,
array[]int  nsl,
array[]int  cnsl,
array[]int  obs_lookup,
array[]vector  imp_obs,
array[]int  sg,
array[]int  st,
array int  rdlurd[,],
vector  srdlh,
matrix  refp_lh,
array[]int  dpmfs,
int  ref_p,
int  rep_h,
int  ref_as_p,
array[]real  phi,
int  model_obs,
vector  refnp_lh,
int  ref_np,
array[]int  sdmax,
array[]int  csdmax 
)

Log probability mass function for delayed snapshot data

Computes the log probability mass for a range of time indexes in delayed snapshot data. It applies filters to identify relevant observations and calculates the expected log observations based on various inputs.

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.
dummyDummy array parameter, not used in the calculation.
Returns
Log probability mass of the observations for the specified range.
Note
This function performs the following operations:
  1. Determines the relevant range of observed data and lookup indexes.
  2. Filters the observed data and lookup indexes for the specified range.
  3. Computes expected log observations using expected_obs_from_snaps.
  4. Applies the observation error model using obs_lpmf.

Dependencies:

  • filt_obs_indexes
  • expected_obs_from_snaps
  • obs_lpmf

This function is similar to delay_group_lpmf but operates on snapshot data rather than group data.

Definition at line 28 of file delay_lpmf.stan.