Adding population parameters as attributes#141
Conversation
❌ 5 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
|
📖 https://ucd-serg.github.io/serodynamics/preview/pr141 |
|
I am unsure why these final tests aren't passing. @Kwan-Jenny Any thoughts? |
I am not sure what’s causing these final test failures. It may be helpful to ask @d-morrison for his thoughts. |
|
Hi @d-morrison , I have not seen this review fail message. I am a but confused how this came up as I made very few changes from the last review. It looks like it might have something to do with package dependencies, but unsure. Once this is done I can send up the posterior predictive check for review. |
| results |> | ||
| expect_snapshot_data( | ||
| "sim-strat-curve-params", | ||
| variant = darwin_variant() | ||
| ) |
There was a problem hiding this comment.
All expect_snapshot_data(..., variant = darwin_variant()) calls will use the default snapshot variant (no variant) on Linux/Windows because darwin_variant() returns NULL there. However, the PR removes the default snapshot directory (tests/testthat/_snaps/run_mod/), leaving only tests/testthat/_snaps/darwin/run_mod/, so these snapshot expectations will fail on non-macOS CI. Re-add/commit the non-variant snapshots under _snaps/run_mod/ (including the new popparam-summary-stats.csv) or adjust the variant logic so non-darwin platforms resolve to an existing snapshot set.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 34 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
R/Run_Mod.R:39
- The documented returned columns use lowercase
iteration/chain, but the actual output columns areIterationandChain. Please update the roxygen list to match the real column names so users can reliably work withrun_mod()output.
#' including the following:
#' - `iteration` = Number of sampling iterations
#' - `chain` = Number of MCMC chains run; between 1 and 4
#' - `Parameter` = Parameter being estimated. Includes the following:
|
@copilot apply changes based on the comments in this thread |
…add Linux snapshots Agent-Logs-Url: https://github.com/ucdavis/serodynamics/sessions/4b06b305-9888-4e79-9089-e597844015fc Co-authored-by: sschildhauer <165851188+sschildhauer@users.noreply.github.com>
Applied in commit 43129e0:
Applied in commit 43129e0:
Fixed in commit 43129e0. The open issues were:
|
Merge branch 'mon_popparams' of https://github.com/UCD-SERG/serodynamics into mon_popparams # Conflicts: # R/as_case_data.R
|
@copilot Please suggest a solution about how to make sure all tests are passing in the reviews above. Only focus on making the tests pass without recommending unrelated changes. Please include recommendations in this thread. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
R/Run_Mod.R:267
calc_fit_mod()is called withoriginal_data = dl_sub, but whenstrathas multiple levelsdl_subonly contains the last stratum processed in the loop. This meansfitted_residualswill be computed for only that final stratum and will silently omit residuals for earlier strata. Consider computing fitted/residuals per-stratum inside the loop and binding them, or pass the full input data (and/or include stratification in the join) sofitted_residualscovers all strata injags_out.
# Calculating fitted and residuals
# Renaming columns using attributes from as_case_data
fit_res <- calc_fit_mod(modeled_dat = jags_out,
original_data = dl_sub)
jags_out <- jags_out |>
structure(fitted_residuals = fit_res)
… at position [2] Agent-Logs-Url: https://github.com/ucdavis/serodynamics/sessions/93798c2d-4272-4802-b85a-3f031f17c05c Co-authored-by: sschildhauer <165851188+sschildhauer@users.noreply.github.com>
The only remaining failure was Fixed in commit 316f600: restored the explicit attribute list construction using an anonymous function |
Kwan-Jenny
left a comment
There was a problem hiding this comment.
Everything looks good and ready to move forward. It’s time to ask Ezra for a review. Great job, Sam!
|
Hi @d-morrison, this PR developed change more files than I had originally thought. A lot of snaps and documentation were changed. Apologies for having so many changes in one PR. I am still working through better compartmentalizing. Changes non-related to my primary PR: Reviews were not passing for some of the documentation, specifically when referring to tbl_df and referencing run_mod, so I had to change the documentation across many functions. I am not sure what changed here, if it was a package requirement that changed. Thinking about it now, perhaps I should have started another branch where I fixed the above issues but got caught up in this PR that I was having a hard time sorting out what was related and what was not. Happy to discuss further. Thank you so much for taking a look! |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
R/Run_Mod.R:264
calc_fit_mod()is called after the stratification loop withoriginal_data = dl_sub, butdl_subis the last stratum subset. For stratified runs (and especially when subject IDs repeat across strata), this can produce incorrect fitted/residuals (missing strata or duplicated merges) because fitted/residuals are computed against only one subset without stratification context. Consider computing fitted/residuals per-stratum inside the loop (and binding results, optionally adding a Stratification column), or otherwise ensure the full original data and stratification key are used when calculating fitted/residuals.
structure(priors = attributes(priorspec)$used_priors)
# Calculating fitted and residuals
# Renaming columns using attributes from as_case_data
fit_res <- calc_fit_mod(modeled_dat = jags_out,
The primary goal of this pull request is to have a command that allows us to monitor population parameters and include them as attributes. Given that the population parameters are quite large, the default is currently set to not include them, which could make sense in the situation that you are modeling specifically for input into serocalculator. However, if comparing the estimated population level parameters between stratification it may make sense to include population level parameters.
as_case_data also had to be modified in order to pass tests as the current code was restructuring the output data in a way that was making tests fail -- the order of the columns would differ between runs. I would have preferred to fix this in another PR but I was not able to get reviews to check without making this alteration.