Package 'ncappc'

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

Help Index


Calculates a set of statistics for a given array of numbers.

Description

calc.stat calculates a set of statistics for a given array of numbers.

Usage

calc.stat(x)

Arguments

x

a numeric array

Details

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

Value

An array of calculated statistics of a given set of numbers


Plots drug plasma concentration vs time data

Description

dv.plot plots DV vs Time data.

Usage

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)

Arguments

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 (TRUE, FALSE). If TRUE, concentration in observed data is assumed to be in logarithmic scale. Default is FALSE

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.

Details

dv.plot plots DV vs Time data

Value

returns a graphical object created by arrangeGrob function


Estimate individual NCA metrics.

Description

Estimates a comprehensive set of NCA metrics for a given individual using concentration vs. time data.

Usage

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, ...)

Arguments

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 "linear" method applies the linear trapezoidal rule to estimate the area under the curve. The "log" method applies the logarithmic trapezoidal rule to estimate the area under the curve. The "linearup-logdown" method applies the linear trapezoidal rule to estimate the area under the curve for the ascending part of the curve and the logarithmic trapezoidal rule to estimate the area under the curve for the descending part of the curve.

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 (NULL)

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 TRUE only NCA is performed and ppc part is ignored although simFile is not NULL. Default is FALSE

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.

Details

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 1/(1e(λzτ))1/(1-e^(-\lambda_z*\tau))

Value

An array of estimated NCA metrics


Plots histogram of selected set of NCA metrics.

Description

histobs.plot plots histogram of selected set of NCA metrics (e.g. AUClast, AUCINF_obs, Cmax and Tmax).

Usage

histobs.plot(plotData, figlbl = NULL, param = c("AUClast",
  "AUCINF_obs", "Cmax", "Tmax"), cunit = NULL, tunit = NULL,
  spread = "npi")

Arguments

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 NULL)

tunit

Unit for time (default is NULL)

spread

Measure of the spread of simulated data (ppi (95% parametric prediction interval) or npi (95% nonparametric prediction interval)) ("npi")

Details

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.

Value

returns a graphical object created by arrangeGrob function


Plots population histogram of the NCA metrics selected for model diagnosis.

Description

histpop.plot plots population histogram of the NCA metrics selected for model diagnosis (e.g. AUClast, AUCINF_obs, Cmax and Tmax).

Usage

histpop.plot(obsdata = outData, simdata = smedianData, figlbl = NULL,
  param = c("AUClast", "Cmax"), cunit = NULL, tunit = NULL,
  spread = "npi")

Arguments

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 NULL)

tunit

Unit for time (default is NULL)

spread

Measure of the spread of simulated data (ppi (95% parametric prediction interval) or npi (95% nonparametric prediction interval)) ("npi")

Details

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.

Value

returns a graphical object created by arrangeGrob function


Prepare individual PK data

Description

Extracts time-conc data for a given individual.

Usage

nca_ind_data(pkData, dvLog = FALSE, dataType = "obs", idNm = "ID",
  timeNm = "TIME", concNm = "DV", adminType = "extravascular",
  TI = NULL, dateColNm = NULL, dateFormat = NULL,
  timeFormat = "number")

Arguments

pkData

PK concentration-time data.

dvLog

If TRUE concentration is in logarithmic scale. Default is FALSE

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 (dateColNm, dateFormat, timeFormat) are not used for time data. Default is "obs".

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 NULL

dateColNm

column name for date if used (e.g. "Date", "DATE"). Default is NULL

dateFormat

date format (D-M-Y, D/M/Y or any other combination of D,M,Y). Default is NULL

timeFormat

time format (number, H:M, H:M:S). Default is "number"

Details

Extracts time-conc data for a given individual.

Value

A list of objects with time-conc data and individual infusion duration for iv-infusion data


Check observed data

Description

nca.check.obs Checks observed data for compatibility with ncappc and processes the data with various filtering criteria.

