Changelog
Source:NEWS.md
pmxTools (development version)
Added
sample_nhanes(), which simulates virtual pediatric populations (ages 2-17) with realistic body weight and/or height by MEC-weighted resampling of children from four NHANES releases (2013-2023), bundled asnhanes_peds. Resampling keeps each child’s weight and height together;method = "smooth"adds correlated kernel noise for continuous values.compare_nhanes()andplot_nhanes()check the simulated population against the reference. A new vignette,vignette("nhanes", package = "pmxTools"), walks through them.Added
het_cor(), which computes a correlation matrix for mixed continuous and ordinal variables (Pearson, polyserial or polychoric for each pair) and can draw it withplot_cor_triangle(). The pairwise estimators are available aspolychoric()andpolyserial().
Breaking changes
patchworkhas moved fromDependstoSuggests, solibrary(pmxTools)no longer attaches it. Calllibrary(patchwork)to combine plots with+,/andplot_layout().The PK calculation functions now stop with an error for inputs outside their domain instead of returning
NaN,Infor wrong values: missing or infinite values; non-positive clearances, volumes,ka,dur,tinf,tauorstep; negativetlag,doseor times; akaequal to a disposition rate constant (where the closed-form solution is singular); and, for the steady-state functions, an infusion or zero-order absorption (tinf,dur) longer thantau, which the steady-state solutions do not cover.calc_derived()and thecalc_derived_*()functions now stop when vector inputs have different lengths (other than 1) rather than recycling them.read_nmcov()now labels the rows and columns of the variance-covariance matrix with the parameter names from the.covfile (THETA1,SIGMA(1,1),OMEGA(2,1), …). Rows were previously numbered and column names were altered (SIGMA.1.1.). As a result, the columns ofsample_uncert()output are named after the parameters instead ofV1,V2, …pk_curve()requires a single value for each parameter inparams, since every dose uses the same parameter set. Vectors previously mixed parameter sets across doses.
Bug fixes
pk_curve()now superposes additional doses by the time elapsed since each dose, so irregular time grids, grids not starting at zero andaddldoses beyond the observed window give correct concentrations. A dose scheduled at an observation time is counted there even when rounding makes the computed dose time slightly later (e.g.3 * 0.1 > 0.3). Previously doses were added by shifting rows, which was only correct for regular grids aligned withii.pk_curve(ss = TRUE)now gives a steady-state curve (steady state reached before the dose at time 0, as forSS=1in NONMEM, followed by anyaddldoses and then washout). The argument was previously ignored.pk_curve()also validatesmodel,t,dose,ii,addlandss.calc_derived()and thecalc_derived_*()functions calculateCmax,Tmax,Cmaxss,AUCtauand their dose-normalized forms separately for each parameter set when given vector inputs, returning one value per set. Previously one value was returned from the pooled profiles.AUCtauis now calculated asdose / CL, which is exact at steady state for the package’s linear models, so it no longer depends onstep. The trapezoidal rule on thestepgrid could underestimate it substantially (by 30% for a 0.05 h infusion with the defaultstep, and almost entirely for profiles that decay much faster thanstep), and omitted the end of the interval whenstepdid not dividetau.PKNCAis therefore no longer a dependency.calc_derived()and thecalc_derived_*()functions give the flip-flop kinetics warning once per call rather than once for each internal concentration calculation.CmaxandTmaxfromcalc_derived()and thecalc_derived_*()functions are now found when the peak comes late, e.g. after a longtlag. The search window now allows fortlagand is extended until it contains the peak; previously it could end before absorption started and reportCmax = 0. The search also checks the end of an infusion or of zero-order absorption, so a peak there is found exactly rather than at the neareststep; the steady-state grid used forCmaxssincludes the same points within the dosing interval. A zero dose givesCmax = 0andTmax = 0directly.The steady-state lag-time functions (
calc_ss_*cmt_linear_oral_1_lag()andcalc_ss_*cmt_linear_oral_0_lag()) are now correct whentlagexceeds the time after dose by more than one dosing interval, and when zero-order absorption runs past the end of the interval. Both previously gave wrong, sometimes negative, concentrations.sample_uncert()matches the parameter estimates to the covariance matrix by name rather than by position, and returns a one-row data frame whenn = 1.calc_sd_1cmt(),calc_sd_2cmt(),calc_sd_3cmt(),calc_ss_1cmt(),calc_ss_2cmt()andcalc_ss_3cmt()are now implemented. They choose the regimen-specific function from the parameters given (tinf,dur,ka,tlag); previously they stopped with “Not yet implemented”.read_nmtables()joins each per-subject (FIRSTONLY) table onto the per-record tables byID, whatever the order of its rows and however many table files there are, keeping all per-record rows in their original order. It warns about subjects missing from aFIRSTONLYtable and stops if there is no sharedIDcolumn. Per-record tables are combined row by row only after checking that their shared columns agree, and those columns are kept once.IDmust match exactly; other shared columns such asTIMEmust agree to the precision of the less precise table, so tables written with different$TABLEformats can be combined as long as that precision still tells every record apart. Previously tables could be combined in the wrong row order without warning. Where the shared columns cannot tell records apart (e.g. a dose and an observation at the sameIDandTIME), rows are still combined in file order, as NONMEM writes them;?read_nmtablesdescribes this.read_nmtables()reads tables with exactly three columns and NSIM > 1 output correctly; both previously lost the header row.read_nmtables()andread_nm_multi_table()no longer turn a one-row table into a one-column table.read_nm()now parses the XML document instead of requiring its last line to be</nm:output>, so files with trailing blank lines are read. Unparseable files still give a warning andNULL.read_scm()andplot_scm()no longer pick up objects with the same names from the global environment, andrnm()no longer deletesTHETA,ETADorEPSDobjects from the global environment.read_scm()records the model directory of each step for any path style; previously only Windows paths with an upper-case drive letter were recognized and others wereNA.plot_scm()now draws SCMs that stopped after a single forward step.calc_derived()and thecalc_derived_*()functions now accept several output names intype, as documented, returning a list of those outputs.read_nmtables(quiet = TRUE)no longer reports table files that were not found.ggplot2is now imported selectively instead of in full.
pmxTools 1.6
CRAN release: 2026-10-07
Added
cut_quantile(), which creates quantile-based bins for one or more continuous variables, with per-variable control over the number of groups.Added
datamap(), which plots individual dosing and observation records over time.dgr_table()now takesfieldsas a named character vector mapping column names to display labels. The separatenamesargument is deprecated, but unnamedfieldswithnamescontinues to work.Added dependencies
purrrandtidyr.Fixed
read_nm(), which passed the file extension toxml2::read_xml()as an encoding rather than appending it to the file name, and read the unresolved file name instead of the one located on disk. Thedirectoryargument and file names given without the.xmlextension were therefore ignored, and macOS reported anUnsupported encoding: .xmlwarning (#36).Removed the blanket
statsandutilsimports, which caused areplacing previous import 'stats::filter' by 'dplyr::filter'warning when the package was loaded (#36).calc_derived()and thecalc_derived_*()functions now returnAUCtauandAUCtau_dose_normalizedas plain numbers. PKNCA 0.12.1.9000 attaches amethodattribute to the AUC it returns, which propagated into the derived-parameter list and broke comparisons against plain numeric values (#37).Test snapshots are now committed, the CI workflows have been refreshed, and the documentation has been regenerated with roxygen2 8.1.0 (#36).
calc_derived()and thecalc_derived_*()functions now work with vector inputs (#29).
pmxTools 1.5
CRAN release: 2025-08-25
plot_disthas been rewritten to adapt toggplot24.0.0 changes, and to make it more intuitive to interpretDependency
gghalveshas been removedMany fixes and updates to documentation
pmxTools 1.4
dgr_table()now provides geometric means by defaultgm()now provides options to stripNAvalues (na.rm) and non-positive values (neg.rm) before computation.
pmxTools 1.3
CRAN release: 2023-02-21
Added NCA parameter estimation to
calc_derived_1cpt(),calc_derived_2cpt()andcalc_derived_3cpt(), if dose and other required information (e.g.tinf,dur,tau) is provided.Added a warning about flip-flop kinetics and their potential effects on derived half-lives to
calc_derived_1cpt(),calc_derived_2cpt(), andcalc_derived_3cpt().Added
blq_trans()andblq_log_trans()for assistance with visualization of measurements below a limit of quantification.Added a test for valid XML to
read_nm().Small fixes and enhancements to
read_nmtable_single()andread_nm_multi_table()to ensure that stray text is properly handled while reading in NONMEM output files.count_na()now throws a warning ifNaNvalues are included in theNAcount, and indicates how many of them there are.Changed the significant digits functionality for 95% confidence intervals for
get_theta(),get_omega()andget_sigma(), and all functions that apply these.Replaced
gridExtrawithpatchwork.Numerous small fixes.
Removed some unnecessary dependencies.
Added many new unit tests, increasing test coverage considerably.
pmxTools 1.2.3
CRAN release: 2022-04-06
Fixed another error in
sample_uncert()which was still crashing the function.Added helper functions
count_na(),dgr_table(),gcv(),fmt_signif().Added distribution plotting function
plot_dist().
pmxTools 1.2.2
- Fixed an error in
sample_uncert()which was crashing the function.
pmxTools 1.2.1
CRAN release: 2020-08-26
Added vignette describing PK curves.
Fixed a systematic error in
calc_sd_1cmt_linear_oral_0_lag(),calc_ss_1cmt_linear_oral_0_lag(),calc_sd_2cmt_linear_oral_0_lag()which resulted in incorrect curves being plotted.
pmxTools 1.2
Rewrote
plot_scmfunction to produce tree diagrams viaDiagrammeR.Fixed a rare bug in
get_aucin which measurements from different individuals could be erroneously mixed.Amended (or added)
read_nm(),read_nm_all(),read_nmext(),read_nmcov(),read_nmtables()functions to allow reading of multiple NONMEM estimation steps.Clarified documentation for
calc_derived().Now using
xml2to read NONMEM-generated XML files.Fixed partial argument match warnings encountered during tests.
Add function for calculting geometric CV.