Package 'ncar'

Title: Noncompartmental Analysis for Pharmacokinetic Report
Description: Conduct a noncompartmental analysis with industrial strength. Some features are 1) CDISC SDTM terms 2) Automatic or manual slope selection 3) Supporting both 'linear-up linear-down' and 'linear-up log-down' method 4) Interval(partial) AUCs with 'linear' or 'log' interpolation method 5) Produce pdf, rtf, text report files. * Reference: Gabrielsson J, Weiner D. Pharmacokinetic and Pharmacodynamic Data Analysis - Concepts and Applications. 5th ed. 2016. (ISBN:9198299107).
Authors: Kyun-Seop Bae [aut]
Maintainer: Kyun-Seop Bae <[email protected]>
License: GPL-3
Version: 0.5.0
Built: 2024-12-14 06:27:20 UTC
Source: CRAN

Help Index


Noncompartmental Analysis for Pharmacokinetic Report

Description

It can report a noncompartmental analysis (NCA) with industrial strength.

Details

The main functions are

pdfNCA to produce PDF file format NCA.
rtfNCA to produce rtf file format NCA.

Author(s)

Kyun-Seop Bae <[email protected]>

References

  1. Gabrielsson J, Weiner D. Pharmacokinetic and Pharmacodynamic Data Analysis - Concepts and Applications. 5th ed. 2016.

  2. Shargel L, Yu A. Applied Biopharmaceutics and Pharmacokinetics. 7th ed. 2015.

  3. Rowland M, Tozer TN. Clinical Pharmacokinetics and Pharmacodynamics - Concepts and Applications. 4th ed. 2011.

  4. Gibaldi M, Perrier D. Pharmacokinetics. 2nd ed. revised and expanded. 1982.

Examples

# Theoph and Indometh data: dose in mg, conc in mg/L, time in h

# Output to PDF file
#pdfNCA(fileName="NCA-Theoph.pdf", Theoph, key="Subject", colTime="Time",
#       colConc="conc", dose=320, doseUnit="mg", timeUnit="h", concUnit="mg/L")
#pdfNCA(fileName="NCA-Theoph.pdf", Theoph, key=c("Subject", "Wt"), colTime="Time",
#       colConc="conc", dose=320, doseUnit="mg", timeUnit="h", concUnit="mg/L")
#pdfNCA(fileName="NCA-Indometh.pdf", Indometh, key="Subject", colTime="time",
#       colConc="conc", adm="Infusion", dur=0.5, dose=25, doseUnit="mg",
#       timeUnit="h", concUnit="mg/L")


# Output to RTF file
#rtfNCA(fileName="NCA-Theoph.rtf", Theoph, key="Subject", colTime="Time",
#       colConc="conc", dose=320, doseUnit="mg", timeUnit="h", concUnit="mg/L")
#rtfNCA(fileName="NCA-Theoph.rtf", Theoph, key=c("Subject", "Wt"), colTime="Time",
#       colConc="conc", dose=320, doseUnit="mg", timeUnit="h", concUnit="mg/L")
#rtfNCA(fileName="NCA-Indometh.rtf", Indometh, key="Subject", colTime="time",
#       colConc="conc", adm="Infusion", dur=0.5, dose=25, doseUnit="mg",
#       timeUnit="h", concUnit="mg/L")

NCA output to pdf file

Description

This output NCA result in a pdf file.

Usage

pdfNCA(fileName = "Temp-NCA.pdf", concData, key = "Subject", colTime = "Time", 
       colConc = "conc", dose = 0, adm = "Extravascular", dur = 0, 
       doseUnit = "mg", timeUnit = "h", concUnit = "ug/L", down="Linear", 
       R2ADJ = 0, MW = 0, SS = FALSE, iAUC = "", excludeDelta = 1)

Arguments

fileName

file name to save

concData

concentration data table

key

column names of concData to be shown in the output table

colTime

column name for time

colConc

column name for concentration

dose

administered dose

adm

one of "Bolus" or "Infusion" or "Extravascular" to indicate drug administration mode

dur

duration of infusion

doseUnit

unit of dose

timeUnit

unit of time

concUnit

unit of concentration

down

either of "Linear" or "Log" to indicate the way to calculate AUC and AUMC

R2ADJ

Minimum adjusted R-square value to determine terminal slope automatically

MW

molecular weight of drug

SS

