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 |
sschildhauer
left a comment
There was a problem hiding this comment.
@copilot please address all feedback and comments given in this review. Please keep all changes in the same thread for this pull request.
| \item{show_all_curves}{\link{logical}; if \link{TRUE}, overlays all individual | ||
| posterior-sample curves (can be slow for large numbers of samples). | ||
| Defaults to \link{FALSE}.} |
There was a problem hiding this comment.
This piece should be taken out. It would be too large for people to plot all curves from the posterior.
There was a problem hiding this comment.
Removed show_all_curves parameter and all related implementation code in commit a7974e0.
| \item{alpha_samples}{\link{numeric}; transparency level (0-1) for individual | ||
| sample curves when \code{show_all_curves = TRUE}. Defaults to \code{0.3}.} |
There was a problem hiding this comment.
This should also be taken out as we will not be plotting individual curves
There was a problem hiding this comment.
Removed alpha_samples parameter in commit a7974e0.
| Plots the estimated antibody response curve derived from posterior samples | ||
| of population-level (\code{mu.par}) or "new person" parameters from a fitted | ||
| \code{\link[=run_mod]{run_mod()}} model. A median curve with an optional 95\% credible interval | ||
| ribbon is produced for each requested antigen-isotype and stratification | ||
| combination. | ||
| } |
There was a problem hiding this comment.
It would be good to change references to "new person" as being the "predictive distribution".
There was a problem hiding this comment.
Updated in commit a7974e0. The "newperson" option now reads: "uses the predictive distribution for a new individual drawn from the population-level prior".
…tion to predictive distribution Agent-Logs-Url: https://github.com/ucdavis/serodynamics/sessions/64eb25a1-7d2a-4ab5-b24a-5dc03686f3ee Co-authored-by: sschildhauer <165851188+sschildhauer@users.noreply.github.com>
All review feedback addressed in 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"(uses the predictive distribution for a new individual drawn from the population-level prior)show_ci: 95% credible interval ribbon, defaultTRUEfacet_by_strat/facet_by_antigen_iso: faceting vs. colour-by-stratlog_y,log_x,xlim: 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()