Package {SmartPK}


Type: Package
Title: Automated Noncompartmental Pharmacokinetic Analysis
Version: 0.1.0
Maintainer: N. Shreenithi <Shreenithi092@gmail.com>
Description: Provides functions for automated noncompartmental pharmacokinetic (NCA) analysis using concentration-time data. The package estimates pharmacokinetic parameters including area under the concentration-time curve (AUC), area under the first moment curve (AUMC), maximum concentration (Cmax), time to maximum concentration (Tmax), terminal elimination rate constant (Kel), elimination half-life, clearance, volume of distribution, and mean residence time (MRT). It supports automatic terminal phase selection, bootstrap confidence intervals, and publication-ready concentration-time profiles. Methods are based on Gibaldi and Perrier (1982, ISBN:9780824710422).
License: GPL-3
Encoding: UTF-8
Imports: ggplot2, rlang
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-08-17 15:15:28 UTC; JARVIS
Author: N. Shreenithi [aut, cre], S. Vishnu Shankar [aut], Balaji Kannan [aut]
Repository: CRAN
Date/Publication: 2026-08-24 14:40:02 UTC

Automated Noncompartmental Pharmacokinetic Analysis

Description

Provides functions for automated noncompartmental pharmacokinetic (NCA) analysis using concentration-time data. The package estimates pharmacokinetic parameters including area under the concentration-time curve (AUC), area under the first moment curve (AUMC), maximum concentration (Cmax), time to maximum concentration (Tmax), terminal elimination rate constant (Kel), elimination half-life, clearance, volume of distribution, and mean residence time (MRT). It supports automatic terminal phase selection, bootstrap confidence intervals, and publication-ready concentration-time profiles.

Usage

SmartPK(
  data,
  dose,
  time_col = "Time",
  conc_col = "Concentration",
  route = c("iv", "extravascular"),
  min_terminal_points = 3,
  max_terminal_points = 6,
  lambda_method = c("auto", "lastn", "manual"),
  terminal_idx = NULL,
  n_boot = 0,
  conf_level = 0.95,
  plot = TRUE,
  log_plot = TRUE,
  return_plot = TRUE
)

Arguments

data

A data frame containing concentration-time observations.

dose

A single positive numeric dose value.

time_col

Name of the time column in data. Default is "Time".

conc_col

Name of the concentration column in data. Default is "Concentration".

route

Route of administration. Must be "iv" or "extravascular".

min_terminal_points

Minimum number of points used to estimate the terminal phase.

max_terminal_points

Maximum number of points used to estimate the terminal phase.

lambda_method

Method for terminal slope estimation: "auto", "lastn", or "manual".

terminal_idx

Integer indices of terminal points when lambda_method is "lastn" or "manual".

n_boot

Number of bootstrap resamples used to estimate confidence intervals. Set to 0 to skip bootstrapping.

conf_level

Confidence level for bootstrap intervals. Default is 0.95.

plot

Logical; whether to generate a concentration-time plot.

log_plot

Logical; whether the plot should use a log10 y-axis.

return_plot

Logical; whether to include the plot in the returned object.

Details

The function computes observed AUC and AUMC using the trapezoidal rule, then extrapolates to infinity using the terminal elimination rate constant estimated from a log-linear regression of the terminal phase. The terminal phase may be selected automatically, manually, or using the last n points depending on the value of lambda_method.

Value

A list with the following components:

References

Gibaldi, M. and Perrier, D. (1982). Pharmacokinetics. 2nd Edition. Marcel Dekker, New York. ISBN: 9780824710422.

Examples

df <- data.frame(
  Time = c(0, 1, 2, 4, 6, 8),
  Concentration = c(0, 12, 9, 5, 2, 0.8)
)

SmartPK(df, dose = 100)