if steady-state, this should be TRUE. AUCLST (AUClast) is used instead of AUCIFO (AUCinf) for the calculation of Vz (VZFO, VZO), CL (CLFO, CLO), and Vdss (VSSO).

iAUC

interval AUC information in a dataframe with "Name", "Start", and "End" columns

excludeDelta

Improvement of R2ADJ larger than this value could exclude the last point. Default value 1 is for the compatibility with other software. Author recommends to use excludeDelta option with about 0.3.

Value

CMAX

maximum concentration, Cmax

CMAXD

dose normalized Cmax, CMAX / Dose, Cmax / Dose

TMAX

time of maximum concentration, Tmax

TLAG

time to observe the first non-zero concentration, for extravascular administration only

CLST

last positive concentration observed, Clast

CLSTP

last positive concentration predicted, Clast_pred

TLST

time of last positive concentration, Tlast

LAMZHL

half-life by lambda z, ln(2)/LAMZ

LAMZ

lambda_z negative of best fit terminal slope

LAMZLL

earliest time for LAMZ

LAMZUL

last time for LAMZ

LAMZNPT

number of points for LAMZ

CORRXY

correlation of log(concentration) and time

R2

R-squared

R2ADJ

R-squared adjusted

C0

back extrapolated concentration at time 0, for bolus intravascular administration only

AUCLST

AUC from 0 to TLST

AUCALL

AUC using all the given points, including trailing zero concentrations

AUCIFO

AUC infinity observed

AUCIFOD

AUCIFO / Dose

AUCIFP

AUC infinity predicted using CLSTP instead of CLST

AUCIFPD

AUCIFP / Dose

AUCPEO

AUC % extrapolation observed

AUCPEP

AUC % extrapolated for AUCIFP

AUCPBEO

AUC % back extrapolation observed, for bolus IV administration only

AUCPBEP

AUC % back extrapolation predicted with AUCIFP, for bolus IV administration only

AUMCLST

AUMC to the TLST

AUMCIFO

AUMC infinity observed using CLST

AUMCIFP

AUMC infinity determined by CLSTP

AUMCPEO

AUMC % extrapolated observed

AUMCPEP

AUMC % extrapolated predicted

MRTIVLST

mean residence time (MRT) to TLST, for intravascular administration

MRTIVIFO

mean residence time (MRT) infinity using CLST, for intravascular administration

MRTIVIFP

mean residence time (MRT) infinity using CLSTP, for intravascular administration

MRTEVLST

mean residence time (MRT) to TLST, for extravascular administration

MRTEVIFO

mean residence time (MRT) infinity using CLST, for extravascular administration

MRTEVIFP

mean residence time (MRT) infinity using CLSTP, for extravascular administration

VZO

volume of distribution determined by LAMZ and AUCIFO, for intravascular administration

VZP

volume of distribution determined by LAMZ and AUCIFP, for intravascular administration

VZFO

VZO for extravascular administration, VZO/F, F is bioavailability

VZFP

VZP for extravascular administration, VZP/F, F is bioavailability

CLO

clearance using AUCIFO, for intravascular administration

CLP

clearance using AUCIFP, for intravascular administration

CLFO

CLO for extravascular administration, CLO/F, F is bioavailability

CLFP

CLP for extravascular administration, CLP/F, F is bioavailability

VSSO

volume of distribution at steady state using CLST, for intravascular administration only

VSSP

volume of distribution at stead state using CLSTP, for intravascular administration only

Author(s)

Kyun-Seop Bae <[email protected]>

See Also

help, txtNCA, rtfNCA

Examples

#pdfNCA(fileName="NCA-Theoph.pdf", Theoph, key="Subject", colTime="Time", 
#       colConc="conc", dose=320, doseUnit="mg", timeUnit="h", concUnit="mg/L")
#pdfNCA(fileName="NCA-Theoph.pdf", Theoph, key=c("Subject", "Wt"), colTime="Time",
#       colConc="conc", dose=320, doseUnit="mg", timeUnit="h", concUnit="mg/L")
#pdfNCA(fileName="NCA-Indometh.pdf", Indometh, key="Subject", colTime="time", 
#       colConc="conc", adm="Infusion", dur=0.5, dose=25, doseUnit="mg", 
#       timeUnit="h", concUnit="mg/L")

Convert sNCA output table to text form

Description

This converts the table output of sNCA to text form output.

Usage

Res2Txt(ResNCA, x, y, dose = 0, adm = "Extravascular", dur = 0, doseUnit = "mg", 
        down = "Linear")

