Learn R Programming

pkpd.Release (version 0.1.0)

two_compartment_iv_bolus: Two-Compartment IV Bolus Pharmacokinetic Model (Linear)

Description

Fits plasma concentration-time data following an intravenous (IV) bolus dose using a **log-linear approximation of a two-compartment pharmacokinetic model**.

This function applies linear regression to the logarithm of plasma concentrations versus time to estimate the **terminal elimination phase** parameters. The approach provides an empirical approximation to a biexponential decline but does **not explicitly decompose** the curve into distribution and elimination exponentials.

Under the two-compartment IV bolus model, concentration-time profiles are classically described by:

$$ C(t) = A e^{-\alpha t} + B e^{-\beta t} $$

In this implementation, the terminal log-linear phase is approximated as:

$$ \log(C) = \log(C_0) - k_{el} \, t $$

where \(C_0\) is the extrapolated initial concentration and \(k_{el}\) is the apparent elimination rate constant.

From the fitted log-linear model, secondary pharmacokinetic parameters are derived, including terminal half-life, apparent volume of distribution, and clearance.

Value

A list containing:

fitted_parameters

Data frame with C0, kel, t_half, Vd, CL, and R^2 for each group.

data

Processed data used for fitting and plotting.

Arguments

data

A data frame with plasma concentration-time data.

time_col

Character string for the time column.

conc_col

Character string for plasma concentration column.

dose

Numeric value specifying IV bolus dose.

group_col

Optional character string specifying grouping variable.

plot

Logical; if TRUE, generates concentration-time plots.

annotate

Logical; if TRUE, annotates plot (only if <=2 groups).

Author

Paul Angelo C. Manlapaz

References

Gibaldi, M. & Perrier, D. (1982) <isbn:9780824710422> Pharmacokinetics, 2nd Edition. Marcel Dekker, New York.

Gabrielsson, J. & Weiner, D. (2000) <isbn:9186274929> Pharmacokinetic/Pharmacodynamic Data Analysis: Concepts and Applications, 3rd Edition, Revised and Expanded. Swedish Pharmaceutical Press, Stockholm.

Examples

Run this code
# Example I: Single subject two-compartment IV bolus data
df <- data.frame(
  time = c(0.08, 0.25, 0.5, 1, 2, 4, 6, 8, 12),
  concentration = c(40.0, 30.5, 25.0, 17.5, 10.2, 6.4, 4.1, 2.8, 1.5)
)
two_compartment_iv_bolus(
  data = df,
  time_col = "time",
  conc_col = "concentration",
  dose = 100
)

# Example II: Condition-dependent pharmacokinetics (e.g., physiological state)
df_cond <- data.frame(
  time = rep(c(0.25, 0.5, 1, 2, 4, 6, 8), 2),
  concentration = c(
    25.3, 22.1, 18.5, 13.2, 8.5, 5.6, 3.8,   # Condition A
    20.7, 18.0, 14.9, 11.3, 7.1, 4.7, 3.2    # Condition B
  ),
  condition = rep(c("Condition A", "Condition B"), each = 7)
)
two_compartment_iv_bolus(
  data = df_cond,
  time_col = "time",
  conc_col = "concentration",
  dose = 100,
  group_col = "condition"
)

# Example III: Multiple subjects (population-style two-compartment IV bolus pharmacokinetics)
df_subjects <- data.frame(
  time = rep(c(0.25, 0.5, 1, 2, 4, 6, 8), 5),
  concentration = c(
    26.1, 23.2, 19.6, 14.0, 9.0, 6.0, 4.0,   # Subject 1
    24.8, 21.8, 18.4, 13.3, 8.8, 5.8, 3.9,   # Subject 2
    25.5, 22.5, 19.0, 13.8, 8.7, 5.7, 3.7,   # Subject 3
    23.9, 20.9, 17.7, 12.8, 8.4, 5.5, 3.5,   # Subject 4
    24.4, 21.5, 18.0, 13.0, 8.5, 5.6, 3.6    # Subject 5
  ),
  subject = rep(paste0("S", 1:5), each = 7)
)
two_compartment_iv_bolus(
  data = df_subjects,
  time_col = "time",
  conc_col = "concentration",
  dose = 100,
  group_col = "subject"
)

Run the code above in your browser using DataLab