Package 'qpNCA'

Title: Noncompartmental Pharmacokinetic Analysis by qPharmetra
Description: Computes noncompartmental pharmacokinetic parameters for drug concentration profiles. For each profile, data imputations and adjustments are made as necessary and basic parameters are estimated. Supports single dose, multi-dose, and multi-subject data. Supports steady-state calculations and various routes of drug administration. See ?qpNCA and vignettes. Methodology follows Rowland and Tozer (2011, ISBN:978-0-683-07404-8), Gabrielsson and Weiner (1997, ISBN:978-91-9765-100-4), and Gibaldi and Perrier (1982, ISBN:978-0824710422).
Authors: Jan Huisman [aut, cre], Koen Jolling [ctb], Krina Mehta [ctb], Tim Bergsma [ctb]
Maintainer: Jan Huisman <[email protected]>
License: GPL-3
Version: 1.1.6
Built: 2024-11-13 03:59:18 UTC
Source: https://github.com/cran/qpNCA

Help Index


Calculate Cmax and Tmax

Description

Calculates Cmax and Tmax from raw data for each PK curve defined using by.

Usage

calc.ctmax(x, by = character(0), timevar = "time", depvar = "dv")

Arguments

x

data.frame

by

column names in x indicating grouping variables

timevar

variable name containing the actual sampling time after dose

depvar

variable name containing the dependent variable (e.g., concentration)

Details

Input dataset can contain all uncorrected data, including LOQ; estimate first occurence of maximum concentration for each PK curve; if all concentrations are NA, sets Cmax and Tmax also to NA.

Value

A dataset with estimates for the Cmax (maximum concentration) and Tmax (time of first occurence of cmax) parameters: one observation per subject

Examples

example(est.thalf)
ctmax <- x %>% calc.ctmax(by = 'subject')
ctmax %>% head

Calculate NCA Parameters

Description

Calculates PK parameters for which half-life is not needed in the calculation for each PK curve defined using by.

Usage

calc.par(
  x,
  by = character(0),
  tau = NA,
  tstart = NA,
  tend = NA,
  teval = NA,
  route = "EV",
  method = 1
)

Arguments

x

contains all data after time/concentration deviation corrections obtained from correct.time and correct.conc

by

column names in x indicating grouping variables

tau

dosing interval (for multiple dosing); NA (default) for if single dose; x$tau overrides

tstart

start time of partial AUC (start>0); NA (default) if not requested; x$tstart overrides

tend

end time of partial AUC; NA (default) if not requested; x$tend overrides

teval

user selected AUC interval; NA (default) if not requested; x$teval overrides

route

route of drug administration ("EV","IVB","IVI"); x$route overrides

method

method for trapezoidal rule

  • 1: linear up - linear down

  • 2: linear up - logarithmic down

  • 3: linear before first Tmax, logarithmic after first Tmax

Value

A dataset with estimates for the following parameters, one observation per subject:

Parameter Description
t0.ok flags if t=0 concentration could be corrected/imputes. If not, no AUCs starting at t=0 are calculated
tlast.ok flags if there is at least one measurable concentration. If not, no AUClast can be calculated
tlast time of last sample with measurable concentration
clast.obs observed concentration at tlast
aucall auc calculated over all observations, including values below LOQ (which are set to 0)
auclast auc calculated using all observations up to and including the last measurable concentration (clast.obs at tlast)
aumcall aumc calculated over all observations, including values below LOQ (which are set to 0)
aumclast aumc calculated using all observations up to and including the last measurable concentration (clast.obs at tlast)
tau the dosing interval (if specified)
calc.tau flags if AUCtau could be calculated
auctau auc calculated over the dosing interval, only calculated if tau is specified
aumctau aumc calculated over the dosing interval, only calculated if tau is specified
teval user selected AUC interval starting at t=0 (if specified)
calc.teval flags if AUCteval could be calculated
aucxx auc calculated from t=0 up to/including teval, only calculated if teval is specified (xx is substituted by teval)
calc.part flags if AUCpart could be calculated
tstart start time of partial AUC (if specified)
tend end time of partial AUC (if specified)
aucx_y partial auc from time=x up to/including time=y, where x>0, only calculated if tstart and tend are specified
c0 back-extrapolated concentration at t=0 for IV bolus administration
area.back.extr area back-extrapolated to 0

