updating to directly input ACH and infer riskiness. User defined efficacy from delta ACH#142
updating to directly input ACH and infer riskiness. User defined efficacy from delta ACH#142cwhittaker1000 wants to merge 54 commits into
Conversation
|
Aim with this PR is get The aim with doing this is to enable us to calculate efficacy not as a single input value, but as a function of ACH in each location; whilst also retaining the ability to specify riskiness, again in a location specific manner. This is very rough, but based on our convo today, it seems like there are 4 broad pieces of work to be done here (not necessarily in this order):
|
…ose on the riskiness distribution
|
Updates:
|
…r each type of location, etc.)
…etting_specific_ach script
|
Summary of changes:
|
…ific function based on tests
| #ach to efficacy parameters_workplace | ||
| far_uvc_workplace_ach_efficacy_relationship = NULL, #constant or sigmoid | ||
| far_uvc_workplace_efficacy = NULL, #constant | ||
| far_uvc_workplace_max_efficacy = NULL, # sigmoid |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| far_uvc_workplace_max_efficacy = NULL, # sigmoid | |
| far_uvc_workplace_max_efficacy = NULL, # sigmoid |
| #ach to efficacy parameters_school | ||
| far_uvc_school_ach_efficacy_relationship = NULL, #constant or sigmoid | ||
| far_uvc_school_efficacy = NULL, #constant | ||
| far_uvc_school_max_efficacy = NULL, # sigmoid |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| far_uvc_school_max_efficacy = NULL, # sigmoid | |
| far_uvc_school_max_efficacy = NULL, # sigmoid |
| set_uvc_ach <- function (parameters_list, | ||
| setting, | ||
| coverage, | ||
| coverage_target, | ||
| coverage_type, | ||
| timestep, | ||
| relationship_type, | ||
| max_efficacy, | ||
| sigmoid_k, | ||
| sigmoid_x0) { | ||
|
|
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| set_uvc_ach <- function (parameters_list, | |
| setting, | |
| coverage, | |
| coverage_target, | |
| coverage_type, | |
| timestep, | |
| relationship_type, | |
| max_efficacy, | |
| sigmoid_k, | |
| sigmoid_x0) { | |
| set_uvc_ach <- function( | |
| parameters_list, | |
| setting, | |
| coverage, | |
| coverage_target, | |
| coverage_type, | |
| timestep, | |
| relationship_type, | |
| max_efficacy, | |
| sigmoid_k, | |
| sigmoid_x0 | |
| ) { |
|
|
||
|
|
| setting = "household" | ||
| ) | ||
|
|
||
|
|
| if (any(parameters_list$far_uvc_joint, | ||
| parameters_list$far_uvc_workplace, | ||
| parameters_list$far_uvc_school, | ||
| parameters_list$far_uvc_leisure, | ||
| parameters_list$far_uvc_household)) { |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| if (any(parameters_list$far_uvc_joint, | |
| parameters_list$far_uvc_workplace, | |
| parameters_list$far_uvc_school, | |
| parameters_list$far_uvc_leisure, | |
| parameters_list$far_uvc_household)) { | |
| if ( | |
| any( | |
| parameters_list$far_uvc_joint, | |
| parameters_list$far_uvc_workplace, | |
| parameters_list$far_uvc_school, | |
| parameters_list$far_uvc_leisure, | |
| parameters_list$far_uvc_household | |
| ) | |
| ) { |
| parameters_list[paste0("far_uvc_", setting_types, "_efficacy")] <- parameters_list$far_uvc_joint_efficacy | ||
| parameters_list[paste0("far_uvc_", setting_types, "_timestep")] <- parameters_list$far_uvc_joint_timestep |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| parameters_list[paste0("far_uvc_", setting_types, "_efficacy")] <- parameters_list$far_uvc_joint_efficacy | |
| parameters_list[paste0("far_uvc_", setting_types, "_timestep")] <- parameters_list$far_uvc_joint_timestep | |
| parameters_list[paste0( | |
| "far_uvc_", | |
| setting_types, | |
| "_efficacy" | |
| )] <- parameters_list$far_uvc_joint_efficacy | |
| parameters_list[paste0( | |
| "far_uvc_", | |
| setting_types, | |
| "_timestep" | |
| )] <- parameters_list$far_uvc_joint_timestep |
… tests to check that it works
…tions to interventions.R
|
@geethaj1 - quick q as I'm running through the code. Are there any files in |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
cwhittaker1000
left a comment
There was a problem hiding this comment.
Great stuff @geethaj1 - really impressive work here. Everything looks broadly right to me - some minor comments/questions enclosed and I think the big piece is tidying this up and documentation improvements ahead of merge. Congrats!
| volume_per_person_leisure = 8, # 2m^2*4M | ||
| volume_per_person_household = 50, # 20m^2 * 2.5m | ||
|
|
||
| # W-R parameters |
There was a problem hiding this comment.
Let's have a conversation about how much we want to expose these parameters - I think doing so is fine but useful to have a conversation about helper functions vs forcing users to input these directly etc.
| # far_uvc_household_sigmoid_x0 = NULL, | ||
|
|
||
| # Intervention parameters (Wells-Riley ACH-based efficacy): | ||
| intervention_joint_active = FALSE, |
There was a problem hiding this comment.
I don't think any of these parameters are currently documented in the above documentation on inputs or elsewhere? I'm currently having to infer and understand them based on context and reading other parts of the codebase, which is time consuming. Can you make sure all these are documented and described please?
| intervention_household_covered = NULL, | ||
|
|
||
| # Room Size Per Individual Parameters: | ||
| size_per_individual_workplace = 1, |
There was a problem hiding this comment.
Do we still need these if we have the volume parameters above?
| ) | ||
| } | ||
| } | ||
| # # Old targeted_riskiness validation against the removed far_uvc_* config |
There was a problem hiding this comment.
Same comment as above - I think you can get rid of this and remove the commented code. If you're unsure whether we might need to return to it, save this version of parameters.R in an inst folder called old_scripts or similar. Remember we have version control so can always go back to this commit to view it either way!
| # calculation runs through the same code path. | ||
| for (s in c("workplace", "school", "leisure")) { | ||
| parameters_list[[paste0("intervention_", s, "_active")]] <- TRUE | ||
| parameters_list[[paste0("intervention_", s, "_list")]] <- parameters_list$intervention_joint_list |
There was a problem hiding this comment.
What is this parameter intervention_joint_list - I can't figure it out and where it's used/what for?
There was a problem hiding this comment.
Is the list of things like what it does to modify ACH etc that we discussed?
There was a problem hiding this comment.
Yes, intervention_joint_list stores the list of interventions (in this branch its just 1 intervention), and describes the characteristics of the intervention. It's used in calculate_efficacy_from_ach to get information about the interventino, and in generate_joint-intervention_switches for coverage allocation.
| variation_function = NULL, | ||
| variation_params = list(), | ||
| coverage = NULL) { | ||
| list( |
There was a problem hiding this comment.
I think we need some checks in here - if affected_by_baseline_ach is set to FALSE, then baseline_ach_function should be NULL right?
Related point is that none of these parameters are documented or particularly clear - I think we need clearer documentation of what they are and what they mean/correspond to.
| coverage_target, | ||
| coverage_type, | ||
| timestep, | ||
| ...) { |
There was a problem hiding this comment.
Instead of having the ... why not just force the user to pass in the list directly?
| # Efficacy at location i = 1 - p_post[i] / p_pre[i], where the post-intervention | ||
| # alpha is augmented by the sum of intervention deltas (zeroed for uncovered | ||
| # locations via the coverage vector). | ||
| calculate_efficacy_from_ach <- function(ach_values, parameters_list, setting) { |
There was a problem hiding this comment.
this is really nice work Geetha!
|
|
||
|
|
||
| # ============================================================================= | ||
| # Helper functions for ACH / efficacy / UV-C conversions |
There was a problem hiding this comment.
haven't looked at the below in detail as presume they're helper functions not used anywhere much. Let me know if that seems wrong
baseline_ach_function -> delta_function baseline_ach_params -> delta_params affected_by_baseline_ach -> delta_depends_on_baseline_ach better represents that they describe the delta the intervention adds (and whether that delta depends on baseline ACH).
As above; this addresses and answers #136 - @geethaj1 will be handling this.