Arguments

ResNCA

Output table from sNCA

x

usually time

y

usually concentration

dose

given amount

adm

one of "Bolus" or "Infusion" or "Extravascular" to indicate drug administration mode

dur

duration of infusion

doseUnit

unit of dose

down

either of "Linear" or "Log" to indicate the way to calculate AUC and AUMC

Value

Text form output from the coversion of table form output

Author(s)

Kyun-Seop Bae <[email protected]>

See Also

txtNCA, pdfNCA, rtfNCA

Examples

x = Theoph[Theoph$Subject=="1","Time"]
y = Theoph[Theoph$Subject=="1","conc"]
z = sNCA(x, y, dose=320, doseUnit="mg", concUnit="mg/L", timeUnit="h")
Res2Txt(z, x, y)

Round Half Away from Zero

Description

This is an ordinary rounding function, so called round half away from zero

Usage

Round(x, n = 0)

Arguments

x

numeric to be rounded

n

indicating decimal digits

Details

The function round in R base rounds to the even number, i.e. round(0.5) is 0 not 1. If you want rounding 0.5 be 1, you can use this Round function. This function is for the consistency with other software like MS-Excel, SAS.

Value

ordinarily rounded value

Author(s)

Kyun-Seop Bae <[email protected]>

References

See wikipedia subject "Rounding"

Examples

(x = 1:10 - 0.5)
Round(x)
round(x) # compare with the above

NCA Report Configuation Table

Description

Contains the names and order of colum of return table/text in ouputs

Usage

RptCfg

Format

A data frame with 48 observations on the following 10 variables.

PPTESTCD

a character vector of CDISC SDTM PPTESTCD

SYNONYM

a character vector of CDISC SDTM PPTESTCD Synonym

NCI

a character vector of NCI peferred terms

WNL

a character vector of WinNonlin(R) software variables

ExtravascularDefault

a numeric vector of ordering in report for extravascular administration, Zero means exclusion in the report.

ExtravascularWNL

a numeric vector of WinNonlin(R) style ordering in report for extravascular administration, Zero means exclusion in the report.

BolusDefault

a numeric vector of ordering in report for extravascular administration, Zero means exclusion in the report.

BolusWNL

a numeric vector of WinNonlin(R) style ordering in report for extravascular administration, Zero means exclusion in the report.

InfusionDefault

a numeric vector of ordering in report for extravascular administration, Zero means exclusion in the report.

InfusionWNL

a numeric vector of WinNonlin(R) style ordering in report for extravascular administration, Zero means exclusion in the report.

Details

This table should exist in this package.


NCA output to rtf file

Description

This output NCA result in a rtf file.

Usage

rtfNCA(fileName = "Temp-NCA.rtf", concData, key = "Subject", colTime = "Time", 
       colConc = "conc", dose = 0, adm = "Extravascular", dur = 0, 
       doseUnit = "mg", timeUnit = "h", concUnit = "ug/L", down="Linear", 
       R2ADJ = 0, MW = 0, SS = FALSE, iAUC = "", excludeDelta = 1)

Arguments

fileName

file name to save

concData

concentration data table

key

column names of concData to be shown in the output

colTime

column name for time

colConc

column name for concentration

dose

administered dose

adm

one of "Bolus" or "Infusion" or "Extravascular" to indicate drug administration mode

dur

duration of infusion

doseUnit

unit of dose

timeUnit

unit of time

concUnit

unit of concentration

down

either of "Linear" or "Log" to indicate the way to calculate AUC and AUMC

R2ADJ

Minimum adjusted R-square value to determine terminal slope automatically

MW

molecular weight of drug

SS

if steady-state, this should be TRUE. AUCLST (AUClast) is used instead of AUCIFO (AUCinf) for the calculation of Vz (VZFO, VZO), CL (CLFO, CLO), and Vdss (VSSO).

iAUC

interval AUC information in a dataframe with "Name", "Start", and "End" columns

excludeDelta

Improvement of R2ADJ larger than this value could exclude the last point. Default value 1 is for the compatibility with other software. Author recommends to use excludeDelta option with about 0.3.

Value

CMAX

maximum concentration, Cmax

CMAXD

dose normalized Cmax, CMAX / Dose, Cmax / Dose

TMAX

time of maximum concentration, Tmax

TLAG

time to observe the first non-zero concentration, for extravascular administration only

CLST

last positive concentration observed, Clast

CLSTP