Examples

example(correct.conc)
par <- x %>% calc.par(by = 'subject')
par %>% head

Calculate Lambda_z Parameters

Description

Calculates PK parameters that need lambda_z.

Usage

calc.par.th(
  x,
  by = character(0),
  th = th,
  covariates = NA,
  dose = "dose",
  factor = 1,
  reg = "SD",
  ss = "N",
  route = "EV"
)

Arguments

x

result parameter dataset from calc.par

by

column names in x indicating grouping variables

th

result dataset from est.thalf

covariates

covariates dataset (containing at least dose for CL calculation); defaults to unique combinations of by and dose evaluated on x; can be character name of csv file or local object

dose

variable containing the dose amount; default 'dose' set to 1 if not in names(x)

factor

conversion factor for CL and V calculation (e.g. dose in mg, conc in ng/mL, factor=1000); x$factor overrides

reg

regimen, "sd" or "md"; x$reg overrides

ss

is steady state reached (y/n); x$ss overrides

route

of drug administration ("EV","IVB","IVI"); x$route overrides

Value

A dataset containing all parameters calculated in est.thalf and calc.par
with estimates for the following parameters added, one observation per subject:

Parameter Description
clast.pred predicted concentration at tlast
aucinf.obs aucinf based on observed concentration at tlast
aucinf.pred aucinf based on predicted concentration at tlast
aumcinf.obs area under the first moment curve extrapolated to infinity, based on observed concentration at tlast
aumcinf.pred area under the first moment curve extrapolated to infinity, based on predicted concentration at tlast
cl.obs, cl.f.obs clearance based on aucinf.obs, at steady state based on auctau
cl.pred, cl.f.pred clearance based on aucinf.pred
cl.ss, cl.f.ss clearance at steady state, based on auctau
mrt.obs mean residence time based on aumcinf.obs and aucinf.obs
mrt.pred mean residence time based on aumcinf.pred and aucinf.pred
vz.obs, vz.f.obs distribution volume based on cl.f.obs, at steady state based on auctau
vz.pred, vz.f.pred distribution based on cl.pred/cl.f.pred
vss.obs steady-state volume based on cl.obs and mrt.obs
vss.pred steady-state volume based on cl.pred and mrt.pred
pctextr.pred percentage of AUC extrapolated to infinity, based on aucinf.pred
pctextr.obs percentage of AUC extrapolated to infinity, based on aucinf.obs
pctback.pred percentage of AUC extrapolated back to 0, based on aucinf.pred
pctback.obs percentage of AUC extrapolated back to 0, based on aucinf.obs

Note: ctmax must be merged separately as those were calculated from uncorrected data.

Examples

example(calc.par) # creates par
# notice x includes (optional) loqrule, includeCmax, reg, method, route, ss
covs <- Theoph %>%
  select(subject = Subject, Wt, dose = Dose) %>%
  unique %>%
  mutate(dose = dose * Wt, subject=as.numeric(as.character(subject))) # see ?Theoph
y <- x %>% select(subject, reg, ss, loqrule) %>% unique
y %<>% mutate(factor = 1)
par %<>% left_join(y, by = 'subject')
par %<>% calc.par.th(by = 'subject', th = th, covariates = covs)
par %<>% left_join(ctmax, ., by = 'subject')
par %>% head
par %>% data.frame %>% head(2)

Check qpNCA function arguments for validity

Description

Checks whether all function arguments are valid and entered column names are present in input data
See qpNCA for description of the arguments

Usage

check.input(
  x,
  by = NA,
  nomtimevar = NA,
  timevar = NA,
  depvar = NA,
  bloqvar = NA,
  loqvar = NA,
  loqrule = NA,
  includeCmax = NA,
  exclvar = NA,
  plotdir = NA,
  timelab = NA,
  deplab = NA,
  tau = NA,
  tstart = NA,
  tend = NA,
  teval = NA,
  covariates = NA,
  dose = NA,
  factor = NA,
  reg = NA,
  ss = NA,
  route = NA,
  method = NA
)

Arguments

x

data.frame

by

column names in x indicating grouping variables

nomtimevar

