Package 'PKPDmodels'

Title: Pharmacokinetic/Pharmacodynamic Models
Description: Provides functions to evaluate common pharmacokinetic/pharmacodynamic models and their gradients. Compatibility updates by Renova.
Authors: Anne Dubois [aut], Julie Bertand [aut], France Mentre [aut], Douglas Bates [aut, cre]
Maintainer: Douglas Bates <[email protected]>
License: GPL (>= 2)
Version: 0.3.2.9001
Built: 2026-11-13 17:46:47 UTC
Source: https://github.com/renova-r/PKPDmodels

Help Index


Expressions for PK models with linear elimination

Description

Return a formula for the PK model with linear elimination according to the number of compartments, the administration form and the dosage pattern.

Usage

PKexpr(admin = c("bolus", "infusion", "oral"),
    dosage = c("sd", "md", "ss"), subst = list(), cpt = 1L)

Arguments

admin

form of administration of the drug, one of "bolus", "infusion" or "oral". Defaults to "bolus".

dosage

form of dosage, one of "sd" (single dose), "md" (multiple, equally-spaced doses) and "ss" (steady-state). Defaults to "sd".

subst

a list of formulas of substitutions to perform

cpt

scalar integer - the number of model compartments.

Value

a formula

Examples

## single-dose oral administration
PKexpr("oral", "sd")

PK models with linear elimination

Description

Create a model function with gradient evaluation (and, optionally, Hessian evaluation) for a model according to the number of compartments, the form of administration and dosage of the drug after performing any substitutions given.

Usage

PKmod(admin = c("bolus", "infusion", "oral"),
    dosage = c("sd", "md", "ss"), subst = list(), cpt = 1L,
    hessian = FALSE)

Arguments

admin

form of administration of the drug, one of "bolus", "infusion" or "oral". Defaults to "bolus".

dosage

type of dosage of the drug, one of "sd" (single dose), "md" (multiple dose) or "ss" (steady-state). Defaults to "sd".

subst

a list of formulas of substitutions to perform

cpt

scalar integer - the number of model compartments.

hessian

a logical value indicating whether the second derivatives should be calculated and incorporated in the return value.

Details

The substitutions are given as a list of formulas, such as list(k ~ Cl/V, Cl ~ exp(lCl), V ~ exp(lV)). They are applied left to right.

Value

a byte-compiled model function with gradient evaluation

Examples

## return a function with substitutions
PKmod("bolus", "sd", list(k ~ Cl/V, Cl ~ exp(lCl), V ~ exp(lV)))

"Sub[stitute] expr[ession]"

Description

Substitute the expression sub for the name nm in expr by walking the tree.

Usage

subexpr(expr, nm, sub)

Arguments

expr

an expression

nm

a name for which to substitute

sub

the expression to substitute for name nm

Value

the expression with all occurrences of nm replaced by sub

Note

this function is called recursively