Skip to main content
. Author manuscript; available in PMC: 2013 Aug 1.
Published in final edited form as: Ther Drug Monit. 2012 Aug;34(4):467–476. doi: 10.1097/FTD.0b013e31825c4ba6

Table 1.

The most common Pmetrics functions used to manipulate data before and after running NPAG, IT2B, or the Simulator

Pmetrics function Comment
Manipulate data files
PMreadMatrix Read a Pmetrics data file into R
PMcheckMatrix Check an R data frame for errors which would cause a run to fail
PMwriteMatrix Write an R data frame to a new Pmetrics data file
Process data
makeAUC Calculate AUC over any time interval from a variety of inputs using the trapezoidal approximation
makeCov Make a data frame (class PMcov*) containing Bayesian posterior parameter estimates for each subject with their mean covariate values, suitable for covariate analysis with linear or non- linear regression for example
makeCycle Make a list (class PMcycle*) containing cycle values for log-likelihood, Akaike and Bayesian Information Criteria, gamma/lambda (fixed-effect process noise multiplier of assay error), mean/median/SD values for each random model parameter normalized to the cycle 1 value, all to assist with assessment of convergence
makeFinal A list (class PMfinal*) with summary statistics for the final cycle parameter estimates (e.g. mean, median, covariance, etc.) after an NPAG or IT2B run, additionally with the non-parametric joint density after an NPAG run
makeNCA Run a non-compartmental analysis on the full, predicted, first-dose profiles from an NPAG run (see makePost). This will calculate AUC by the trapezoidal rule from time 0 to the time of the next dose (or all time points for a single-dose study) and AUMC over the same interval. Extrapolation to infinity of AUC and AUMC, using the last 6 predictions in the interval is made, along with reporting of clearance, maximum concentration, time to maximum, and half-life.
makeOP A data frame (class PMop*) with subject identifiers, times, observations, predictions (based on population or individual posterior parameter distributions) and errors, all suitable for observed vs. predicted and residual plots
makePost Create predictions for each subject and output at user-specified intervals using the mean, median, or mode of individual Bayesian posterior parameter distributions
Plot Pmetrics objects*
plot.PMcov The relationship between any two columns (i.e. Bayesian posterior parameters and covariates) of a PMcov object.
plot.PMcycle The data in a PMcycle object vs. cycle number
plot.PMfinal Univariate or bivariate marginal final cycle parameter value distributions in a PMfinal object
plot.PMmatrix Raw time-observation data from a data file read by the PMreadMatrix command, with a variety of options, including joining observations with line segments, including doses, overlaying plots for all subjects or separating them, including individual posterior predictions, color coding according to groups and more
plot.PMop Observed vs. population or individual Bayesian posterior predicted data or residual plots (see below).
plot.PMsim Simulated time-concentration profiles from Simulator output via SIMparse, overlaid as individual curves or summarized by customizable quantiles (e.g. 5th, 25th, 50th, 75th and 95th percentiles); inclusion of observations in a population can be used to return a visual and numerical predictive check
plot.PMdiag Generates a prediction discrepancy (pd) normal quantile-quantile (Q-Q) plot, pd histogram, pd vs. time plot, and a pd vs. prediction plot to visualize results of simulation-based internal model diagnostics accessed with the PMdiag command
Model selection and diagnostics
PMcompare Compares any number of NPAG and/or IT2B runs on the basis of final cycle log- likelihood, Akaike and Bayesian Information Criteria, whether convergence was achieved, the root mean squared error (RMSE) of observations minus predictions, based on population and individual Bayesian posterior parameter estimates, and observed vs. predicted plots
plot.PMop (with residual option) Three panels: 1) weighted residuals (observed - predicted) vs. time; 2) weighted residuals vs. predictions; 3) a histogram of residuals with optional superimposed normal curve, the mean of the weighted residuals (expected to be 0), the probability that it is different from 0 by chance, and three tests of normality for the residuals: D’Agostino,17 Shapiro-Wilk, and Kolmogorov-Smirnof
PMdiag Use the Simulator to create a list with pd (prediction discrepancy) data suitable for plotting with plot.PMdiag, above, and for internal model validation
*

R is an object-oriented language. Therefore objects are assigned classes that have associated methods. For example, all plotting routines in Pmetrics are simply accessed using the command plot(…) rather than, for example, plot.OP(…). This makes it far easier for users, who do not have to remember which plot routine to call for a given object.

These objects are automatically created at the end of a run and loaded with the NPload() or ITload() commands. Note, however, that makeNCA and makePost are only available for use on output from an NPAG run.