Title: | NCA Calculations and Population Model Diagnosis |
---|---|
Description: | A flexible tool that can perform (i) traditional non-compartmental analysis (NCA) and (ii) Simulation-based posterior predictive checks for population pharmacokinetic (PK) and/or pharmacodynamic (PKPD) models using NCA metrics. |
Authors: | Chayan Acharya [aut], Andrew C. Hooker [aut, cre], Gulbeyaz Y. Turkyilmaz [aut], Siv Jonsson [aut], Mats O. Karlsson [aut] |
Maintainer: | Andrew C. Hooker <[email protected]> |
License: | GPL-3 |
Version: | 0.3.0 |
Built: | 2024-11-05 06:36:54 UTC |
Source: | CRAN |
calc.stat calculates a set of statistics for a given array of numbers.
calc.stat(x)
calc.stat(x)
x |
a numeric array |
calc.stat calculates a set of statistics for a given array of numbers. The calculated statistics are
Ntot = length of the array
Nunique = Number of unique elements
Min = Minimum value of the array
Max = Maximum value of the array
Mean = Mean value of the array
Median = Median value of the array
SD = Standard deviation value of the array
SE = Standard error value of the array
CVp = Percent coefficient of variation of the array
CI95u = Upper limit of the 95% confidence interval of the array
cI95l = Lower limit of the 95% confidence interval of the array
gMean = Geometric mean value of the array
gCVp = Geometric percent coefficient of variation of the array
An array of calculated statistics of a given set of numbers
dv.plot plots DV vs Time data.
dv.plot(df, xvar = "Time", yvar = "Conc", obsLog = FALSE, myXlab = "Time", myYlab = "Concentration", color = NULL, group = NULL, guide = TRUE, onlyLin = FALSE, onlyLog = FALSE, XYlog = FALSE, STRATY = ".", STRATX = ".", myYBr = waiver(), myXBr = waiver(), myYBrLog = waiver(), myXBrLog = waiver(), myYlim = NULL, myXlim = NULL, myYlimLog = NULL, myXlimLog = NULL, title = NULL)
dv.plot(df, xvar = "Time", yvar = "Conc", obsLog = FALSE, myXlab = "Time", myYlab = "Concentration", color = NULL, group = NULL, guide = TRUE, onlyLin = FALSE, onlyLog = FALSE, XYlog = FALSE, STRATY = ".", STRATX = ".", myYBr = waiver(), myXBr = waiver(), myYBrLog = waiver(), myXBrLog = waiver(), myYlim = NULL, myXlim = NULL, myYlimLog = NULL, myXlimLog = NULL, title = NULL)
df |
A data frame to be used for the plot |
xvar |
is the independent variable, default is "TIME" |
yvar |
is the dependent variable, default is "DV" |
obsLog |
is a logical variable ( |
myXlab |
is the x-axis label, default is "Time" |
myYlab |
is the y-axis label, defaults is "Concentration" |
color |
is the column name of the color stratification variable, e.g. "DOSEF". Default is NULL |
group |
is the column name of the variable used to group data, default is "ID |
guide |
if TRUE, show guide, default is TRUE |
onlyLin |
if TRUE, presents only the linear version of the plot, default is FALSE |
onlyLog |
if TRUE, presents only the log version of the plot, default is FALSE |
XYlog |
if TRUE, both X and Y axes of the log version of the plot is shown on the logarithmic scale; if FALSE, only the Y-axis is shown on the logarithmic scale. Default is FALSE. |
STRATY |
is the row stratification variable, default is "." |
STRATX |
is the column stratification variable, default is "." |
myYBr |
are the breaks for the Y-axis for the linear plot |
myXBr |
are the breaks for the X-axis for the linear plot |
myYBrLog |
are the breaks for the Y-axis for the log plot |
myXBrLog |
are the breaks for the X-axis for the log plot |
myYlim |
sets Y-axis limits for the linear plot |
myXlim |
sets X-axis limits for the linear plot |
myYlimLog |
sets the Y-axis limit for the log plot |
myXlimLog |
sets the X-axis limit for the log plot |
title |
The title of the plot. |
dv.plot plots DV vs Time data
returns a graphical object created by arrangeGrob function
Estimates a comprehensive set of NCA metrics for a given individual using concentration vs. time data.
est.nca(time, conc, backExtrp = FALSE, negConcExcl = FALSE, doseType = "ns", adminType = "extravascular", doseAmt = NULL, method = "linearup-logdown", AUCTimeRange = NULL, LambdaTimeRange = NULL, LambdaExclude = NULL, doseTime = doseTime, Tau = NULL, TI = NULL, simFile = NULL, dset = "obs", onlyNCA = FALSE, extrapolate = FALSE, sparse_compute = FALSE, force_extrapolate = FALSE, ...)
est.nca(time, conc, backExtrp = FALSE, negConcExcl = FALSE, doseType = "ns", adminType = "extravascular", doseAmt = NULL, method = "linearup-logdown", AUCTimeRange = NULL, LambdaTimeRange = NULL, LambdaExclude = NULL, doseTime = doseTime, Tau = NULL, TI = NULL, simFile = NULL, dset = "obs", onlyNCA = FALSE, extrapolate = FALSE, sparse_compute = FALSE, force_extrapolate = FALSE, ...)
time |
Numeric array for time |
conc |
Numeric array for concentration |
backExtrp |
If back-extrapolation is needed for AUC (TRUE or FALSE) (FALSE) |
negConcExcl |
Exclude -ve conc (FALSE) |
doseType |
Steady-state (ss) or non-steady-state (ns) dose ("ns") |
adminType |
Route of administration (iv-bolus,iv-infusion,extravascular) ("extravascular") |
doseAmt |
Dose amounts ("NULL") |
method |
Method to estimate AUC. The |
AUCTimeRange |
User-defined window of time used to estimate AUC ("NULL") |
LambdaTimeRange |
User-defined window of time to estimate elimination rate-constant ("NULL") |
LambdaExclude |
User-defined excluded observation time points for estimation of elimination rate-constant ("NULL") |
doseTime |
Dose time prior to the first observation for steady-state
data ( |
Tau |
Dosing interval for steady-state data ("NULL") |
TI |
Infusion duration ("NULL") |
simFile |
Name of the simulated concentration-time data if present ("NULL") |
dset |
Type, i.e., observed or simulated concentration-time data set ("obs" or "sim") ("obs") |
onlyNCA |
If |
extrapolate |
Should the function extrapolate from the last observation to infinity? |
sparse_compute |
Should NCA metrics be computed even with only one sample? |
force_extrapolate |
Extrapolate AUC_inf with sparse data. Sparse data is defined as fewer than 3 points after Cmax for non-bolus input. In that case, Cmax is included in the extrapolation and only one extra point in required for extrapolation. |
... |
Arguments passed from other functions. Not used. |
est.nca estimates a comprehensive set of NCA metrics using the concentration-time profile of an individual. NCA metrics are estimated according to traditional PK calculations. The names of the various NCA metrics estimated in this package are assigned mainly following the names used in WinNonlin. This package accepts any of the three different types of drug administration, (i) iv-bolus, (ii) iv-infusion and (iii) extravascular; ncappc also can accept both non-steady state and steady-state data. The NCA metrics that are estimated and reported by ncappc are listed below.
C0 is the initial concentration at the dosing time. It is the observed concentration at the dosing time, if available. Otherwise it is approximated using the following rules.
Cmax, Tmax and Cmax_D are the value and the time of maximum observed concentration, respectively. If the maximum concentration is not unique, the first maximum is used. For steady state data, The maximum value between the dosing intervals is considered. Cmax_D is the dose normalized maximum observed concentration.
Clast and Tlast are the last measurable positive concentration and the corresponding time, respectively.
AUClast is the area under the concentration vs. time curve from the first observed to last measurable concentration.
AUMClast is the first moment of the concentration vs. time curve from the first observed to last measurable concentration.
MRTlast is the mean residence time from the first observed to last measurable concentration.
No_points_Lambda_z is the number of observed data points used to determine the best fitting regression line in the elimination phase.
AUC_pBack_Ext_obs is the percentage of AUCINF_obs that is contributed by the back extrapolation to estimate C0.
AUC_pBack_Ext_pred is the percentage of AUCINF_pred that is contributed by the back extrapolation to estimate C0.
AUClower_upper is the AUC under the concentration-time profile within the user-specified window of time provided as the "AUCTimeRange" argument. In case of empty "AUCTimeRange" argument, AUClower_upper is the same as AUClast.
Rsq, Rsq_adjusted and Corr_XY are regression coefficient of the regression line used to estimate the elimination rate constant, the adjusted value of Rsq and the square root of Rsq, respectively.
Lambda_z is the elimination rate constant estimated from the regression line representing the terminal phase of the concentration-time data.
Lambda_lower and Lambda_upper are the lower and upper limit of the time values from the concentration-time profile used to estimate Lambda_z, respectively, in case the "LambdaTimeRange" is used to specify the time range.
HL_Lambda_z is terminal half-life of the drug.
AUCINF_obs and AUCINF_obs_D are AUC estimated from the first sampled data extrapolated to infinity and its dose normalized version, respectively. The extrapolation in the terminal phase is based on the last observed concentration Clast_obs.
AUC_pExtrap_obs is the percentage of the AUCINF_obs that is contributed by the extrapolation from the last sampling time to infinity.
AUMCINF_obs is AUMC estimated from the first sampled data extrapolated to infinity. The extrapolation in the terminal phase is based on the last observed concentration.
AUMC_pExtrap_obs is the percentage of the AUMCINF_obs that is contributed by the extrapolation from the last sampling time to infinity.
Vz_obs is the volume of distribution estimated based on total AUC
Cl_obs is total body clearance.
AUCINF_pred and AUCINF_pred_D are AUC from the first sampled data extrapolated to infinity and its dose normalized version, respectively. The extrapolation in the terminal phase is based on the last predicted concentration obtained from the regression line used to estimate Lambda_z (Clast_pred).
AUC_pExtrap_pred is the percentage of the AUCINF_pred that is contributed by the extrapolation from the last sampling time to infinity.
AUMCINF_pred is AUMC estimated from the first sampled data extrapolated to infinity. The extrapolation in the terminal phase is based on the last predicted concentration obtained from the regression line used to estimate Lambda_z (Clast_pred).
AUMC_pExtrap_pred is the percentage of the AUMCINF_pred that is contributed by the extrapolation from the last sampling time to infinity.
Vz_pred is the volume of distribution estimated based on AUCINF_pred.
Cl_pred is the total body clearance estimated based on AUCINF_pred.
MRTINF_obs is the mean residence time from the first sampled time extrapolated to infinity based on the last observed concentration (Clast_obs).
MRTINF_pred is the mean residence time from the first sampled time extrapolated to infinity based on the last predicted concentration obtained from the regression line used to estimate Lambda_z (Clast_pred).
Tau is the dosing interval for steady-state data.
Cmin and Tmin are the minimum concentration between 0 and Tau and the corresponding time, respectively.
Cavg is the average concentration between 0 and Tau for steady-state data.
AUCtau and AUMCtau are AUC and AUMC between 0 and Tau for steady-state data.
Clss is an estimate of the total body clearance for steady-state data.
Vss_obs and Vss_pred are estimated volume of distribution at steady-state based on Clast_obs and Clast_pred, respectively.
p_Fluctuation is the percentage of the fluctuation of the concentration between 0 and Tau for steady-state data.
Accumulation_Index is
An array of estimated NCA metrics
histobs.plot plots histogram of selected set of NCA metrics (e.g. AUClast, AUCINF_obs, Cmax and Tmax).
histobs.plot(plotData, figlbl = NULL, param = c("AUClast", "AUCINF_obs", "Cmax", "Tmax"), cunit = NULL, tunit = NULL, spread = "npi")
histobs.plot(plotData, figlbl = NULL, param = c("AUClast", "AUCINF_obs", "Cmax", "Tmax"), cunit = NULL, tunit = NULL, spread = "npi")
plotData |
A data frame with the estimated NCA metrics |
figlbl |
Figure label based on dose identifier and/or population stratifier (NULL) |
param |
A character array of the NCA metrics. The allowed NCA metrics for this histograms are "AUClast", "AUClower_upper", "AUCINF_obs", "AUCINF_pred", "AUMClast", "Cmax", "Tmax" and "HL_Lambda_z". (c("AUClast", "AUCINF_obs", "Cmax", "Tmax")) |
cunit |
Unit for concentration (default is |
tunit |
Unit for time (default is |
spread |
Measure of the spread of simulated data (ppi (95% parametric prediction interval) or npi (95% nonparametric prediction interval)) ("npi") |
histobs.plot plots histogram of selected set of NCA metrics. The allowed NCA metrics for this histograms are "AUClast", "AUClower_upper", "AUCINF_obs", "AUCINF_pred", "AUMClast", "Cmax", "Tmax" and "HL_Lambda_z". By default, this function produces histogram of AUClast, AUCINF_obs, Cmax and Tmax.
returns a graphical object created by arrangeGrob function
histpop.plot plots population histogram of the NCA metrics selected for model diagnosis (e.g. AUClast, AUCINF_obs, Cmax and Tmax).
histpop.plot(obsdata = outData, simdata = smedianData, figlbl = NULL, param = c("AUClast", "Cmax"), cunit = NULL, tunit = NULL, spread = "npi")
histpop.plot(obsdata = outData, simdata = smedianData, figlbl = NULL, param = c("AUClast", "Cmax"), cunit = NULL, tunit = NULL, spread = "npi")
obsdata |
Data frame with the values of the NCA metrics estimated from the observed data |
simdata |
Data frame with the values of the NCA metrics estimated from the simulated data |
figlbl |
Figure label based on dose identifier and/or population stratifier (NULL) |
param |
A character array of the NCA metrics. The allowed NCA metrics for this histograms are "AUClast", "AUClower_upper", "AUCINF_obs", "AUCINF_pred", "AUMClast", "Cmax", "Tmax" and "HL_Lambda_z". (c("AUClast", "Cmax")) |
cunit |
Unit for concentration (default is |
tunit |
Unit for time (default is |
spread |
Measure of the spread of simulated data (ppi (95% parametric prediction interval) or npi (95% nonparametric prediction interval)) ("npi") |
histpop.plot plots histogram of the NCA metrics selected for the model diagnosis and compares with the corresponding metrics estimated from the observed data. The allowed NCA metrics for this histograms are "AUClast", "AUClower_upper", "AUCINF_obs", "AUCINF_pred", "AUMClast", "Cmax", "Tmax" and "HL_Lambda_z". By default, this function produces histogram of AUClast and Cmax.
returns a graphical object created by arrangeGrob function
Extracts time-conc data for a given individual.
nca_ind_data(pkData, dvLog = FALSE, dataType = "obs", idNm = "ID", timeNm = "TIME", concNm = "DV", adminType = "extravascular", TI = NULL, dateColNm = NULL, dateFormat = NULL, timeFormat = "number")
nca_ind_data(pkData, dvLog = FALSE, dataType = "obs", idNm = "ID", timeNm = "TIME", concNm = "DV", adminType = "extravascular", TI = NULL, dateColNm = NULL, dateFormat = NULL, timeFormat = "number")
pkData |
PK concentration-time data. |
dvLog |
If |
dataType |
Indicates if the data is observed ("obs") or simulated
("sim"). Since the simulated data is assumed to be obtained from NONMEM
output, DATE and clock time ( |
idNm |
Column name for ID in PK data. Default is "ID" |
timeNm |
Column name for time in PK data. Default is "TIME" |
concNm |
Column name for concentration in PK data. Default is "DV" |
adminType |
Route of administration. Allowed options are iv-bolus, iv-infusion or extravascular. Default is "extravascular" |
TI |
Infusion duration. If TI is a single numeric value, TI is the same
for all individuals. If TI is the name of a column with numeric data
present in the data set, TI is set to the unique value of the column for a
given individual. Default is |
dateColNm |
column name for date if used (e.g. "Date", "DATE"). Default
is |
dateFormat |
date format (D-M-Y, D/M/Y or any other combination of
D,M,Y). Default is |
timeFormat |
time format (number, H:M, H:M:S). Default is "number" |
Extracts time-conc data for a given individual.
A list of objects with time-conc data and individual infusion duration for iv-infusion data
nca.check.obs Checks observed data for compatibility with ncappc and processes the data with various filtering criteria.
nca.check.obs(obsData, idNmObs = "ID", timeNmObs = "TIME", concNmObs = "DV", doseType = "ns", doseTime = NULL, Tau = NULL, filterNm = NULL, filterExcl = NULL, str1Nm = NULL, str1 = NULL, str2Nm = NULL, str2 = NULL, str3Nm = NULL, str3 = NULL, AUCTimeRange = NULL, LambdaTimeRange = NULL, adminType = "extravascular", TI = NULL, doseAmtNm = NULL, dateColNm = NULL, dateFormat = NULL, timeFormat = "number", concUnit = NULL, timeUnit = NULL, doseUnit = NULL, blqNm = NULL, blqExcl = 1, evid = TRUE, evidIncl = 0, mdv = FALSE)
nca.check.obs(obsData, idNmObs = "ID", timeNmObs = "TIME", concNmObs = "DV", doseType = "ns", doseTime = NULL, Tau = NULL, filterNm = NULL, filterExcl = NULL, str1Nm = NULL, str1 = NULL, str2Nm = NULL, str2 = NULL, str3Nm = NULL, str3 = NULL, AUCTimeRange = NULL, LambdaTimeRange = NULL, adminType = "extravascular", TI = NULL, doseAmtNm = NULL, dateColNm = NULL, dateFormat = NULL, timeFormat = "number", concUnit = NULL, timeUnit = NULL, doseUnit = NULL, blqNm = NULL, blqExcl = 1, evid = TRUE, evidIncl = 0, mdv = FALSE)
obsData |
Observed concentration-time data. |
idNmObs |
Column name for ID in observed data. Default is "ID" |
timeNmObs |
Column name for time in observed data. Default is "TIME" |
concNmObs |
Column name for concentration in observed data. Default is "DV" |
doseType |
Steady-state (ss) or non-steady-state (ns) dose. Default is "ns" |
doseTime |
Dose time prior to the first observation for steady-state
data. Default is |
Tau |
Dosing interval for steady-state data. Default is
|
filterNm |
Column name to filter data. Default is |
filterExcl |
Row exclusion criteria based on the column defined by
|
str1Nm |
Column name for 1st level population stratifier. Default is
|
str1 |
Stratification ID of the members within 1st level stratification
(e.g c(1,2)). Default is |
str2Nm |
Column name for 2nd level population stratifier. Default is
|
str2 |
Stratification ID of the members within 2nd level stratification
(e.g c(1,2)). Default is |
str3Nm |
Column name for 3rd level population stratifier. Default is
|
str3 |
Stratification ID of the members within 3rd level stratification
(e.g c(1,2)). Default is |
AUCTimeRange |
User-defined window of time used to estimate AUC. Default
is |
LambdaTimeRange |
User-defined window of time to estimate elimination
rate-constant. This argument lets the user to choose a specific window of
time to be used to estimate the elimination rate constant (Lambda) in the
elimination phase. The accepted format for the input to this argument is a
numeric array of two elements; |
adminType |
Route of administration. Allowed options are iv-bolus, iv-infusion or extravascular. Default is "extravascular" |
TI |
Infusion duration. If TI is a single numeric value, TI is the same
for all individuals. If TI is the name of a column with numeric data
present in the data set, TI is set to the unique value of the column for a
given individual. Default is |
doseAmtNm |
Column name to specify dose amount. Default is
|
dateColNm |
column name for date if used (e.g. "Date", "DATE"). Default
is |
dateFormat |
date format (D-M-Y, D/M/Y or any other combination of
D,M,Y). Default is |
timeFormat |
time format (number, H:M, H:M:S). Default is "number" |
concUnit |
Unit of concentration (e.g. "ng/mL"). Default is
|
timeUnit |
Unit of time (e.g. "h"). Default is |
doseUnit |
Unit of dose amount (e.g. "ng"). Default is
|
blqNm |
Name of BLQ column if used to exclude data. Default is
|
blqExcl |
Excluded BLQ value; either a numeric value or a logical
condition (e.g. 1 or ">=1" or c(1,">3")). Used only if the |
evid |
If |
evidIncl |
Included values in EVID. Default is "0" |
mdv |
If |
nca.check.obs Checks observed data for compatibility with ncappc.
A list of objects
nca.check.sim Checks simulated data for compatibility with ncappc and processes the data with various filtering criteria.
nca.check.sim(simData, idNmSim = "ID", timeNmSim = "TIME", concNmSim = "DV", filterNm = NULL, filterExcl = NULL, str1Nm = NULL, str1 = NULL, str2Nm = NULL, str2 = NULL, str3Nm = NULL, str3 = NULL, adminType = "extravascular", TI = NULL, doseAmtNm = NULL, blqNm = NULL, blqExcl = 1, evid = TRUE, evidIncl = 0, mdv = FALSE)
nca.check.sim(simData, idNmSim = "ID", timeNmSim = "TIME", concNmSim = "DV", filterNm = NULL, filterExcl = NULL, str1Nm = NULL, str1 = NULL, str2Nm = NULL, str2 = NULL, str3Nm = NULL, str3 = NULL, adminType = "extravascular", TI = NULL, doseAmtNm = NULL, blqNm = NULL, blqExcl = 1, evid = TRUE, evidIncl = 0, mdv = FALSE)
simData |
Simulated concentration-time data. |
idNmSim |
Column name for ID in simulated data. Default is "ID" |
timeNmSim |
Column name for time in simulated data. Default is "TIME" |
concNmSim |
Column name for concentration in simulated data. Default is "DV" |
filterNm |
Column name to filter data. Default is |
filterExcl |
Row exclusion criteria based on the column defined by
|
str1Nm |
Column name for 1st level population stratifier. Default is
|
str1 |
Stratification ID of the members within 1st level stratification
(e.g c(1,2)). Default is |
str2Nm |
Column name for 2nd level population stratifier. Default is
|
str2 |
Stratification ID of the members within 2nd level stratification
(e.g c(1,2)). Default is |
str3Nm |
Column name for 3rd level population stratifier. Default is
|
str3 |
Stratification ID of the members within 3rd level stratification
(e.g c(1,2)). Default is |
adminType |
Route of administration. Allowed options are iv-bolus, iv-infusion or extravascular. Default is "extravascular" |
TI |
Infusion duration. If TI is a single numeric value, TI is the same
for all individuals. If TI is the name of a column with numeric data
present in the data set, TI is set to the unique value of the column for a
given individual. Default is |
doseAmtNm |
Column name to specify dose amount. Default is
|
blqNm |
Name of BLQ column if used to exclude data. Default is
|
blqExcl |
Excluded BLQ value; either a numeric value or a logical
condition (e.g. 1 or ">=1" or c(1,">3")). Used only if the |
evid |
If |
evidIncl |
Included values in EVID. Default is "0" |
mdv |
If |
nca.check.sim Checks simulated data for compatibility with ncappc.
A list of objects
nca.deviation.plot plots individual deviation of selected NCA metrics estimated from observed and simulated data.
nca.deviation.plot(plotdata, xvar = NULL, devcol = NULL, figlbl = NULL, spread = "npi", cunit = NULL, tunit = NULL)
nca.deviation.plot(plotdata, xvar = NULL, devcol = NULL, figlbl = NULL, spread = "npi", cunit = NULL, tunit = NULL)
plotdata |
A data frame containing the scaled deviation values of the NCA metrics |
xvar |
x-variable against which the deviation data will be plotted (NULL) |
devcol |
column names/numbers of the data frame containing deviation data (NULL) |
figlbl |
Figure label based on dose identifier and/or population stratifier (NULL) |
spread |
Measure of the spread of simulated data (ppi (95% parametric prediction interval) or npi (95% nonparametric prediction interval)) ("npi") |
cunit |
Unit for concentration (default is |
tunit |
Unit for time (default is |
nca.deviation.plot plots individual deviation of selected NCA metrics estimated from observed and simulated data. This function requires three mandatory arguments, (i) deviation data, (ii) independent variable and (iii) dependent variables. The deviation of the NCA metrics values estimated from the observed and simulated data are scaled by the "spread" of the simulated metrics values. The "speed" of the simulated data is measured either by the standard deviation or the 95
returns the data frame with the NPDE values based on the input data.
nca.ind.data Extracts time-conc data for a given individual.
nca.ind.data(pkData, ID, dvLog = FALSE, dataType = "obs", idNm = "ID", timeNm = "TIME", concNm = "DV", adminType = "extravascular", TI = NULL, dateColNm = NULL, dateFormat = NULL, timeFormat = "number")
nca.ind.data(pkData, ID, dvLog = FALSE, dataType = "obs", idNm = "ID", timeNm = "TIME", concNm = "DV", adminType = "extravascular", TI = NULL, dateColNm = NULL, dateFormat = NULL, timeFormat = "number")
pkData |
PK concentration-time data. |
ID |
ID number of the individual. |
dvLog |
If |
dataType |
Indicates if the data is observed ("obs") or simulated
("sim"). Since the simulated data is assumed to be obtained from NONMEM
output, DATE and clock time ( |
idNm |
Column name for ID in PK data. Default is "ID" |
timeNm |
Column name for time in PK data. Default is "TIME" |
concNm |
Column name for concentration in PK data. Default is "DV" |
adminType |
Route of administration. Allowed options are iv-bolus, iv-infusion or extravascular. Default is "extravascular" |
TI |
Infusion duration. If TI is a single numeric value, TI is the same
for all individuals. If TI is the name of a column with numeric data
present in the data set, TI is set to the unique value of the column for a
given individual. Default is |
dateColNm |
column name for date if used (e.g. "Date", "DATE"). Default
is |
dateFormat |
date format (D-M-Y, D/M/Y or any other combination of
D,M,Y). Default is |
timeFormat |
time format (number, H:M, H:M:S). Default is "number" |
nca.ind.data Extracts time-conc data for a given individual.
A list of objects with time-conc data and individual infusion duration for iv-infusion data
nca.npde calculates individual normalized prediction distribution errors (NPDE) of selected NCA metrics from the PDE data.
nca.npde(pdedata, pdecol)
nca.npde(pdedata, pdecol)
pdedata |
A data frame containing the prediction distribution errors (PDE) of NCA metrics |
pdecol |
The range of column numbers in the data frame containing the PDE values, which will be used to calculate the corresponding NPDE |
nca.npde calculates individual normalized prediction distribution errors (NPDE) of selected NCA metrics from PDE data. The The deviation of each estimated NCA metrics is scaled by the "spread" of the simulated values. By default, this function calculates the NPDE values of all columns of the input data frame.
returns the data frame with the NPDE values based on the input data.
nca.npde.plot plots individual NPDE values and histogram of the NPDE values within a population group
nca.npde.plot(plotdata, xvar = NULL, npdecol = NULL, figlbl = NULL, cunit = NULL, tunit = NULL)
nca.npde.plot(plotdata, xvar = NULL, npdecol = NULL, figlbl = NULL, cunit = NULL, tunit = NULL)
plotdata |
Data frame with the values of the NPDE values of each individual for the NCA metrics |
xvar |
Name of the independent variable column against which NPDE values will be plotted |
npdecol |
Column names or column numbers of containing the NPDE values |
figlbl |
Figure label based on dose identifier and/or population stratifier (NULL) |
cunit |
Unit for concentration (default is |
tunit |
Unit for time (default is |
nca.npde.plot individual NPDE values and histogram of the NPDE values of NCA metrics within a population group.
returns a data frame with the mean and SD of population NPDE values of each NCA metric and two graphical objects created by arrangeGrob function for the individual and population histogram of the NPDE values
nca.pde.deviation.outlier calculates individual prediction distribution errors (PDE) and scaled deviation of NCA metrics estimated from observed and simulated data. Identifies outlier to population PK model.
nca.pde.deviation.outlier(obsdata, simdata, idNm = "ID", id = NULL, spread = "npi", figlbl = NULL, calcparam = c("AUClast", "Cmax"), diagparam = c("AUClast", "Cmax"), cunit = NULL, tunit = NULL, noPlot = FALSE, onlyNCA = onlyNCA)
nca.pde.deviation.outlier(obsdata, simdata, idNm = "ID", id = NULL, spread = "npi", figlbl = NULL, calcparam = c("AUClast", "Cmax"), diagparam = c("AUClast", "Cmax"), cunit = NULL, tunit = NULL, noPlot = FALSE, onlyNCA = onlyNCA)
obsdata |
A data frame containing the NCA metrics values estimated from the observed data |
simdata |
A data frame containing the NCA metrics values estimated from the simulated data |
idNm |
Column name for ID ("ID") |
id |
ID of the individual whose data is being evaluated |
spread |
Measure of the spread of simulated data (ppi (95% parametric prediction interval) or npi (95% nonparametric prediction interval)) ("npi") |
figlbl |
Figure label based on dose identifier and/or population stratifier, in addition to ID (NULL) |
calcparam |
A character array of the NCA metrics used for calculations of PDE and deviation. The allowed NCA metrics for this histograms are "AUClast", "AUClower_upper", "AUCINF_obs", "AUCINF_pred", "AUMClast", "Cmax", "Tmax" and "HL_Lambda_z". (c("AUClast", "Cmax")) |
diagparam |
A character array of the NCA metrics used for diagnostic test to detect outliers. The allowed NCA metrics for this histograms are "AUClast", "AUClower_upper", "AUCINF_obs", "AUCINF_pred", "AUMClast", "Cmax", "Tmax" and "HL_Lambda_z". (c("AUClast", "Cmax")) |
cunit |
Unit for concentration (default is |
tunit |
Unit for time (default is |
noPlot |
Perform only NCA calculations without any plot generation (TRUE, FALSE) (FALSE) |
onlyNCA |
If |
nca.pde.deviation.outlier calculates individual prediction distribution errors (PDE) and scaled deviation of NCA metrics estimated from observed and simulated data. The deviation of each estimated NCA metrics is scaled by the "spread" of the simulated values. The "spread" is measured either by the 95% parametric prediction interval or 95% non-parametric prediction interval. Any individual yielding an absolute value of the scaled deviation for any of the selected NCA metrics greater than 1, is assigned as an outlier to the corresponding population PK model. The allowed NCA metrics for this diagnostic tests are "AUClast", "AUClower_upper", "AUCINF_obs", "AUCINF_pred", "AUMClast", "Cmax", "Tmax" and "HL_Lambda_z". By default, this function uses AUClast and Cmax metrics for the comparison.
returns the observed data frame with added distance and simulation mean of the nCA metrics, and a data frame with the PDE values of the NCA metrics. If the individual is identified as an outlier for the PK model, histograms of the diagnostic NCA metrics are produced and a graphical object created by arrangeGrob function is returned.
nca.read.sim Reads NONMEM simulation output file.
nca.read.sim(simFile = "nca_simulation.1.npctab.dta", MDV.rm = FALSE)
nca.read.sim(simFile = "nca_simulation.1.npctab.dta", MDV.rm = FALSE)
simFile |
NONMEM simulation output with the simulated concentration-time data from an internal data frame or an external table. Default is "nca_simulation.1.npctab.dta". |
MDV.rm |
If |
nca.read.sim Reads NONMEM simulation output file.
A list of objects
ncappc is a flexible tool, to
perform a traditional NCA
perform simulation-based posterior predictive checks for a population PK model using NCA metrics.
ncappc(obsFile = "nca_original.npctab.dta", simFile = "nca_simulation.1.npctab.dta.zip", str1Nm = NULL, str1 = NULL, str2Nm = NULL, str2 = NULL, str3Nm = NULL, str3 = NULL, concUnit = NULL, timeUnit = NULL, doseUnit = NULL, obsLog = FALSE, simLog = obsLog, psnOut = TRUE, idNmObs = "ID", timeNmObs = "TIME", concNmObs = "DV", idNmSim = idNmObs, timeNmSim = timeNmObs, concNmSim = concNmObs, onlyNCA = FALSE, AUCTimeRange = NULL, backExtrp = FALSE, LambdaTimeRange = NULL, LambdaExclude = NULL, doseAmtNm = NULL, adminType = "extravascular", doseType = "ns", doseTime = NULL, Tau = NULL, TI = NULL, method = "linearup-logdown", blqNm = NULL, blqExcl = 1, evid = TRUE, evidIncl = 0, mdv = FALSE, filterNm = NULL, filterExcl = NULL, negConcExcl = FALSE, param = c("AUClast", "Cmax"), timeFormat = "number", dateColNm = NULL, dateFormat = NULL, spread = "npi", tabCol = c("AUClast", "Cmax", "Tmax", "AUCINF_obs", "Vz_obs", "Cl_obs", "HL_Lambda_z"), figFormat = "tiff", noPlot = FALSE, printOut = TRUE, studyName = NULL, new_data_method = TRUE, overwrite_SIMDATA = NULL, overwrite_sim_est_file = NULL, outFileNm = NULL, out_format = "html", gg_theme = theme_bw(), parallel = FALSE, extrapolate = FALSE, timing = FALSE, ...)
ncappc(obsFile = "nca_original.npctab.dta", simFile = "nca_simulation.1.npctab.dta.zip", str1Nm = NULL, str1 = NULL, str2Nm = NULL, str2 = NULL, str3Nm = NULL, str3 = NULL, concUnit = NULL, timeUnit = NULL, doseUnit = NULL, obsLog = FALSE, simLog = obsLog, psnOut = TRUE, idNmObs = "ID", timeNmObs = "TIME", concNmObs = "DV", idNmSim = idNmObs, timeNmSim = timeNmObs, concNmSim = concNmObs, onlyNCA = FALSE, AUCTimeRange = NULL, backExtrp = FALSE, LambdaTimeRange = NULL, LambdaExclude = NULL, doseAmtNm = NULL, adminType = "extravascular", doseType = "ns", doseTime = NULL, Tau = NULL, TI = NULL, method = "linearup-logdown", blqNm = NULL, blqExcl = 1, evid = TRUE, evidIncl = 0, mdv = FALSE, filterNm = NULL, filterExcl = NULL, negConcExcl = FALSE, param = c("AUClast", "Cmax"), timeFormat = "number", dateColNm = NULL, dateFormat = NULL, spread = "npi", tabCol = c("AUClast", "Cmax", "Tmax", "AUCINF_obs", "Vz_obs", "Cl_obs", "HL_Lambda_z"), figFormat = "tiff", noPlot = FALSE, printOut = TRUE, studyName = NULL, new_data_method = TRUE, overwrite_SIMDATA = NULL, overwrite_sim_est_file = NULL, outFileNm = NULL, out_format = "html", gg_theme = theme_bw(), parallel = FALSE, extrapolate = FALSE, timing = FALSE, ...)
obsFile |
Observed concentration-time data from an internal data frame or an external table with comma, tab or space as separators. |
simFile |
NONMEM simulation output with the simulated concentration-time
data from an internal data frame or an external table. |
str1Nm |
Column name for 1st level population stratifier. Default is
|
str1 |
Stratification ID of the members within 1st level stratification
(e.g c(1,2)). Default is |
str2Nm |
Column name for 2nd level population stratifier. Default is
|
str2 |
Stratification ID of the members within 2nd level stratification
(e.g c(1,2)). Default is |
str3Nm |
Column name for 3rd level population stratifier. Default is
|
str3 |
Stratification ID of the members within 3rd level stratification
(e.g c(1,2)). Default is |
concUnit |
Unit of concentration (e.g. "ng/mL"). Default is
|
timeUnit |
Unit of time (e.g. "h"). Default is |
doseUnit |
Unit of dose amount (e.g. "ng"). Default is
|
obsLog |
If |
simLog |
If |
psnOut |
If |
idNmObs |
Column name for ID in observed data. Default is "ID" |
timeNmObs |
Column name for time in observed data. Default is "TIME" |
concNmObs |
Column name for concentration in observed data. Default is "DV" |
idNmSim |
Column name for ID in simulated data. Default is "ID" |
timeNmSim |
Column name for time in simulated data. Default is "TIME" |
concNmSim |
Column name for concentration in simulated data. Default is "DV" |
onlyNCA |
If |
AUCTimeRange |
User-defined window of time used to estimate AUC. Default
is |
backExtrp |
If |
LambdaTimeRange |
User-defined window of time to estimate elimination
rate-constant. This argument lets the user to choose a specific window of
time to be used to estimate the elimination rate constant (Lambda) in the
elimination phase. The accepted format for the input to this argument is a
numeric array of two elements; |
LambdaExclude |
User-defined excluded observation time points for
estimation of Lambda. This can be numeric value or logical condition (e.g.
c(1, 2, "<20", ">=100", "!=100")). Default is |
doseAmtNm |
Column name to specify dose amount. Default is
|
adminType |
Route of administration. Allowed options are iv-bolus, iv-infusion or extravascular. Default is "extravascular" |
doseType |
Steady-state (ss) or non-steady-state (ns) dose. Default is "ns" |
doseTime |
Dose time prior to the first observation for steady-state
data. Default is |
Tau |
Dosing interval for steady-state data. Default is
|
TI |
Infusion duration. If TI is a single numeric value, TI is the same
for all individuals. If TI is the name of a column with numeric data
present in the data set, TI is set to the unique value of the column for a
given individual. Default is |
method |
Method to estimate AUC. |
blqNm |
Name of BLQ column if used to exclude data. Default is
|
blqExcl |
Excluded BLQ value; either a numeric value or a logical
condition (e.g. 1 or ">=1" or c(1,">3")). Used only if the |
evid |
If |
evidIncl |
Included values in EVID. Default is "0" |
mdv |
If |
filterNm |
Column name to filter data. Default is |
filterExcl |
Row exclusion criteria based on the column defined by
|
negConcExcl |
If |
param |
NCA parameters (AUClast, AUClower_upper, AUCINF_obs, AUCINF_pred, AUMClast, Cmax, Tmax, HL_Lambda_z). Default is (c"AUClast", "Cmax") |
timeFormat |
time format (number, H:M, H:M:S). Default is "number" |
dateColNm |
column name for date if used (e.g. "Date", "DATE"). Default
is |
dateFormat |
date format (D-M-Y, D/M/Y or any other combination of
D,M,Y). Default is |
spread |
Measure of the spread of simulated data ( |
tabCol |
Output columns to be printed in the report in addition to ID, dose and population strata information (list of NCA metrics in a string array). Default is c("AUClast", "Cmax", "Tmax", "AUCINF_obs", "Vz_obs", "Cl_obs", "HL_Lambda_z") |
figFormat |
format of the produced figures (bmp, jpeg, tiff, png). Default is "tiff" |
noPlot |
If |
printOut |
If |
studyName |
Name of the study to be added as a description in the
report. Default is |
new_data_method |
If |
overwrite_SIMDATA |
If |
overwrite_sim_est_file |
If |
outFileNm |
Additional tag to the name of the output html and pdf output
file hyphenated to the standard ncappc report file name standard ncappc
report file name. Default is |
out_format |
What type of output format should the NCA report have? Pass "all" to render all formats defined within the rmarkdown file. Pass "first" to render the first format defined within the rmarkdown file. Pass "html" to render in HTML. Pass "pdf" to render in PDF. |
gg_theme |
Which ggplot theme should be used for the plots? |
parallel |
Should the nca computations for the simulated data be run in parallel? See
|
extrapolate |
Should the NCA calculations extrapolate from the last observation to infinity? |
timing |
Should timings of calculations be reported to the screen? |
... |
Additional arguments passed to other functions, including |
Non-compartmental analysis (NCA) calculates pharmacokinetic (PK) metrics related to the systemic exposure to a drug following administration, e.g. area under the concentration-time curve and peak concentration. ncappc performs a traditional NCA using the observed plasma concentration-time data. In the presence of simulated plasma concentration-time data, ncappc also performs simulation-based posterior predictive checks (ppc) using NCA metrics for the corresponding population PK (PopPK) model used to generate the simulated data. The diagnostic analysis is performed at the population as well as the individual level. The distribution of the simulated population means of each NCA metric is compared with the corresponding observed population mean. The individual level comparison is performed based on the deviation of the mean of any NCA metric based on simulations for an individual from the corresponding NCA metric obtained from the observed data. Additionally, ncappc reports the normalized prediction distribution error (NPDE) of the simulated NCA metrics for each individual and their distribution within a population. ncappc produces two default outputs depending on the type of analysis performed, i.e., traditional NCA and PopPK diagnosis. The PopPK diagnosis feature of ncappc produces 7 sets of graphical outputs to assess the ability of a population model to simulate the concentration-time profile of a drug and thereby identify model misspecification. In addition, tabular outputs are generated showing the values of the NCA metrics estimated from the observed and the simulated data, along with the deviation, NPDE, regression parameters used to estimate the elimination rate constant and the related population statistics. The default values of the arguments used in ncappc are shown in the Usage section of this document and/or in bold in the Arguments section.
NCA results and diagnostic test results
out <- ncappc(obsFile=system.file("extdata","pkdata.csv",package="ncappc"), onlyNCA = TRUE, extrapolate = TRUE, printOut = FALSE, evid = FALSE, psnOut=FALSE) data_1 <- data.frame( ID=1, TIME = c(0,0.25,0.5,1,1.5,2,3,4,6,8,12,16,24), DV=c(0, 0.07, 0.14, 0.21, 0.24, 0.27, 0.26, 0.25, 0.22, 0.19, 0.13, 0.081, 0.033) ) out_1 <- ncappc(obsFile=data_1, onlyNCA = TRUE, extrapolate = TRUE, printOut = FALSE, evid = FALSE, timing=TRUE) data_2 <- dplyr::filter(data_1,TIME>17|TIME<3) out_2 <- ncappc(obsFile=data_2, onlyNCA = TRUE, extrapolate = TRUE, printOut = FALSE, evid = FALSE, force_extrapolate=TRUE)
out <- ncappc(obsFile=system.file("extdata","pkdata.csv",package="ncappc"), onlyNCA = TRUE, extrapolate = TRUE, printOut = FALSE, evid = FALSE, psnOut=FALSE) data_1 <- data.frame( ID=1, TIME = c(0,0.25,0.5,1,1.5,2,3,4,6,8,12,16,24), DV=c(0, 0.07, 0.14, 0.21, 0.24, 0.27, 0.26, 0.25, 0.22, 0.19, 0.13, 0.081, 0.033) ) out_1 <- ncappc(obsFile=data_1, onlyNCA = TRUE, extrapolate = TRUE, printOut = FALSE, evid = FALSE, timing=TRUE) data_2 <- dplyr::filter(data_1,TIME>17|TIME<3) out_2 <- ncappc(obsFile=data_2, onlyNCA = TRUE, extrapolate = TRUE, printOut = FALSE, evid = FALSE, force_extrapolate=TRUE)
Function to present a value with correct digits and trailing zero
out.digits(x, dig = 3)
out.digits(x, dig = 3)
x |
is the value |
dig |
is the number of significant digits |
This is a function to present a value with correct digits and trailing zero. Numbers >= 10000, or <= 0.0001 will be presented in scientific format
## Not run: out.digits(1234) ## End(Not run)
## Not run: out.digits(1234) ## End(Not run)
The function reads in NONMEM table files. The files can be created from the
$EST
line or from the $SIM
line in a NONMEM model file.
read_nm_table(nm_table, only_obs = FALSE, method = "default", quiet = TRUE, sim_num = FALSE, sim_name = "NSIM")
read_nm_table(nm_table, only_obs = FALSE, method = "default", quiet = TRUE, sim_num = FALSE, sim_name = "NSIM")
nm_table |
The NONMEM table file to read. A text string. If |
only_obs |
Should the non-observation lines in the data set be removed?
Currently filtered using the expected |
method |
Can be one of |
quiet |
Should there be verbose messages about what the function is doing? |
sim_num |
Should the function add a column to the returned data frame that identifies the simulation number (if present)? |
sim_name |
The name of the resulting column in the returned data frame if |
Currently the function searches the $TABLE
for multiple header lines,
and uses that to identify multiple simulations. The function expects at least
one header line (NOHEADER
option is not allowed in NONMEM table
files).
Returns a data frame of the simulated table with an added column for
the simulation number. The data frame is given class c("tbl_df",
"tbl", "data.frame")
for easy use with dplyr
.