diff --git a/R/extract.R b/R/extract.R index 4201ef393..9e21e6a8a 100644 --- a/R/extract.R +++ b/R/extract.R @@ -119,7 +119,7 @@ extract_parameter_samples <- function(stan_fit, data, reported_dates, reported_i out$growth_rate <- extract_parameter( "r", samples, - reported_dates[-1] + reported_dates ) if (data$week_effect > 1) { out$day_of_week <- extract_parameter( diff --git a/inst/stan/estimate_infections.stan b/inst/stan/estimate_infections.stan index c36ea58b0..24b3b56c9 100644 --- a/inst/stan/estimate_infections.stan +++ b/inst/stan/estimate_infections.stan @@ -138,7 +138,7 @@ model { generated quantities { int imputed_reports[ot_h]; vector[estimate_r > 0 ? 0: ot_h] R; - real r[ot_h - 1]; + real r[ot_h]; vector[return_likelihood > 1 ? ot : 0] log_lik; if (estimate_r == 0){ // sample generation time @@ -148,8 +148,7 @@ generated quantities { R = calculate_Rt(infections, seeding_time, gt_mean_sample, gt_sd_sample, max_gt, rt_half_window); } - // estimate growth from infections - r = calculate_growth(infections, seeding_time + 1); + r = calculate_growth(infections, seeding_time); // simulate reported cases imputed_reports = report_rng(reports, rep_phi, obs_dist); // log likelihood of model diff --git a/inst/stan/simulate_infections.stan b/inst/stan/simulate_infections.stan index 8275990a5..f1c11906b 100644 --- a/inst/stan/simulate_infections.stan +++ b/inst/stan/simulate_infections.stan @@ -26,7 +26,7 @@ generated quantities { matrix[n, t] infections; //latent infections matrix[n, t - seeding_time] reports; // observed cases int imputed_reports[n, t - seeding_time]; - real r[n, t - seeding_time - 1]; + real r[n, t - seeding_time]; vector[seeding_time] uobs_inf; for (i in 1:n) { uobs_inf = generate_seed(initial_infections[i], initial_growth[i], seeding_time); @@ -49,6 +49,6 @@ generated quantities { } // simulate reported cases imputed_reports[i] = report_rng(to_vector(reports[i]), rep_phi[i], obs_dist); - r[i] = calculate_growth(to_vector(infections[i]), seeding_time + 1); + r[i] = calculate_growth(to_vector(infections[i]), seeding_time); } }