Usage

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)

Arguments

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 NULL

Tau

Dosing interval for steady-state data. Default is NULL

filterNm

Column name to filter data. Default is NULL

filterExcl

Row exclusion criteria based on the column defined by filterNm. This can be numeric value or logical condition (e.g. c(1, 2, "<20", ">=100", "!=100")). Default is NULL

str1Nm

Column name for 1st level population stratifier. Default is NULL

str1

Stratification ID of the members within 1st level stratification (e.g c(1,2)). Default is NULL

str2Nm

Column name for 2nd level population stratifier. Default is NULL

str2

Stratification ID of the members within 2nd level stratification (e.g c(1,2)). Default is NULL

str3Nm

Column name for 3rd level population stratifier. Default is NULL

str3

Stratification ID of the members within 3rd level stratification (e.g c(1,2)). Default is NULL

AUCTimeRange

User-defined window of time used to estimate AUC. Default is NULL

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; c(14,24) will estimate the Lambda using the data within the time units 14 to 24. Default is NULL

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 NULL

doseAmtNm

Column name to specify dose amount. Default is NULL

dateColNm

column name for date if used (e.g. "Date", "DATE"). Default is NULL

dateFormat

date format (D-M-Y, D/M/Y or any other combination of D,M,Y). Default is NULL

timeFormat

time format (number, H:M, H:M:S). Default is "number"

concUnit

Unit of concentration (e.g. "ng/mL"). Default is NULL

timeUnit

Unit of time (e.g. "h"). Default is NULL

doseUnit

Unit of dose amount (e.g. "ng"). Default is NULL

blqNm

Name of BLQ column if used to exclude data. Default is NULL

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 blqNm is not NULL. Default is "1"

evid

If TRUE EVID is used to filter data. Default is TRUE

evidIncl

Included values in EVID. Default is "0"

mdv

If TRUE MDV is used to include data when MDV=0. Default is FALSE

Details

nca.check.obs Checks observed data for compatibility with ncappc.

Value

A list of objects


Check simulated data

Description

nca.check.sim Checks simulated data for compatibility with ncappc and processes the data with various filtering criteria.

Usage

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)

Arguments

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 NULL

filterExcl

Row exclusion criteria based on the column defined by filterNm. This can be numeric value or logical condition (e.g. c(1, 2, "<20", ">=100", "!=100")). Default is NULL

str1Nm

Column name for 1st level population stratifier. Default is NULL

str1

Stratification ID of the members within 1st level stratification (e.g c(1,2)). Default is NULL

str2Nm

Column name for 2nd level population stratifier. Default is NULL

str2

Stratification ID of the members within 2nd level stratification (e.g c(1,2)). Default is NULL

str3Nm

Column name for 3rd level population stratifier. Default is NULL

str3

Stratification ID of the members within 3rd level stratification (e.g c(1,2)). Default is NULL

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 NULL

doseAmtNm

Column name to specify dose amount. Default is NULL

blqNm

Name of BLQ column if used to exclude data. Default is NULL

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 blqNm is not NULL. Default is "1"

evid

If TRUE EVID is used to filter data. Default is TRUE

evidIncl

Included values in EVID. Default is "0"

mdv

If TRUE MDV is used to include data when MDV=0. Default is FALSE

Details

nca.check.sim Checks simulated data for compatibility with ncappc.

Value

A list of objects


Plot individual deviation of NCA metrics estimated from observed and simulated data

Description

nca.deviation.plot plots individual deviation of selected NCA metrics estimated from observed and simulated data.

Usage

nca.deviation.plot(plotdata, xvar = NULL, devcol = NULL,
  figlbl = NULL, spread = "npi", cunit = NULL, tunit = NULL)

Arguments

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 NULL)

tunit

Unit for time (default is NULL)

Details

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

Value

returns the data frame with the NPDE values based on the input data.


Prepare individual PK data

Description

nca.ind.data Extracts time-conc data for a given individual.

