Learn R Programming

nlmixr2autoinit (version 1.0.0)

trapezoidal_linear: Linear trapezoidal rule

Description

Computes the area under the curve (AUC) or the area under the moment curve (AUMC) using the linear trapezoidal rule. If moment = TRUE, the function estimates AUMC by integrating time * concentration.

Usage

trapezoidal_linear(x, y, moment = FALSE)

Value

A numeric value representing the estimated AUC or AUMC using the linear trapezoidal rule.

Arguments

x

A numeric vector representing the time points.

y

A numeric vector representing the corresponding concentration values at each time point.

moment

Logical. If TRUE, computes AUMC by integrating t * C(t) instead of just C(t).

Examples

Run this code
x <- c(0.5, 1, 2, 4, 6, 8)
y <- c(12, 8, 5, 3, 2, 1)
trapezoidal_linear(x, y)                # AUC
trapezoidal_linear(x, y, moment = TRUE) # AUMC

Run the code above in your browser using DataLab