variable name containing the nominal sampling time after dose

timevar

variable name containing the actual sampling time after dose

depvar

variable name containing the dependent variable (e.g., concentration)

bloqvar

variable name containing the BLOQ flag (0: no, 1: yes)

loqvar

variable name containing the LOQ value

loqrule

rule number to be applied to the LOQ values in the curve; x$loqrule overrides if provided

includeCmax

include Cmax in half-life estimation? (y/n); x$includeCmax overrides if provided

exclvar

variable name indicating points to be excluded in half-life estimation (these should have exclvar = 1)

plotdir

directory where regression plots (.PNG) will be saved; NA gives default location, NULL skips regression plots

timelab

label for time axis in regression plots

deplab

label for dependent variable axis in regression plots

tau

dosing interval (for multiple dosing); NA (default) if single dose; x$tau overrides

tstart

start time of partial AUC (start>0); NA (default) if not requested; x$tstart overrides

tend

end time of partial AUC; NA (default) if not requested; x$tend overrides

teval

user selected AUC interval (starting at t=0); NA (default) if not requested; x$teval overrides

covariates

covariates dataset; Must contain the dose variable

dose

variable containing the dose amount

factor

conversion factor for CL and V calculation (e.g. dose in mg, conc in ng/mL, factor=1000); x$factor overrides if provided

reg

regimen, "SD" or "MD"; x$reg overrides if provided

ss

is steady state reached (y/n); x$ss overrides if provided

route

route of drug administration ("EV","IVB", "IVI"); x$route overrides if provided

method

method for trapezoidal rule; x$method overrides if provided

Value

Check results


Correct Missing Concentration

Description

Corrects missing concentration at critical time points (e.g, predose, TAU, start and end of user selected AUC interval).

Usage

correct.conc(
  x,
  by = character(0),
  nomtimevar = "ntad",
  tau = NA,
  tstart = NA,
  tend = NA,
  teval = NA,
  th = NA,
  reg = "SD",
  ss = "N",
  route = "EV",
  method = 1
)

Arguments

x

input dataset name (after Time Deviation Correction Rules have been applied by correct.time)

by

column names in x indicating grouping variables

nomtimevar

variable name containing the nominal sampling time after dose

tau

dosing interval (for multiple dosing); NA (default) for if single dose; x$tau overrides

tstart

start time of partial AUC (start>0); NA (default) if not requested; x$tstart overrides

tend

end time of partial AUC; NA (default) if not requested; x$tend overrides

teval

user selected AUC interval; NA (default) if not requested; x$teval overrides

th

lamdba_z information for each curve; like output of est.thalf

reg

regimen, "sd" or "md"; x$reg overrides

ss

is steady state reached (y/n); x$ss overrides

route

route of drug administration ("EV","IVB","IVI"); x$route overrides

method

method for trapezoidal rule; x$method overrides

  • 1: linear up - linear down

  • 2: linear up - logarithmic down

  • 3: linear before first Tmax, logarithmic after first Tmax

Details

  • Use interpolation if there is a measurable concentration BEFORE and AFTER the missing concentration

  • Use extrapolation if there is NO measurable concentration AFTER the missing concentration

  • Set missing concentration at predose to 0 (SD, non-endogenous) or value at t=TAU (steady state only)

  • Set missing concentration at t=TAU to value at t=0 (steady state only)

The following Concentration Deviation Correction Rules will be applied to critical time points (t=0, tau, tstart, tend, teval), if needed:

Rule Regimen Description Applied to
SDC-1 sd Set concentration to 0 (only non-endogenous compounds) t=0
SDC-2 sd impute missing concentration by interpolation t=tau,tstart,tend,teval
SDC-3 sd impute missing concentration by extrapolation t=tau,tend,teval
SDC-4 sd (IVB) impute missing concentration by back-extrapolation t=0
MDC-1 md impute missing concentration by existing conc at t=0 or t=tau (only if steady state has been reached) t=0,tau
MDC-2 md impute missing concentration by interpolation t=tau,tstart,tend,teval
MDC-3 md impute missing concentration by extrapolation t=tau,tend,teval
MDC-4 md (IVB) impute missing concentration by back-extrapolation t=0

Value

