pmxhelpr 0.5.0
This release simplifies plotting function interfaces, harmonizes naming across the package, replaces the flat theme list with a system of theme and element constructor, and introduces class-tagged stats containers (vpc_stats, doseprop_stats) that can be tabulated and re-plotted with recomputation.
The VPC pipeline is rewritten without the vpc package dependency with comprehensive BLQ handling for standard and prediction- corrected VPCs of the continuous data range and and a new function for VPC plots of the proportion of data BLQ over time.
Breaking changes
Removed functions
-
plot_dvtime_dual()is removed — compose PK and PD panels withplot_dvtime()+patchwork::wrap_plots(). -
df_addn()is removed — replaced byvar_addn(). -
df_pcdv()is removed — replaced byvar_predcorr(). -
df_nobsbin()is removed — bin counting is now integrated intodf_vpcstats(). -
mod_loglog()anddf_loglog()are removed — log-log regression is performed insidedf_doseprop(). -
dvconc_caption()anddvtime_caption()are no longer exported.
Renamed functions
-
df_addpred()is renamed todf_mrgsim_addpred(). -
plot_popgof()/plot_popgof_theme()are renamed toplot_gof()/plot_gof_theme(). -
plot_vpc_exactbins()is renamed toplot_vpc_cont()(arguments revised — see “Removed and renamed arguments”). -
plot_vpclegend()is renamed toplot_vpc_legend(). -
breaks_time()is now an internal helper (var_timebreaks()).
Removed and renamed arguments
-
df_doseprop()andplot_doseprop():metric_varis renamed tometric_name_var, andexp_varis renamed tometric_value_var, to make the role of each column explicit (i.e., exposure metric label variable vs exposure metric value variable). -
df_mrgsim_replicate(): the named-vector argumentsnum_varsandchar_varsare removed; pass extra simulation columns through...tomrgsolve::mrgsim_df()viacarry_out(numeric) andrecover(any type but useful for character / factor). -
plot_dvconc(),plot_dvtime(), andplot_gof(): thecfb(logical) /cfb_base(numeric) argument pair is replaced by a single numericrefargument (NULL= no line). For example,cfb = TRUE, cfb_base = 0becomesref = 0. -
plot_gof():output_colorsis removed — overlay colors for DV, PRED, and IPRED are now set viapmx_color()inplot_gof_theme(). -
plot_vpc_legend():updateis renamed totheme, aligning with the theme-argument convention used by the other plot functions. - All plot functions:
x_breaks,x_scale,x_lab, andy_labare removed — add the equivalentggplot2layers to the returned plot object.
Behavior changes
- The VPC pipeline is rewritten without the
vpcpackage dependency.df_vpcstats()summary column names follow a<role>_<low|med|hi>scheme — simulated quantiles aresim_low_*,sim_med_*,sim_hi_*; observed quantiles areobs_low/med/hi; per-bin counts areobs_nandobs_n_blq(previouslynbin/nobsblq); BLQ proportions (std-VPC only) aresim_prop_blq_*. Themin_bin_countfilter now gates on quantifiable observations (obs_n - obs_n_blq) for VPCs and total observations (obs_n) for cens-VPCs. Comprehensive BLQ handling includes censoring of observed quantiles without censoring simulated data in VPCs and censoring both observed and simulated data at LLOQ before quantile aggregation in pcVPCs. -
plot_vpc_legend(ci)default changes fromc(0.05, 0.95)(vector) to0.90(scalar).lloqnow accepts a vector and renders one legend entry per unique value. -
vpcis removed fromImports(VPC pipeline no longer depends on it). -
patchworkmoves fromImportstoSuggests— install explicitly if you compose multi-panel layouts (e.g. the legend + VPC pattern in the README). -
var_addn()now derives factor levels from the order of first appearance ingrp_var, so a pre-sorted input likec(10, 200, 1000)yields levels in numeric order rather than the alphabetic order returned byfactor(). Removes the need to follow up withforcats::fct_relevel()for numeric dose / time groupings. -
plot_build_vpc(loq = …)supplied explicitly always wins overcompute_out$config$loqand draws one global reference line per unique value. Per-facet(strat_var × LLOQ)dispatch is reserved for the inherited case.
New features
New functions
-
plot_vpc_cont()generates a 1-step (plotvpc_stats) or 2-step (calculate and plot) VPC of the continuous portion of the data range, wrapping bothdf_vpcstatsandplot_build_vpc(). -
plot_vpc_cens()generates a 1-step (plotvpc_stats) or 2-step (calculate and plot) VPC of the censored portion of the data range, wrapping bothdf_vpcstatsandplot_build_vpc(). -
df_vpcstats()computes VPC summary statistics from raw replicate simulation output and returns avpc_stats/pmx_statscontainer. Always emits both standard and prediction-corrected statistics so the same object supports togglingpcvpcwhen plotting. -
plot_build_vpc()renders a VPC ggplot from anyvpc_statscontainer. Use directly when working from a manually-constructed or cachedvpc_statsobject; most users still go throughplot_vpc_cont()and/orplot_vpc_cens. -
plot_build_doseprop()renders a dose-proportionality ggplot from anydoseprop_statscontainer; most users still go throughplot_doseprop(). -
plot_doseprop_theme()is a theme factory forplot_doseprop()with keysobs_pointandlinear. -
plot_gof_shown()andplot_vpc_shown()are constructors for GOF and VPC layer-visibility settings. -
var_addn()generates factor labels with unique-value counts, replacingdf_addn(). -
var_dosenorm()performs dose normalization. -
var_predcorr()performs prediction correction, replacingdf_pcdv().
New arguments
-
df_mrgsim_replicate(parallel = FALSE)— whenTRUE, replicate simulations run viafuture.apply::future_lapply()using the activefutureplan, with per-replicate L’Ecuyer-CMRG RNG streams so output stays reproducible under a fixedseed. Addsfuture.applytoSuggests. -
df_vpcstats()andplot_vpc_cont()gainmode = c("auto", "rank", "drop")controlling how BLQ-encoded values flow into quantile aggregation."auto"(default) resolves to"rank"for std VPC and"drop"for pcVPC. -
df_vpcstats()andplot_vpc_cont()accept per-rowLLOQ(multi-cohort / mid-study assay-update datasets): each observation is censored against its own row’sLLOQ, and stratified plots draw one reference line per(strat × LLOQ)combination. Unique non-NAvalues are exposed viaconfig$loq. -
plot_dvtime()andplot_gof():loq_methodaccepts the character aliases"none","postdose", and"all"in addition to the existing numeric values0,1,2. The legacy numeric form continues to work. -
plot_dvtime()emits a message whenloqis inherited from theLLOQcolumn ofdata, mirroringplot_vpc_cont(). Passloqexplicitly to suppress. -
plot_gof(blq_mode = c("obs", "all"))scopes BLQ imputation to the observedDVlayer (default) or to observed and model-predicted layers. - Time, prediction, and simulated-DV columns across functions are now scalar NSE-friendly arguments (
time_var,ntime_var,pred_var,ipred_var,sim_dv_var) instead of named lists (time_vars,output_vars). Pass arguments as bare names or strings. -
plot_vpc_legend(type = c("cont", "cens"))selects the label set and layer set the legend describes —"cens"relabels the central-tendency entries to"Obs Prop BLQ","Sim Prop BLQ", and"Sim <ci>% CI Prop BLQ"and suppresses all prediction-interval entries, matching theplot_vpc_cens()plot.
Dual-mode pipelines (replot without recompute)
-
plot_doseprop()accepts thedoseprop_statscontainer returned bydf_doseprop()directly. Pass a precomputed result to skip the regression refit and re-plot with differentthemeorsesettings. Pipeline arguments (metrics,metric_name_var,metric_value_var,dose_var,method,ci,sigdigits) cannot be honored on the precomputed path and error with a clear message. -
plot_vpc_cont()accepts thevpc_statscontainer returned bydf_vpcstats()directly. Pass a precomputed result to re-plot with differentmin_bin_count,shown,theme, orpcvpcsettings without re-summarizing. Pipeline arguments (strat_var,loq,mode,pi,ci, column-name args) cannot be honored on the precomputed path and error with a clear message.
Theme system
- New
pmx_theme()factory andpmx_*()element constructors —pmx_point(),pmx_line(),pmx_ribbon(),pmx_errorbar(), andpmx_trend()— replace the previous flat list of role- and geometry-based theme elements. - Theme factory keys follow a
layer_elementconvention (e.g.obs_point,cent_errorbar,ref_line,loq_line). VPC keys follow anelement_statisticconvention aligned with theshownargument (e.g.obs_median_line,sim_pi_ci). - New
pmx_color()constructor sets overlay colors for DV, PRED, and IPRED inplot_gof_theme()— e.g.plot_gof_theme(cent_color = pmx_color(pred = "purple")). - New
pmx_style()convenience constructor applies shared aesthetics (color, alpha) to both point and line elements of a role — e.g.plot_dvtime_theme(obs = pmx_style(alpha = 0.3)). -
+.pmx_theme()and+.pmx_element()methods compose partial themes;pmx_style()shortcuts are applied first and explicit element-level overrides win.
S3 classes and predicates
-
pmx_statsis a shared container withvpc_statsanddoseprop_statssubclasses — slots$stats,$obs,$config— returned bydf_vpcstats()anddf_doseprop(). -
print(),summary(), andas.data.frame()methods onpmx_statsgive a focused REPL view (dimensions, slot row counts, run-config keys) and a plaindata.frameview of$stats. Subclasses overrideprint()/summary()for richer output (column groups for VPC; one-line-per-metricPowerCI+ interpretation for doseprop). -
print()methods onpmx_themeandpmx_elementobjects render a banner + per-field listing instead of the default class-attribute dump. -
pmx_vpc_plotis aggplotsubclass that warns whenfacet_*()layers are added externally, pointing users to thestrat_varargument instead. - Predicates
is_doseprop_stats(),is_pmx_element(),is_pmx_stats(),is_pmx_theme(),is_pmx_vpc_plot(), andis_vpc_stats()are exported. Withstrict = TRUE, the stats and theme predicates run the corresponding structural validator.
Vignettes and documentation
- New
Getting Startedvignette ships with the package for new-user onboarding. - New
Dose-Proportionality Workflowvignette coversdf_doseprop()→plot_build_doseprop()→plot_doseprop(), thedoseprop_stats/pmx_statsclass system, and the precomputed-stats path. - The VPC, GOF, exploratory PK / PK-PD, and plot-themes vignettes are restructured into focused articles with cross-links.
- The
Plot Themes and Aestheticsarticle covers inspectingpmx_element/pmx_themeobjects and composing partial themes with+. - The
Visual Predictive Check Workflowarticle coversdf_vpcstats(),plot_vpc_cens(), the pipeline column contracts (df_mrgsim_replicate()→df_vpcstats()→plot_build_vpc()), and inspection ofvpc_statsobjects. - Narrative vignettes are hosted on the pkgdown site (https://ryancrass.github.io/pmxhelpr/articles/); the installed package no longer ships built vignettes in
inst/doc/, keeping the install footprint small.
Minor improvements and bug fixes
- All exported functions that take column-name arguments accept bare names or strings via a shared NSE-resolution helper.
- Plot functions warn when the input dataset has more than one unique compartment after the
EVID == 0filter, avoiding silently plotting observations from an unintended compartment. -
df_mrgsim_replicate()errors when the user-suppliedcarry_out/recovervalues overlap the wrapped baseline columns, instead of silently shadowing them. - Line-geom aesthetics use
linewidthinstead of the deprecatedsizethroughout. -
df_vpcstats(pcvpc = TRUE)now dropsMDV == 1records from simulated data whenloq = NULLand the input dataset has noLLOQcolumn, mirroring the observed-data path. Previous behavior caused minor quantile drift on bins with NA observations. - Test coverage expanded from ~100 to 800+ tests.
pmxhelpr 0.4.0
- Rename
data_sad_pdasdata_sad. No longer exportdata_sad_pd. - Rename
modelaspkmodelfor consistency withpdmodel. - Rename
pmxhelpr_vpc_themetoplot_vpc_themefor consistency with other plot theme functions - Change
dvconc_captionanddvtime_captionto internal functions after simplifying - Added
cfb_baseargument toplot_gof(was hardcoded as yintercept = 0) - Add helpers for central tendency handing, time variable handling, BLQ imputation, and error bar width setting to remove repetition in function calls
- Expand test coverage and refactor existing tests to reduce redundancy
- Fix bugs and typos globally in package
pmxhelpr 0.3.9
- Add NSE support to accept bare column names in all exported functions (e.g., dv_var = DV) in addition to strings (e.g., dv_var = “DV”) across all exported functions that take column name arguments. Revise vignettes to highlight this functionality.
- Fix bug in
plot_vpclegendthat was resulting in alpha not being correctly applied
pmxhelpr 0.3.8
- Fix bug in
plot_dvtimeto ensure closed circles are plotted in place of open circles for central tendency points - Add minimum R version of 4.4.1 given use of native pipe operator (|>)
pmxhelpr 0.3.7
- Add
plot_dvconcto generate plots of response variables versus drug concentration with LOESS and/or linear trendlines - Add
plot_dvtime_dualwrapper function forplot_dvtimeto plot two dependent variables versus time intended to support simultaneous visualization of PK and PD. - Update
var_addn(formerlydf_addn) to offload factor ordering from the function to simply output. Handling can be done outside the function with alternative packages optimized for dealing with factor variables (e.g.,forcats) - Update
plot_gof_themeto include separate line theme elements for individual observed lines (e.g., spaghetti plots) and central tendency of the observed. - Revise the
Exploratory Data Analysisvignette to include new functionality and revised workflows with new functions. - Fix bug that was not scaling error bar caps for the x-axis range when
cent = "median_iqr"across functions
pmxhelpr 0.3.6
- Add
var_addn(formerlydf_addn) helper function to create and order factor labels including count of unique values to include counts in plot legends - Add
plot_gof_themefunction to set and adjust default aesthetics forplot_gof - Add LLOQ value and linetype to legend in
plot_dvtime - Add caption indicating method of BLQ imputation to
plot_dvtime - Fix bug in
df_pcdvthat was including missing values (MDV=1) in the median PRED calculation for nominal times with missing values, resulting in incorrect PRED-correction of observations in these bins ONLY. Simulated intervals and observed quantile lines were unaffected. - Correct error in documentation of default number of breaks in
breaks_time
pmxhelpr 0.3.5
- Add option to pass the same dataset variable to
time_varandntime_varfor all functions - Add option to control default aesthetics (linewidth, linetype, size, shape, alpha) in
plot_dvtimeandplot_gof - Fix bug in
plot_gofthat was preventing upper error bars from inheriting the color mapped to “DV”
pmxhelpr 0.3.4
- Fix bug in
df_mrgsim_replicatethat was precluding use of non-default time variable names
pmxhelpr 0.3.3
- Fix bug in
plot_dvtimeandplot_gofwhere variable for “DOSE” was being assessed when dosenorm = FALSE - Update
breaks_timeto accept abbreviations for time units
pmxhelpr 0.3.2
- Add
cent = "mean_sdl_upper"option toplot_dvtimeandplot_goffor plotting only the upper error bar - Add
barwidthargument toplot_dvtimeandplot_gofto allow user to change error bar cap width.
pmxhelpr 0.3.1
- Add
plot_gofto generate population overlay goodness-of-fit plots - Add
data_sad_pkfitNONMEM PK model fit output dataset fordata_sadbased onmodel. - Fixed bug in
plot_dvtimethat was leading to plotting mean +/- 2*SD instead of mean +/- SD
pmxhelpr 0.3.0
Added new functionality for dose-proportionality assessment with
df_dosepropandplot_doseprop, including helpersmod_logloganddf_loglogto perform and tabulate power law (log-log) regression of exposure versus doseAdded new internal package dataset
data_sad_ncafor use with dose-proportionality assessment functionsAdded helper function
dvtime_captionto generate the caption forplot_dvtimeAdded helper function
pmxhelpr_vpc_themeto capture default VPC plot aesthetics `Revised vignettes to describe workflow with new default aesthetics
Remove use of
log_yargument in VPC plot examples and added rationale to primary vignette forplot_vpc_exactbinsAdd unit tests for all primary functions
pmxhelpr 0.2.4
- Fix bug in
plot_dvtimeto ensuremedian + IQR error barsprints on both linear and log-scale axes whencent = "median_iqr"
pmxhelpr 0.2.3
- Added
cent = "median_iqr"option toplot_dvtimeto plot median with inter-quartile range error bars - Updated the
ind_dvlogical argument inplot_dvtimetogrp_dvto generalize use of grouping beyond connecting points within an individual subject - Added the
grp_varargument toplot_dvtimeto allow specification of the variable assigned to the group aesthetic by the user. Default isgrp_var = "ID"
pmxhelpr 0.2.2
- Corrected bug in
plot_vpc_exactbinswhen ordered factor variables are pasted to thestrat_varargument. Ordered factors cannot be passed to the underlying stratification function from thevpcpackage (add_stratification()); therefore, ordered factors will be coerced to unordered factors withinplot_vpc_exactbins
pmxhelpr 0.2.0
Added
plot_dvtimefunction for exploratory concentration-time plottingAdded
breaks_timefunction to automatically determine x-axis breaks for timeFunctionality from
breaks_timeadded toplot_vpcexactbinsExploratory Data Analysisvignette created to demonstrate functionality of new functionsAdded dependency:
labelling
pmxhelpr 0.1.4
- Fixed bug leading to error when generating stratified vpcs using the
strat_varargument
pmxhelpr 0.1.3
- Vignette vpc plot axes updated to time unit breaks
- Vignette bullet point lists updated to correct spacing
- Coerce argument
lloqargument ofplot_legend()to character type
pmxhelpr 0.1.0
Full VPC workflow now available in Version 0.1.0 with three vignettes to demonstrate this functionality!
VPC Plot Aestheticsvignette demonstrating options for modifying plot aesthetics, creating a plot legend usingplot_legend(), and adding the VPC plot and legend objects together into a single object using thepatchworkpackage
pmxhelpr 0.0.3
-
Additional functionality for
plot_vpc_exactbins-
shownargument added to facilitate customization of which layers are shown in the plot and standardize with new functionplot_legend. Passed toshowargument ofvpc::vpc()
-
plot_legendhelper function to generate a legend for a VPC plot generated usingplot_vpc_exactbins(), which can be combined with the VPC plot using thepatchworkpackageVPC Plots with BLQ Censoringvignette demonstrating appropriate handling of data missing due to assay sensitivity (below the lower limit of quantification) usingplot_vpc_exactbins()and workflow leveragingdf_mrgsim_replicate.
pmxhelpr 0.0.2
- Additional functionality for
plot_vpc_exactbins-
loqargument added to facilitate incorporating BLQ censoring of observed data in summary quantiles
-
- Bug fix to allow passing argument
vpcdb = TRUEtovpc::vpc()
pmxhelpr 0.0.1
data_sadNONMEM and mrgsolve analysis-ready dataset for a hypothetical SAD study with assessment of food effect.modelmrgsolve model file (classmrgmod) in the internal pmxhelpr model library .model_loadfunction to load internal models from the pmxhelpr model library.df_mrgsim_replicatemrgsim wrapper function to run a simulation that replicates the input dataset multiple times, intended for application to generating Visual Predictive Check (VPC) simulation-based model diagnostics.plot_vpc_exactbinsvpc wrapper function to using an exact time binning variable in the input dataset (e.g. nominal time) with plotting of observed data points using actual time.VPC Plots with Exact Binsvignette demonstrating use case forplot_vpc_exactbins()and workflow leveragingdf_mrgsim_replicate.