last positive concentration predicted, Clast_pred

TLST

time of last positive concentration, Tlast

LAMZHL

half-life by lambda z, ln(2)/LAMZ

LAMZ

lambda_z negative of best fit terminal slope

LAMZLL

earliest time for LAMZ

LAMZUL

last time for LAMZ

LAMZNPT

number of points for LAMZ

CORRXY

correlation of log(concentration) and time

R2

R-squared

R2ADJ

R-squared adjusted

C0

back extrapolated concentration at time 0, for bolus intravascular administration only

AUCLST

AUC from 0 to TLST

AUCALL

AUC using all the given points, including trailing zero concentrations

AUCIFO

AUC infinity observed

AUCIFOD

AUCIFO / Dose

AUCIFP

AUC infinity predicted using CLSTP instead of CLST

AUCIFPD

AUCIFP / Dose

AUCPEO

AUC % extrapolation observed

AUCPEP

AUC % extrapolated for AUCIFP

AUCPBEO

AUC % back extrapolation observed, for bolus IV administration only

AUCPBEP

AUC % back extrapolation predicted with AUCIFP, for bolus IV administration only

AUMCLST

AUMC to the TLST

AUMCIFO

AUMC infinity observed using CLST

AUMCIFP

AUMC infinity determined by CLSTP

AUMCPEO

AUMC % extrapolated observed

AUMCPEP

AUMC % extrapolated predicted

MRTIVLST

mean residence time (MRT) to TLST, for intravascular administration

MRTIVIFO

mean residence time (MRT) infinity using CLST, for intravascular administration

MRTIVIFP

mean residence time (MRT) infinity using CLSTP, for intravascular administration

MRTEVLST

mean residence time (MRT) to TLST, for extravascular administration

MRTEVIFO

mean residence time (MRT) infinity using CLST, for extravascular administration

MRTEVIFP

mean residence time (MRT) infinity using CLSTP, for extravascular administration

VZO

volume of distribution determined by LAMZ and AUCIFO, for intravascular administration

VZP

volume of distribution determined by LAMZ and AUCIFP, for intravascular administration

VZFO

VZO for extravascular administration, VZO/F, F is bioavailability

VZFP

VZP for extravascular administration, VZP/F, F is bioavailability

CLO

clearance using AUCIFO, for intravascular administration

CLP

clearance using AUCIFP, for intravascular administration

CLFO

CLO for extravascular administration, CLO/F, F is bioavailability

CLFP

CLP for extravascular administration, CLP/F, F is bioavailability

VSSO

volume of distribution at steady state using CLST, for intravascular administration only

VSSP

volume of distribution at stead state using CLSTP, for intravascular administration only

Author(s)

Kyun-Seop Bae <[email protected]>

See Also

help, txtNCA, pdfNCA

Examples

#rtfNCA(fileName="NCA-Theoph.rtf", Theoph, key="Subject", colTime="Time", 
#       colConc="conc", dose=320, doseUnit="mg", timeUnit="h", concUnit="mg/L")
#rtfNCA(fileName="NCA-Theoph.rtf", Theoph, key=c("Subject", "Wt"), colTime="Time",
#       colConc="conc", dose=320, doseUnit="mg", timeUnit="h", concUnit="mg/L")
#rtfNCA(fileName="NCA-Indometh.rtf", Indometh, key="Subject", colTime="time", 
#       colConc="conc", adm="Infusion", dur=0.5, dose=25, doseUnit="mg", 
#       timeUnit="h", concUnit="mg/L")

Text output of NCA for one subject

Description

This is the text form output.

Usage

txtNCA(x, y, dose = 0, adm = "Extravascular", dur = 0, doseUnit = "mg", 
       timeUnit = "h", concUnit = "ug/L", iAUC = "", down="Linear", R2ADJ=0, 
       MW = 0, SS = FALSE, excludeDelta = 1)

Arguments

x

usually time

y

usually concentration

dose

given amount

adm

one of "Bolus" or "Infusion" or "Extravascular" to indicate drug administration mode

dur

duration of infusion

doseUnit

unit of dose

timeUnit

unit of time

concUnit

unit of concentration

iAUC

interval AUCs to calculate

down

either of "Linear" or "Log" to indicate the way to calculate AUC and AUMC

R2ADJ

Minimum adjusted R-square value to determine terminal slope automatically

MW

molecular weight of the drug

SS