a dataset with missing concentrations imputed. The following variables are added:

Variable Description
crule.nr correction rule number
crule.txt text explaining what was altered
applies.to.conc lists all critical time points to which the concentration correction rule applies

Examples

example(correct.time)
x %<>% mutate(ss = 'N', route = 'EV')
# route redefined for completeness
x %<>% correct.conc(by = 'subject') # ignoring th
x %>% head

Impute Concentrations Below the Limit of Quantitation

Description

Imputes LOQ values according to the chosen LOQ substitution rule.

Usage

correct.loq(
  x,
  by = character(0),
  nomtimevar = "ntad",
  timevar = "time",
  depvar = "dv",
  bloqvar = "bloq",
  loqvar = "loq",
  loqrule = 1
)

Arguments

x

input dataset name contains all uncorrected data, including LOQ

by

column names in x indicating grouping variables

nomtimevar

variable name containing the nominal sampling time after dose

timevar

variable name containing the actual sampling time after dose

depvar

variable name containing the dependent variable (e.g., concentration)

bloqvar

variable name containing the BLOQ flag (0: no, 1: yes)

loqvar

variable name containing the LOQ value

loqrule

rule number to be applied to the LOQ values in the curve. x$loqrule overrides if provided

  • 1: 0 before first measurable concentration (FMC); NA after FMC

  • 2: 0 before FMC; 0 after FMC

  • 3: 0 before FMC; 0.5xLOQ for first consecutive LOQ after FMC, NA for other LOQ

  • 4: 0 before FMC; 0.5xLOQ for first consecutive LOQ after FMC, 0 for other LOQ

Details

Imputations will be applied to the original depvar (no new concentration variable will be created).

Value

A dataset with imputed BLOQ concentrations using the chosen imputation rule

Examples

library(magrittr)
library(dplyr)
library(qpNCA)
x <- Theoph
ntad <- c(0,0.25,0.5,1,2,4,5,7,9,12,24)
for(i in 1:nrow(x)){
  time  <- x$Time[[i]]
  delta <- abs(ntad - time)
  best  <- min(delta)
  index <- match(best, delta)
  nom   <- ntad[[index]]
  x$ntad[[i]] <- nom
}
rm(list = c('time','delta','best','index','nom', 'i','ntad'))
x %<>% rename(time = Time, dv = conc)
x %<>% mutate(bloq = ifelse(dv==0,1,0), loq = 0.01, tad = time, loqrule = 1, 
              subject=as.numeric(Subject), ntad=as.numeric(ntad))
x %>% head
x %<>% correct.loq('subject')
x %>%  head

Correct Concentrations for Time Deviations

Description

Corrects concentrations at critical, but deviating time points (e.g, predose, TAU, start and end of user selected AUC interval), and adds missing records at these critical time points.

Usage

correct.time(
  x,
  by = character(0),
  nomtimevar = "ntad",
  timevar = "time",
  depvar = "dv",
  tau = NA,
  tstart = NA,
  tend = NA,
  teval = NA,
  th = NA,
  reg = "SD",
  method = 1
)

Arguments

x

input dataset name (after LOQ values have been imputed by correct.loq)

by

column names in x indicating grouping variables

nomtimevar

variable name containing the nominal sampling time after dose

timevar

variable name containing the actual sampling time after dose

depvar

variable name containing the dependent variable (e.g., concentration)

tau

dosing interval (for multiple dosing); NA (default) if single dose; x$tau overrides

tstart

start time of partial AUC (start>0); NA (default) if not requested; x$tstart overrides

tend

end time of partial AUC; NA (default) if not requested; x$tend overrides

teval

user selected AUC interval, starting at t=0; NA (default) if not requested; x$teval overrides

th

lamdba_z information for each curve; like output of est.thalf

reg

regimen, "sd" or "md"; x$reg overrides

method

method for trapezoidal rule; x$method overrides if provided

  • 1: linear up - linear down

  • 2: linear up - logarithmic down

  • 3: linear before first Tmax, logarithmic after first Tmax

