Skip to content

Commit

Permalink
Hot fix: ww_data_eval extended through forecast period (#258)
Browse files Browse the repository at this point in the history
* fix typo in indexing, downsample should extend to otbserved time + horizon time not nowcast time

* 2024-12-04 update : fixing wrong argument in format_ww_data funx.

* fix bug
'

---------

Co-authored-by: cbernalz <[email protected]>
  • Loading branch information
kaitejohnson and cbernalz authored Dec 5, 2024
1 parent baf614b commit bc89b7b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
1 change: 0 additions & 1 deletion R/generate_simulated_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ generate_simulated_data <- function(r_in_weeks = # nolint
n_lab_sites = n_lab_sites,
ht = ht,
ot = ot,
nt = nt,
lab_site_reporting_freq = lab_site_reporting_freq
)

Expand Down
6 changes: 1 addition & 5 deletions R/model_component_fwd_sim.R
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@ get_pred_obs_conc <- function(n_lab_sites,
#' for in the calibration period
#' @param ht integer indicating the time after the last observed time to
#' the end of the forecast time
#' @param nt integer indicating the time after the last observed epi indicator
#' and before the forecast date, of which there can still be wastewater
#' observations
#' @param lab_site_reporting_freq vector indicating the mean frequency of
#' wastewater measurements in each site per day (e.g. 1/7 is once per week)

Expand All @@ -306,12 +303,11 @@ downsample_for_frequency <- function(log_conc_lab_site,
n_lab_sites,
ot,
ht,
nt,
lab_site_reporting_freq) {
log_obs_conc_lab_site <- matrix(nrow = n_lab_sites, ncol = ot + ht)
for (i in 1:n_lab_sites) {
# Get the indices where we observe concentrations
st <- sample(1:(ot + nt), round((ot + nt) * lab_site_reporting_freq[i]))
st <- sample(1:(ot + ht), round((ot + ht) * lab_site_reporting_freq[i]))
# Calculate log concentration for the days that we have observations
log_obs_conc_lab_site[i, st] <- log_conc_lab_site[i, st]
}
Expand Down
5 changes: 0 additions & 5 deletions man/downsample_for_frequency.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bc89b7b

Please sign in to comment.