Usage

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")

Arguments

pkData

PK concentration-time data.

ID

ID number of the individual.

dvLog

If TRUE concentration is in logarithmic scale. Default is FALSE

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 (dateColNm, dateFormat, timeFormat) are not used for time data. Default is "obs".

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 NULL

dateColNm

column name for date if used (e.g. "Date", "DATE"). Default is NULL

dateFormat

date format (D-M-Y, D/M/Y or any other combination of D,M,Y). Default is NULL

timeFormat

time format (number, H:M, H:M:S). Default is "number"

Details

nca.ind.data Extracts time-conc data for a given individual.

Value

A list of objects with time-conc data and individual infusion duration for iv-infusion data


Calculates individual normalized prediction distribution errors (NPDE) from PDE data.

Description

nca.npde calculates individual normalized prediction distribution errors (NPDE) of selected NCA metrics from the PDE data.

Usage

nca.npde(pdedata, pdecol)

Arguments

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

Details

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.

Value

returns the data frame with the NPDE values based on the input data.


Plots population histogram of the NCA metrics selected for model diagnosis.

Description

nca.npde.plot plots individual NPDE values and histogram of the NPDE values within a population group

Usage

nca.npde.plot(plotdata, xvar = NULL, npdecol = NULL, figlbl = NULL,
  cunit = NULL, tunit = NULL)

Arguments

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 NULL)

tunit

Unit for time (default is NULL)

Details

nca.npde.plot individual NPDE values and histogram of the NPDE values of NCA metrics within a population group.

Value

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


Calculates individual prediction distribution errors (PDE) and scaled deviation of NCA metrics estimated from observed and simulated data. Identifies outlier to population PK model.

Description

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.

Usage

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)

Arguments

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 NULL)

tunit

Unit for time (default is NULL)

noPlot

Perform only NCA calculations without any plot generation (TRUE, FALSE) (FALSE)

onlyNCA

If TRUE only NCA is performed and ppc part is ignored although simFile is not NULL. Default is FALSE

Details

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.

Value

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.


Check observed data

Description

nca.read.sim Reads NONMEM simulation output file.

Usage

nca.read.sim(simFile = "nca_simulation.1.npctab.dta", MDV.rm = FALSE)

Arguments

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 TRUE MDV column is used to remove non-observation rows. Default is FALSE

Details

nca.read.sim Reads NONMEM simulation output file.

Value

A list of objects


Performs NCA calculations and population PK model diagnosis.

Description

ncappc is a flexible tool, to

  1. perform a traditional NCA

  2. perform simulation-based posterior predictive checks for a population PK model using NCA metrics.

Usage

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, ...)

Arguments

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. NULL produces just the NCA output, a filename or data frame produces the NCA output as well as the PopPK diagnosis. If new_data_method=TRUE then this can be a compressed file as well.

str1Nm

Column name for 1st level population stratifier. Default is NULL

str1

Stratification ID of the members within 1st level stratification (e.g c(1,2)). Default is NULL

str2Nm

Column name for 2nd level population stratifier. Default is NULL

str2

Stratification ID of the members within 2nd level stratification (e.g c(1,2)). Default is NULL

str3Nm

Column name for 3rd level population stratifier. Default is NULL

str3

Stratification ID of the members within 3rd level stratification (e.g c(1,2)). Default is NULL

concUnit

Unit of concentration (e.g. "ng/mL"). Default is NULL

timeUnit

Unit of time (e.g. "h"). Default is NULL

doseUnit

Unit of dose amount (e.g. "ng"). Default is NULL

obsLog

If TRUE concentration in observed data is in logarithmic scale. Default is FALSE

simLog

If TRUE concentration in simulated data is in logarithmic scale. Default is FALSE

psnOut

If TRUE observed data is an output from PsN or in NONMEM output format. Default is TRUE

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 TRUE only NCA is performed and ppc part is ignored although simFile is not NULL. Default is FALSE

