Add plot_serocurve() for population-level serodynamic curve visualization#193
Add plot_serocurve() for population-level serodynamic curve visualization#193
plot_serocurve() for population-level serodynamic curve visualization#193Conversation
Agent-Logs-Url: https://github.com/ucdavis/serodynamics/sessions/18e7ea90-f52f-49ce-a5fb-4e77aec451d2 Co-authored-by: sschildhauer <165851188+sschildhauer@users.noreply.github.com>
plot_serocurve() for population-level serodynamic curve visualization
There was a problem hiding this comment.
@copilot Please create a new branch for this PR entitlted plot_serocurve. Also, this PR should use the code from branch mon_popparams, which as already established an attribute that holds mu.par. Please do not modify any other existing functions or tests in order to create the new plot_serocurve function. Do not modify run_mod or its outputs from the mon_popparams branch. The visualizations look good as is. Keep all edits in this thread. Do not open another pull request.
|
@sschildhauer I've opened a new pull request, #194, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@copilot Please create a new branch for this PR entitlted plot_serocurve. Also, this PR should use the code from branch mon_popparams, which as already established an attribute that holds mu.par. Please do not modify any other existing functions or tests in order to create the new plot_serocurve function. Do not modify run_mod or its outputs from the mon_popparams branch. The visualizations look good as is. Keep all edits and recommendations in this thread. Do not open another pull request. |
…correct population_params format Agent-Logs-Url: https://github.com/ucdavis/serodynamics/sessions/6f0bb3ad-fcef-4813-b663-5194422cd517 Co-authored-by: sschildhauer <165851188+sschildhauer@users.noreply.github.com>
Done (commit
Done (commit |
Adds a new
plot_serocurve()function to visualize estimated antibody response curves at the population level, using posterior samples of themu.parhyperparameter from themon_popparamsbranch implementation ofrun_mod(). No changes are made torun_mod()or any existing functions and tests.New
plot_serocurve()functionKey parameters:
param_source:"population"(default, usesmu.parfrompopulation_paramsattribute; requiresrun_mod(..., with_pop_params = TRUE)) or"newperson"show_ci: 95% credible interval ribbon, defaultTRUEfacet_by_strat/facet_by_antigen_iso: faceting vs. colour-by-stratlog_y,log_x,xlim,show_all_curves: consistent withplot_predicted_curveplot_predicted_curverun_mod()/mon_popparamsbranch integrationThis PR builds on the existing
mon_popparamsbranch, which introducedrun_mod(..., with_pop_params = TRUE)and thepopulation_paramsattribute (long-format tibble with columnsIteration,Chain,Parameter,Iso_type,Stratification,Population_Parameter,value). The helper functionsunpack_jags(),prep_popparams(),ex_popparams(), andparam_recode()from that branch are included unchanged.plot_serocurve()reads thepopulation_paramsattribute, filters toPopulation_Parameter == "mu.par", pivots wider, and transforms log-scale values to the original parameter scale (y0, y1, t1, alpha, shape) before computing curves.Data & tests
nepal_sees_jags_output.rdaregenerated withwith_pop_params = TRUEto include thepopulation_paramsattributeplot_serocurve()