if steady-state, this should be TRUE. AUCLST (AUClast) is used instead of AUCIFO (AUCinf) for the calculation of Vz (VZFO, VZO), CL (CLFO, CLO), and Vdss (VSSO).

excludeDelta

Improvement of R2ADJ larger than this value could exclude the last point. Default value 1 is for the compatibility with other software. Author recommends to use excludeDelta option with about 0.3.

Value

CMAX

maximum concentration, Cmax

CMAXD

dose normalized Cmax, CMAX / Dose, Cmax / Dose

TMAX

time of maximum concentration, Tmax

TLAG

time to observe the first non-zero concentration, for extravascular administration only

CLST

last positive concentration observed, Clast

CLSTP

last positive concentration predicted, Clast_pred

TLST

time of last positive concentration, Tlast

LAMZHL

half-life by lambda z, ln(2)/LAMZ

LAMZ

lambda_z negative of best fit terminal slope

LAMZLL

earliest time for LAMZ

LAMZUL

last time for LAMZ

LAMZNPT

number of points for LAMZ

CORRXY

correlation of log(concentration) and time

R2

R-squared

R2ADJ

R-squared adjusted

C0

back extrapolated concentration at time 0, for bolus intravascular administration only

AUCLST

AUC from 0 to TLST

AUCALL

AUC using all the given points, including trailing zero concentrations

AUCIFO

AUC infinity observed

AUCIFOD

AUCIFO / Dose

AUCIFP

AUC infinity predicted using CLSTP instead of CLST

AUCIFPD

AUCIFP / Dose

AUCPEO

AUC % extrapolation observed

AUCPEP

AUC % extrapolated for AUCIFP

AUCPBEO

AUC % back extrapolation observed, for bolus IV administration only

AUCPBEP

AUC % back extrapolation predicted with AUCIFP, for bolus IV administration only

AUMCLST

AUMC to the TLST

AUMCIFO

AUMC infinity observed using CLST

AUMCIFP

AUMC infinity determined by CLSTP

AUMCPEO

AUMC % extrapolated observed

AUMCPEP

AUMC % extrapolated predicted

MRTIVLST

mean residence time (MRT) to TLST, for intravascular administration

MRTIVIFO

mean residence time (MRT) infinity using CLST, for intravascular administration

MRTIVIFP

mean residence time (MRT) infinity using CLSTP, for intravascular administration

MRTEVLST

mean residence time (MRT) to TLST, for extravascular administration

MRTEVIFO

mean residence time (MRT) infinity using CLST, for extravascular administration

MRTEVIFP

mean residence time (MRT) infinity using CLSTP, for extravascular administration

VZO

volume of distribution determined by LAMZ and AUCIFO, for intravascular administration

VZP

volume of distribution determined by LAMZ and AUCIFP, for intravascular administration

VZFO

VZO for extravascular administration, VZO/F, F is bioavailability

VZFP

VZP for extravascular administration, VZP/F, F is bioavailability

CLO

clearance using AUCIFO, for intravascular administration

CLP

clearance using AUCIFP, for intravascular administration

CLFO

CLO for extravascular administration, CLO/F, F is bioavailability

CLFP

CLP for extravascular administration, CLP/F, F is bioavailability

VSSO

volume of distribution at steady state using CLST, for intravascular administration only

VSSP

volume of distribution at stead state using CLSTP, for intravascular administration only

Author(s)

Kyun-Seop Bae <[email protected]>

See Also

help, pdfNCA, rtfNCA

Examples

# For one subject
txtNCA(Theoph[Theoph$Subject=="1","Time"], Theoph[Theoph$Subject=="1","conc"], 
       dose=320, doseUnit="mg", concUnit="mg/L", timeUnit="h")

# or equivalently
x = Theoph[Theoph$Subject=="1","Time"]
y = Theoph[Theoph$Subject=="1","conc"]
txtNCA(x, y, dose=320, doseUnit="mg", concUnit="mg/L", timeUnit="h")

# For all subjects
IDs = sort(as.numeric(unique(Theoph[,"Subject"])))
nID = length(IDs)
Res = vector()
for (i in 1:nID) {
  tRes = txtNCA(Theoph[Theoph[,"Subject"]==IDs[i],"Time"], 
                Theoph[Theoph[,"Subject"]==IDs[i],"conc"], 
                dose=320, concUnit="mg/L")
  tRes = c(paste("ID =", IDs[i]), tRes, "")
  Res = c(Res, tRes)
}
Res