AUCTimeRange

User-defined window of time used to estimate AUC. Default is NULL

backExtrp

If TRUE back-extrapolation is performed while estimating AUC. Default is FALSE

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; c(14,24) will estimate the Lambda using the data within the time units 14 to 24. Default is NULL

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 NULL

doseAmtNm

Column name to specify dose amount. Default is NULL

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 NULL

Tau

Dosing interval for steady-state data. Default is NULL

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 NULL

method

Method to estimate AUC. linear method applies the linear trapezoidal rule to estimate the area under the curve. log method applies the logarithmic trapezoidal rule to estimate the area under the curve. linearup-logdown method applies the linear trapezoidal rule to estimate the area under the curve for the ascending part of the curve and the logarithmic trapezoidal rule to estimate the area under the curve for the descending part of the curve. Default is "linearup-logdown"

blqNm

Name of BLQ column if used to exclude data. Default is NULL

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 blqNm is not NULL. Default is "1"

evid

If TRUE EVID is used to filter data. Default is TRUE

evidIncl

Included values in EVID. Default is "0"

mdv

If TRUE MDV is used to include data when MDV=0. Default is FALSE

filterNm

Column name to filter data. Default is NULL

filterExcl

Row exclusion criteria based on the column defined by filterNm. This can be numeric value or logical condition (e.g. c(1, 2, "<20", ">=100", "!=100")). Default is NULL

negConcExcl

If TRUE negative concentrations are excluded. Default is FALSE

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 NULL

dateFormat

date format (D-M-Y, D/M/Y or any other combination of D,M,Y). Default is NULL

spread

Measure of the spread of simulated data ("ppi" (95% parametric prediction interval) or "npi" (95% nonparametric prediction interval)). Default is "npi"

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 TRUE only NCA calculations are performed without any plot generation. Default is FALSE

printOut

If TRUE tabular and graphical outputs are saved on the disk. Default is TRUE

studyName

Name of the study to be added as a description in the report. Default is NULL

new_data_method

If TRUE a faster method of reading data is tested. Default is TRUE

overwrite_SIMDATA

If TRUE new information is created in the SIMDATA directory. If FALSE the information in the SIMDATA directory is used. If NULL a dialog will come up to ask the user what to do. Default is NULL

overwrite_sim_est_file

If TRUE The NCA metrics are created again based on the simulation data. If FALSE the information in the ncaSimEst file is used. If NULL a dialog will come up to ask the user what to do. Default is NULL

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 NULL

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 start_parallel for a description and additional arguments that can be added to this function and passed to start_parallel.

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 start_parallel.

Details

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.

Value

NCA results and diagnostic test results

Examples

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)

output value with correct digits and trailing zero

Description

Function to present a value with correct digits and trailing zero

Usage

out.digits(x, dig = 3)

Arguments

x

is the value

dig

is the number of significant digits

Details

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

Examples

## Not run: 
out.digits(1234)

## End(Not run)

Read NONMEM table files produced.

Description

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.

Usage

read_nm_table(nm_table, only_obs = FALSE, method = "default",
  quiet = TRUE, sim_num = FALSE, sim_name = "NSIM")

Arguments

nm_table

The NONMEM table file to read. A text string. If dplyr and readr are available and method="default" or method="readr_*" then nm_table can either a path to a file, a connection, or literal data (either a single string or a raw vector). Files ending in .gz, .bz2, .xz, or .zip will be automatically uncompressed. Files starting with http://, https://, ftp://, or ftps:// will be automatically downloaded. Remote gz files can also be automatically downloaded & decompressed.

only_obs

Should the non-observation lines in the data set be removed? Currently filtered using the expected MDV column. TRUE or FALSE.

method

Can be one of default, readr_1, readr_2, readr_3, slow. readr_1 should be fastest. All but slow require dplyr and readr (version >= 0.2.2).

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 sim_num is true.

Details

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).

Value

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.