Skip to content

Commit

Permalink
I think the calculation for initial EIR values isn't quite right. I d…
Browse files Browse the repository at this point in the history
…on't think it needs to be multiplied by psi. When these values are drawn in lines 135-140 of biting_process.R they get multiplied by psi in line 144. That means we're effectively multiplying these values by psi^2. I think we can correct this by adjusting the calculation thusly.

The two tests at the end would then need adjusting (one way or another) to reflect this change - which could use improving.
  • Loading branch information
RJSheppard committed May 8, 2024
1 parent 7e62cc9 commit b8f3c27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 1 addition & 3 deletions R/biting_process.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ simulate_bites <- function(
calculate_eir <- function(species, solvers, variables, parameters, timestep) {
a <- human_blood_meal_rate(species, variables, parameters, timestep)
infectious <- calculate_infectious(species, solvers, variables, parameters)
age <- get_age(variables$birth$get_values(), timestep)
psi <- unique_biting_rate(age, parameters)
infectious * a * mean(psi)
infectious * a
}

effective_biting_rates <- function(a, .pi, p_bitten) {
Expand Down
10 changes: 8 additions & 2 deletions tests/testthat/test-biology.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ test_that('total_M and EIR functions are consistent with equilibrium EIR', {
})

expect_equal(
actual_EIR,
actual_EIR * 0.766,
# 0.766 is the population average psi under an exponential pop distribution
# There's possibly a better way of calculating this, depending on what exactly
# we're testing here, e.g., we could remove lines 19-21 and omega from line 22
expected_EIR,
tolerance = 1e-2
)
Expand Down Expand Up @@ -51,7 +54,10 @@ test_that('total_M and EIR functions are consistent with equilibrium EIR (with h
})

expect_equal(
actual_EIR,
actual_EIR * 0.766,
# 0.766 is the population average psi under an exponential pop distribution
# There's possibly a better way of calculating this, depending on what exactly
# we're testing here, e.g., we could remove lines 49-51 and omega from line 52
expected_EIR,
tolerance = 1e-2
)
Expand Down

0 comments on commit b8f3c27

Please sign in to comment.