Skip to content

Commit

Permalink
remove double counting of PBS and SW
Browse files Browse the repository at this point in the history
  • Loading branch information
edknock committed Oct 16, 2024
1 parent c58d642 commit 73cd635
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
8 changes: 2 additions & 6 deletions inst/dust/model-targeted-vax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,22 +817,18 @@ class model_targeted_vax {
const real_type cases_inc_00_04 = state[7];
const real_type cases_inc_05_14 = state[8];
const real_type cases_inc_15_plus = state[9];
const real_type cases_inc_SW = state[11];
const real_type cases_inc_PBS = state[10];
const real_type deaths_inc = state[4];
const real_type deaths_inc_00_04 = state[13];
const real_type deaths_inc_05_14 = state[14];
const real_type deaths_inc_15_plus = state[15];
const real_type deaths_inc_SW = state[17];
const real_type deaths_inc_PBS = state[16];
real_type model_cases = cases_inc + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_cases_00_04 = cases_inc_00_04 + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_cases_05_14 = cases_inc_05_14 + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_cases_15_plus = cases_inc_15_plus + cases_inc_PBS + cases_inc_SW + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_cases_15_plus = cases_inc_15_plus + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths = deaths_inc + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths_00_04 = deaths_inc_00_04 + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths_05_14 = deaths_inc_05_14 + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths_15_plus = deaths_inc_15_plus + deaths_inc_PBS + deaths_inc_SW + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths_15_plus = deaths_inc_15_plus + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
const auto compare_cases = (std::isnan(data.cases)) ? 0 : dust::density::poisson(data.cases, model_cases, true);
const auto compare_cases_00_04 = (std::isnan(data.cases_00_04)) ? 0 : dust::density::poisson(data.cases_00_04, model_cases_00_04, true);
const auto compare_cases_05_14 = (std::isnan(data.cases_05_14)) ? 0 : dust::density::poisson(data.cases_05_14, model_cases_05_14, true);
Expand Down
6 changes: 2 additions & 4 deletions inst/odin/model-targeted-vax.R
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,7 @@ model_cases_05_14 <- cases_inc_05_14 + rexp(exp_noise)
compare(cases_05_14) ~ poisson(model_cases_05_14)

cases_15_plus <- data()
model_cases_15_plus <- cases_inc_15_plus + cases_inc_PBS + cases_inc_SW +
rexp(exp_noise)
model_cases_15_plus <- cases_inc_15_plus + rexp(exp_noise)
compare(cases_15_plus) ~ poisson(model_cases_15_plus)

# deaths
Expand All @@ -584,6 +583,5 @@ model_deaths_05_14 <- deaths_inc_05_14 + rexp(exp_noise)
compare(deaths_05_14) ~ poisson(model_deaths_05_14)

deaths_15_plus <- data()
model_deaths_15_plus <- deaths_inc_15_plus + deaths_inc_PBS + deaths_inc_SW +
rexp(exp_noise)
model_deaths_15_plus <- deaths_inc_15_plus + rexp(exp_noise)
compare(deaths_15_plus) ~ poisson(model_deaths_15_plus)
8 changes: 2 additions & 6 deletions src/model-targeted-vax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,22 +891,18 @@ class model_targeted_vax {
const real_type cases_inc_00_04 = state[7];
const real_type cases_inc_05_14 = state[8];
const real_type cases_inc_15_plus = state[9];
const real_type cases_inc_SW = state[11];
const real_type cases_inc_PBS = state[10];
const real_type deaths_inc = state[4];
const real_type deaths_inc_00_04 = state[13];
const real_type deaths_inc_05_14 = state[14];
const real_type deaths_inc_15_plus = state[15];
const real_type deaths_inc_SW = state[17];
const real_type deaths_inc_PBS = state[16];
real_type model_cases = cases_inc + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_cases_00_04 = cases_inc_00_04 + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_cases_05_14 = cases_inc_05_14 + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_cases_15_plus = cases_inc_15_plus + cases_inc_PBS + cases_inc_SW + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_cases_15_plus = cases_inc_15_plus + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths = deaths_inc + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths_00_04 = deaths_inc_00_04 + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths_05_14 = deaths_inc_05_14 + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths_15_plus = deaths_inc_15_plus + deaths_inc_PBS + deaths_inc_SW + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
real_type model_deaths_15_plus = deaths_inc_15_plus + dust::random::exponential<real_type>(rng_state, shared->exp_noise);
const auto compare_cases = (std::isnan(data.cases)) ? 0 : dust::density::poisson(data.cases, model_cases, true);
const auto compare_cases_00_04 = (std::isnan(data.cases_00_04)) ? 0 : dust::density::poisson(data.cases_00_04, model_cases_00_04, true);
const auto compare_cases_05_14 = (std::isnan(data.cases_05_14)) ? 0 : dust::density::poisson(data.cases_05_14, model_cases_05_14, true);
Expand Down

0 comments on commit 73cd635

Please sign in to comment.