Details

  • Records with missing NOMINAL time will be removed and this must be corrected before the function is called

  • If a record at the critical time point is missing, add it and set time to nominal time and set dv conc to NA

  • Use interpolation if there is a measurable concentration AFTER the nominal time point (i.e. sample is taken too late)

  • Use extrapolation if there is NO measurable concentration AFTER the nominal time point (i.e. sample is taken too early)

  • Set deviating time at predose after single dose to 0

  • Original time and conc will be kept in original variables.

The following Time Deviation Correction Rules will be applied to critical time points (t = 0, tau, tstart, tend, teval), if needed:

Rule Regimen Description Applied to
SDT-1 sd Set actual time to 0 t = 0
SDT-2 sd Correct concentration at deviating time by interpolation t = tau,tstart,tend,teval
SDT-3 sd Correct concentration at deviating time by extrapolation t = tau,tend,teval
MDT-1 md If predose sample taken after dosing, set actual time to 0 and conc to NA t = 0
MDT-2 md Correct concentration at deviating time by interpolation (too late) t = tau,tstart,tend,teval
MDT-3 md Correct concentration at deviating time by extrapolation (too early) t = 0,tau,tend,teval
MDT-3a md Set actual time to zero if concentration is BLOQ (too early) t = 0

Value

a dataset with time deviation corrections applied (timevar and depvar adapted). The following variables are added:

Variable Description
create.nr is a missing record created?
create.txt explanation of what is created
trule.nr correction rule number
trule.txt text explaining what was altered
applies.to.time lists all critical time points to which the time deviation rule applies
time.tau, conc.tau time and conc, corrected for AUCtau calculation
time.teval, conc.teval time and conc, corrected for AUCteval calculation (AUC0-teval)
time.part, conc.part time and conc, corrected for partial AUC calculation (AUCstart-end, start>0)
time.lastall, conc.lastall time and conc, corrected for AUClast and AUCall calculation
t0.flag, tau.flag, tstart.flag, tend.flag, teval.flag flags for what timepoint the correction was needed

The following are preserved if present in x: tau, tstart, tend, teval, reg, ss, route, method.

Examples

example(calc.ctmax)
x %<>% mutate(reg = 'SD', method = 1, route = 'EV')
# route not used yet, but still preserved
x %<>% correct.time(by = 'subject', th = th)
x %>% head

Calculate Lambda_z and Elimination Half-life

Description

Calculates lambda_z and thalf for each PK curve identified using by.

Usage

est.thalf(
  x,
  by = character(0),
  timevar = "time",
  depvar = "dv",
  includeCmax = "Y",
  exclvar = NA
)

Arguments

x

a dataset

by

column names in x indicating grouping variables

timevar

variable name containing the actual sampling time after dose

depvar

variable name containing the dependent variable (e.g., concentration)

includeCmax

include results of regression including Cmax in selection? (y/n); x$includeCmax overrides if provided

exclvar

a variable name containing information about points to be excluded (these should have exclvar = 1)

Details

The function starts with the last three sample points and performs log-linear regression on it. It then adds one sampling point at a time (including and ending at tmax) and performs the regression again. The results of the regression with the highest adjusted R-squared are returned.

Visual outliers can be excluded from the regression analysis.

Value

a dataset with estimates for each regression analysis in one observation. The following parameters are available.

  • no.points number of data points used in the regression analysis

  • intercept estimated intercept

  • lambda_z -1*estimated slope

  • r.squared square of the correlation coefficient

  • adj.r.squared adjusted square of the correlation coefficient

  • thalf elimination half-life

  • start_th time of first sample included in the thalf estimation

  • end_th time of last sample included in the thalf estimation

  • includeCmax include results of regression including Cmax in selection? (y/n)

  • points_excluded are time points excluded from the half-life estimation? (y/n)

Examples

example(correct.loq)
x %<>% mutate(includeCmax = 'Y')
th <- x %>% est.thalf(by='subject',exclvar=)
th %>%  head

Create File Name for Regression Plots

Description

Creates file name for regression plots (*.png) from by-variables in plot_reg function

Usage

filenamefun(x, by)

Arguments

x

data.frame

by

column names in x indicating grouping variables

Value

character


Interpolate Concentrations

Description

Interpolates concentrations. Used by correct.xx functions to interpolate concentrations. Uses linear interpolation unless method is 2 (log down), c1 > c2, and both concentrations are non-zero.

Usage

