-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
229 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
real gt_mean = rev_pmf_mean(gt_rev_pmf, 1); | ||
real gt_var = rev_pmf_var(gt_rev_pmf, 1, gt_mean); | ||
r = R_to_growth(R, gt_mean, gt_var); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
reports = calculate_secondary( | ||
primary, obs, frac_obs, delay_rev_pmf, cumulative, | ||
historic, primary_hist_additive, current, primary_current_additive, predict | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
reports = convolve_to_report(infections, delay_rev_pmf, seeding_time); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if (week_effect > 1) { | ||
reports = day_of_week_effect(reports, day_of_week, day_of_week_simplex); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
vector[delay_type_max[delay_id] + 1] delay_rev_pmf = get_delay_rev_pmf( | ||
delay_id, delay_type_max[delay_id] + 1, delay_types_p, delay_types_id, | ||
delay_types_groups, delay_max, delay_np_pmf, | ||
delay_np_pmf_groups, delay_mean, delay_sd, delay_dist, | ||
0, 1, 0 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
array[delay_types] int delay_type_max; | ||
for (i in 1:delay_types) { | ||
delay_type_max[i] = 0; | ||
for (j in delay_types_groups[i]:(delay_types_groups[i + 1] - 1)) { | ||
if (delay_types_p[j]) { // parametric | ||
delay_type_max[i] += delay_max[delay_types_id[j]]; | ||
} else { // nonparametric | ||
delay_type_max[i] += delay_np_pmf_groups[delay_types_id[j] + 1] - | ||
delay_np_pmf_groups[delay_types_id[j]] - 1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
delays_lp( | ||
delay_mean, delay_mean_mean, delay_mean_sd, delay_sd, delay_sd_mean, | ||
delay_sd_sd, delay_dist, delay_weight | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
infections = generate_infections( | ||
R, seeding_time, gt_rev_pmf, initial_infections, initial_growth, pop, | ||
future_time | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
vector[delay_type_max[gt_id] + 1] gt_rev_pmf = get_delay_rev_pmf( | ||
gt_id, delay_type_max[gt_id] + 1, delay_types_p, delay_types_id, | ||
delay_types_groups, delay_max, delay_np_pmf, | ||
delay_np_pmf_groups, delay_mean, delay_sd, delay_dist, | ||
1, 1, 0 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
imputed_reports = report_rng(reports, rep_phi, model_type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if (obs_scale) { | ||
frac_obs[1] ~ normal(obs_scale_mean, obs_scale_sd) T[0, 1]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
log_lik = report_log_lik( | ||
cases, obs_reports, rep_phi, model_type, obs_weight | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
report_lp( | ||
cases, obs_reports, rep_phi, phi_mean, phi_sd, model_type, obs_weight | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if (obs_scale) { | ||
reports = scale_obs(reports, frac_obs[1]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
array[delay_n_p] real delay_mean = delay_mean_samples[i]; | ||
array[delay_n_p] real delay_sd = delay_sd_samples[i]; | ||
array[obs_scale] real frac_obs = frac_obs_samples[i]; | ||
array[model_type] real rep_phi = rep_phi_samples[i]; | ||
vector[week_effect] day_of_week_simplex = to_vector( | ||
day_of_week_simplex_samples[i] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
vector[delay_type_max[trunc_id] + 1] trunc_rev_cmf = get_delay_rev_pmf( | ||
trunc_id, delay_type_max[trunc_id] + 1, delay_types_p, delay_types_id, | ||
delay_types_groups, delay_max, delay_np_pmf, | ||
delay_np_pmf_groups, delay_mean, delay_sd, delay_dist, | ||
0, 1, 1 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
array[t - seeding_time] int day_of_week; // day of the week indicator (1 - 7) | ||
int week_effect; // should a day of the week effect be estimated | ||
array[n, week_effect] real<lower = 0> day_of_week_simplex; | ||
array[n, week_effect] real<lower = 0> day_of_week_simplex_samples; | ||
int obs_scale; | ||
array[n, obs_scale] real<lower = 0, upper = 1> frac_obs; | ||
array[n, obs_scale] real<lower = 0, upper = 1> frac_obs_samples; | ||
int model_type; | ||
array[n, model_type] real<lower = 0> rep_phi; // overdispersion of the reporting process | ||
array[n, model_type] real<lower = 0> rep_phi_samples; // overdispersion of the reporting process | ||
int<lower = 0> trunc_id; // id of truncation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
array[seeding_time ? n : 0, 1] real initial_infections; // initial logged infections | ||
array[seeding_time > 1 ? n : 0, 1] real initial_growth; //initial growth | ||
array[seeding_time ? n : 0, 1] real initial_infections_samples; // initial logged infections | ||
array[seeding_time > 1 ? n : 0, 1] real initial_growth_samples; //initial growth | ||
|
||
matrix[n, t - seeding_time] R; // reproduction number | ||
int pop; // susceptible population | ||
array[n, t - seeding_time] real R_samples; // reproduction number | ||
int pop; // susceptible population | ||
|
||
int<lower = 0> gt_id; // id of generation time | ||
int<lower = 0> gt_id; // id of generation time |
Oops, something went wrong.