nlmixr2plot 5.2.0
CRAN release: 2026-09-22
Added automatic model diagrams (#10).
modelGraph()parses a model’s differential equations (from a model function,rxode2model/UI or annlmixr2fit) into a graph of compartments and flows (mass transfer, eliminations, inputs and non-mass-transfer interactions like effect compartments or PD stimulation/inhibition), detecting dosing compartments from the dosing records.modelDiagram()lays it out with dosing and absorption compartments above the central compartment, peripheral compartments to the left, eliminations/metabolites below and PD models to the right, and draws it with the"DiagrammeR"(Graphviz),"ggplot2"or"dot"(DOT source) engine. Dosing properties (lag(),f(),rate(),dur()) are shown as annotations on their compartment, anddelay()terms are understood. The diagrams were checked against all 3043 models of ‘nlmixr2lib’, including large QSP/PBPK models.plot()of anrxode2user interface (rxUi) object or compiledrxode2model draws its diagram, and the new “Automatic model diagrams” vignette describes the feature.Fixed
vpcPlot()withmethod = "tidyvpc"when the observed data has observation records with a missingDV. Those records were dropped from the observed data but kept in the simulation, so a stratified (e.g. multiple-endpoint) VPC errored and a single-endpoint VPC paired simulated values with the wrong observations. The matching simulated records are now dropped too (#74).plot()of a multiple-endpoint fit no longer creates empty “Endpoint:” groups for state compartments without observations (likedepotorcentral); only observed endpoints are plotted.plot()of anaugPred()object likewise skips endpoints without data (#44).vpcPlot()/vpcPlotTad()of a multiple-endpoint fit whose data codes the endpoints withcmtno longer shows an extraNApanel (or a singleNApanel withpred_corr = TRUE); the simulated compartment labels are now matched to the observed ones by name (#44).The censored VPC (
vpcCens(), orvpcPlot()withcens = TRUEand thevpcbackend) of a multiple-endpoint fit now stratifies by its endpoints only, matching the simulated endpoints to the observed ones; an endpoint whose observations are all missing no longer becomes anNApanel (#44).plot()of a censored multiple-endpoint fit no longer errors ingeom_cens()(“argument must be coercible to non-negative integer”) for an endpoint without censored observations (#44).The censored VPC (
vpcCens(),vpcCensTad(), orvpcPlot()withcens = TRUEand thevpcbackend) now honours thedataargument; it previously always used the fitted data, whateverdatawas supplied (#55). The observed data now comes from the original (or supplied) dataset instead of the fit, so censored records are identified from theCENScolumn rather than from the fit’s imputedDV(which, forcensMethod = "cdf", could land above the limit and be counted as uncensored). Records without an observation are dropped, as in the fit.The VPC observed data now drops records with
MDV = 1even when anEVIDcolumn is also present (previously onlyEVIDwas checked when both existed).plot()of anaugPred()object now accepts a base-R stylelogargument (log = "y","x"or"xy") to draw the individual plots on log-scaled axes; non-positive values, which cannot be shown on a log axis, are dropped (#32).vpcPlot(),vpcPlotTad(),vpcCens()andvpcCensTad()now use a suppliednlmixr2est::vpcSim()simulation instead of discarding it and re-simulating with the defaultn = 300. Supplyingnalongside a simulation warns that it is ignored, andpred_corr = TRUEerrors unless the simulation was created withpred = TRUE(#57). The observed-data prediction correction for a supplied simulation is computed from that simulation’s own fit rather than from whichevervpcSim(pred = TRUE)ran last.Fixed the VPC simulation ignoring the
dataargument ofvpcPlot(),vpcPlotTad(),vpcCens()andvpcCensTad(); the simulation always used the fit’s dataset, so it did not match the observed data built fromdata(andtidyvpcwarned thatxsimdid not match the observed x-values). The simulation now usesdatawhen supplied. A suppliednlmixr2est::vpcSim()simulation was made from its own dataset, so passingdataalongside one now warns that it only replaces the observed data (#68). Because the simulation now followsdata, an endpoint without observations indatais no longer simulated either, so it drops out of a multiple-endpoint VPC instead of being shown as a simulated-only panel. For a model with a non-normal endpoint,datanow needs a numericCMTcolumn (the model’s compartment numbers), since the compartments would otherwise be taken from the fitted data by row number, or read from a factor’s level order, and would not matchdata.Fixed the prediction-corrected VPC (
pred_corr = TRUE) ignoring thedataargument; the observed data was rebuilt from the fit’s dataset instead of the supplieddata(#62).Fixed stratified censored VPCs (
vpcCens()/vpcCensTad(), orvpcPlot()withcens = TRUE) failing with “The following specified stratification columns were NOT found in observation data”; the observed data now comes from the original (or supplied) dataset, which keeps the stratification columns that the fit table drops (#56, #55).Fixed the confidence-band width (and its legend label) for
vpcPlot()/vpcPlotTad()with thetidyvpcbackend;ci = c(lower, upper)was passed totidyvpc::vpcstats()asconf.level = ci[2]instead of the actual interval widthci[2] - ci[1], so the defaultci = c(0.05, 0.95)(a 90% CI) was drawn and labeled as a 95% CI.Fixed
vpcPlotTad()/vpcCensTad()(and anyidvtaken from the fit) with a user-supplieddatathat is a subset or reordering of the fitted data;tadwas merged from the fit by row number, so it silently becameNA(or was paired with the wrong row). Each supplied row is now matched by content to the fitted row it came from, and a warning is given for observations that are not in the fitted data (#60).
nlmixr2plot 5.1.0
CRAN release: 2026-08-05
- Fixed an “object of type ‘closure’ is not subsettable” error in
vpcCensTad()(andvpcCens()/vpcPlot()/vpcPlotTad()withcens = TRUEand a non-timeidv); the censored VPC now passes thesim/obscolumn mappings tovpc::vpc_cens()explicitly instead of relying on column guessing (nlmixr2#390). - Fixed the censored VPC confidence band, which was computed as if every simulated row were its own replicate. The simulated
dvis now mapped to thesimcolumn instead of being copied into a newdvcolumn, sovpcgroups the simulated data by replicate as it does for the uncensored VPC. - Fixed a
quantile()“missing values and NaNs not allowed” error in prediction-correctedvpcPlot()/vpcPlotTad()on censored (LLOQ/ULOQ) fits with thevpcbackend; censored records are now dropped before the pred-corrected VPC (which is shown for non-censored data only), matching thevpcpackage’s stated behavior (nlmixr2#390). - Fixed prediction-corrected
vpcPlot()/vpcPlotTad()withmethod = "tidyvpc", cens = TRUE, which previously errored that the observed data had nocenscolumn; the censoring column is now retained when the observed dataset is rebuilt for pred-correction. -
plot()on a fit with between-subject variability (BSV) now adds a nested"bsv"section (inside each data/compartment group) with QQ plots for each BSV parameter, BSV-BSV correlation plots (when more than one BSV parameter is present) and, via the newcovariateargument, BSV-by-covariate plots (box-and-whisker for categorical or low-cardinality covariates, scatter plus a linear trend with confidence interval for continuous ones). Covariate values are taken from each subject’s first record, so they are assumed time-invariant (#51). - Plot collections returned by
plot()(for fits andaugPredobjects) are nowgglistobjects from theggtibblepackage instead of the internalnlmixr2PlotListclass. They still print/plot all figures at once and support broadcastingggplot2additions (e.g.plot(fit) + ggplot2::theme_bw()), and the top-level object remains a named, nested collection (plot(fit)[["Endpoint: ..."]]). The collection can also be converted to aggtibblefor reporting withggtibble::as_ggtibble(). - Individual/
augPredplots are now paginated withggforce::facet_wrap_paginate(), removing the hand-written 16-IDs-per-page chunking. Requiresggtibble (>= 1.0.3.9000)andggforce; the minimum R version is now 4.3. -
plot()on a fit (and on anaugPredobject) is now about 3x faster. The paginated individual plots were expanded one-per-page withggtibble::as_gglist(), which deep-copies the plot throughserialize()/unserialize(); because those plots are built inside functions that hold the whole fit, each copy walked the entire fit object. The pages are now produced by re-adding the paginated facet for each page instead. - Removed obsolete
rxode2::.linCmtSensB()test guards. That internal was removed fromrxode2in 2025, so thetry()/skip_if_not()checks always fell through and never skipped.linCmt()gradients are now always available, so the guards are unnecessary and the tests run unconditionally.
nlmixr2plot 5.0.2
CRAN release: 2026-06-11
- Fixed an error when plotting models without compartments (#33)
nlmixr2plot 3.0.3
CRAN release: 2025-08-23
- Updated tests and added
Opsmethod (removing+method) to work with ggplot2 version 4 (#39)
nlmixr2plot 3.0.1
CRAN release: 2025-02-14
- Added the ability to add ggplot items to a nlmixr2 plot list with
+
nlmixr2plot 2.0.9
CRAN release: 2024-05-29
- Bug fix for
vpcPlot()where input data frame for models did not stratify all the time when the columns were upper case.
nlmixr2plot 2.0.8
CRAN release: 2024-01-31
plot()now returns a named list of lists so that users can more easily choose which plots to include, if all plots are not desired. Or the user could use those names as the basis of figure captions (fix #8).Models without eta values (between subject variability) now have more consistent plotting to models with eta values (fix #18).
The package was updated to align with changes in ggplot2.
The package was updated to skip tests with
"focei"andlinCmt()