interpol(c1 = NA, c2 = NA, t1 = NA, t2 = NA, t3 = NA, method = 1)

Arguments

c1

concentration 1 lagconc

c2

concentration 2 leadconc

t1

time 1 tiem where conc should be calculated

t2

time 2 lagtime

t3

time 3 leadtime

method

calculation method (1, 2, or 3)


Estimate Lagging and Leading Times and Concentrations

Description

Estimates lagging and leading times and concentrations. Used by correct.xx functions to estimate lagging and leading timepoints and concentrations for each timepoint.

Usage

lag_lead(
  x,
  nomtimevar1 = NA,
  depvar1 = NA,
  timevar1 = NA,
  lagc = NA,
  lagt = NA,
  leadc = NA,
  leadt = NA,
  ...
)

Arguments

x

data.frame

nomtimevar1

column name in x indicating nominal time after dose

depvar1

column name in x indicating concentration

timevar1

column name in x indicating actual time after dose

lagc

concentration at previous sampling time

lagt

previous sampling time

leadc

concentration at next sampling time

leadt

next sampling time

...

ignored

Value

data.frame


Plot Regression Curves

Description

Plots regression curves for each set of records defined using by. A log-linear plot will be made for each curve.

Usage

plot_reg(
  x,
  by = character(0),
  th = NA,
  bloqvar = "bloq",
  timevar = "tad",
  depvar = "dv",
  timelab = "timevar",
  deplab = "depvar",
  exclvar = NA,
  plotdir = NA,
  ...
)

Arguments

x

input dataset name

by

column names in x indicating grouping variables

th

file name of file with half-life estimation information for each curve

bloqvar

variable name containing the BLOQ flag (0: no, 1: yes)

timevar

variable name containing the actual sampling time after dose

depvar

variable name containing the dependent variable (e.g., concentration)

timelab

X-axis label (default: "timevar")

deplab

Y-axis label (default: "depvar")

exclvar

variable name containing information about points to be excluded (these should have exclvar = 1)

plotdir

directory where individual plot files will be saved

...

ignored

Details

If elimination half-life was estimated for that curve, the following will be indicated in the plot:

  • Cmax (Yellow, even if no half-life was estimated)

  • points used in regression and resulting regression line (green)

  • points excluded from regression (red crossed)

  • estimate of elimination half-life and adjusted R-squared

Input dataset:

  • uncorrected dataset, used for half-life estimation

  • dataset containing results of the half-life estimation

Value

(invisible) plotdir. If the attribute 'plotdir' is empty, plots will be generated in standard output, otherwise plots will be saved as PNG file in the designated directory.

Examples

example(est.thalf)
x %>% filter(dv > 0) %>% plot_reg(by = 'subject', th = th)

Perform Non-compartmental Analysis

Description

Consecutively executes the following NCA steps:

Usage

qpNCA(
  x,
  by = character(0),
  nomtimevar = "ntad",
  timevar = "time",
  depvar = "dv",
  bloqvar = "bloq",
  loqvar = "loq",
  loqrule = 1,
  includeCmax = "Y",
  exclvar = NA,
  plotdir = NA,
  timelab = "timevar",
  deplab = "depvar",
  tau = NA,
  tstart = NA,
  tend = NA,
  teval = NA,
  covariates = NA,
  dose = "dose",
  factor = 1,
  reg = "SD",
  ss = "N",
  route = "EV",
  method = 1
)

Arguments

x

input dataset name

by

column names in x indicating grouping variables

nomtimevar

variable name containing the nominal sampling time after dose

timevar

variable name containing the actual sampling time after dose

depvar

variable name containing the dependent variable (e.g., concentration)

bloqvar

variable name containing the BLOQ flag (0: no, 1: yes)

loqvar

variable name containing the LOQ value

loqrule

rule number to be applied to the LOQ values in the curve; x$loqrule overrides if provided

includeCmax

include Cmax in half-life estimation? (y/n); x$includeCmax overrides if provided

exclvar

variable name indicating points to be excluded in half-life estimation (these should have exclvar = 1)

plotdir

directory where regression plots (.PNG) will be saved; NA gives default location, NULL skips regression plots

timelab

label for time axis in regression plots

deplab

label for dependent variable axis in regression plots

tau

dosing interval (for multiple dosing); NA (default) if single dose; x$tau overrides

tstart

start time of partial AUC (start>0); NA (default) if not requested; x$tstart overrides

tend

end time of partial AUC; NA (default) if not requested; x$tend overrides

teval

user selected AUC interval (starting at t=0); NA (default) if not requested; x$teval overrides

covariates

covariates dataset; Must contain the dose variable

dose

variable containing the dose amount

factor

conversion factor for CL and V calculation (e.g. dose in mg, conc in ng/mL, factor=1000); x$factor overrides if provided

reg

regimen, "SD" or "MD"; x$reg overrides if provided

ss

is steady state reached (y/n); x$ss overrides if provided

route

route of drug administration ("EV","IVB", "IVI"); x$route overrides if provided

method

method for trapezoidal rule; x$method overrides if provided

  • 1: linear up - linear down

  • 2: linear up - logarithmic down

  • 3: linear before first Tmax, logarithmic after first Tmax

Value

(list)

  • covariates covariates selected with the covariates argument

  • half_life linear regression parameters

  • ct_corr the time and concentration corrected dataset

  • corrections descriptions of the corrections applied

  • pkpar all estimated PK parameters

  • plots generated plots

Examples

library(magrittr)
library(dplyr)
library(qpNCA)
x <- Theoph
ntad <- c(0,0.25,0.5,1,2,4,5,7,9,12,24)
for(i in 1:nrow(x)){
  time  <- x$Time[[i]]
  delta <- abs(ntad - time)
  best  <- min(delta)
  index <- match(best, delta)
  nom   <- ntad[[index]]
  x$ntad[[i]] <- nom
}
rm(list = c('time','delta','best','index','nom', 'i','ntad'))
x %<>% rename(time = Time, dv = conc, subject = Subject)
x %<>% mutate(bloq = 0, loq = 0.01, tad = time,excl_th=0,
              subject=as.numeric(subject),ntad=as.numeric(ntad))
x %<>% filter(dv > 0)
covs <- x %>%
  select(subject, Wt, dose = Dose) %>%
  distinct(subject,.keep_all=TRUE) %>%
  mutate(dose = dose * Wt) # see ?Theoph
z <- qpNCA(x, by = 'subject', covariates = covs, exclvar='excl_th')

Tabulate Corrections

Description

Tabulates what records were added, time deviations and concentration imputations were applied, for each subject.

Usage

tab.corr(x, by = character(0), nomtimevar = "time")

Arguments

x

concentration dataset created by the correct.time and correct.conc functions, containing time and conc corrected data

by

column names in x indicating grouping variables

nomtimevar

column in x containing the nominal time after dose

Value

dataset with applied corrections (rule number and rule text) listed by by-variable(s) and nominal time

Examples

example(correct.conc)
corrtab <- x %>% tab.corr(by = 'subject')
corrtab %>% head

Create Title for Regression Plots

Description

Creates title for regression plots in plot_reg() using by-variables.

Usage

titlefun(x, by)

Arguments

x

dataset containing concentration-time information of the current curve

by

column names in x indicating grouping variables

Value

character


Calculate Area Under the Curve Using Trapezoids

Description

Calculates AUC using the trapezoidal method. Assumes data represent a single profile. Despite choice of method, only linear interpolation is used for areas of intervals beginning or ending with y: 0.

Usage

trap(x = NA, y = NA, method = 1)

Arguments

x

x variable, i.e. time

y

y variable, i.e. concentration

method

method:

  • 1: linear up - linear down

  • 2: linear up - logarithmic down

  • 3: linear before Tmax, logarithmic after Tmax

Value

area (length-one numeric)


Calculate Area Under the Moment Curve Using Trapezoids

Description

Calculates AUMC using the trapezoidal method. Assumes data represent a single profile. Despite choice of method, only linear interpolation is used for areas of intervals beginning or ending with y: 0.

Usage

trapm(x = NA, y = NA, method = 1)

Arguments

x

variable names of x coordinates

y

variable names of y coordinates

method

method:

  • 1: linear up - linear down

  • 2: linear up - logarithmic down

  • 3: linear before Tmax, logarithmic after Tmax

Value

area (length-one numeric)