How Is AUC Calculated? Trapezoidal Rule Explained

AUC stands for “area under the curve,” and it’s calculated by adding up the areas of trapezoids drawn between data points on a graph. That core math is the same whether you’re working in pharmacology (measuring drug exposure over time) or in data science (evaluating how well a diagnostic test or prediction model performs). The specific meaning of the curve, the axes, and what the final number tells you differ completely between these two fields.

AUC in Pharmacology: Measuring Drug Exposure

In pharmacology, AUC measures the total exposure your body gets from a drug after a dose. Picture a graph where the x-axis is time and the y-axis is the drug’s concentration in your blood. After you take a pill, the concentration rises, peaks, then gradually falls. The area trapped under that curve represents cumulative exposure, and it’s reported in units like ng·h/mL (nanograms per milliliter, multiplied by hours).

This number matters because it connects dose to how efficiently your body processes a drug. The relationship is straightforward: clearance equals dose divided by AUC. A higher AUC means the drug lingers longer or reaches higher concentrations, while a lower AUC means your body eliminates it faster. Researchers use AUC to compare generic drugs against brand-name versions, to adjust doses for patients with kidney or liver problems, and to ensure two formulations deliver equivalent exposure.

The Trapezoidal Rule Step by Step

Blood samples are drawn at scheduled times after a dose, and each sample gives one concentration reading. You can’t measure concentration continuously, so you’re left with a series of dots on a graph. The trapezoidal rule connects each pair of adjacent dots with a straight line, forming a series of trapezoids between the curve and the x-axis.

The formula for one trapezoid is:

AUC segment = 0.5 × (t₂ − t₁) × (C₁ + C₂)

Here, t₁ and t₂ are consecutive time points, and C₁ and C₂ are the corresponding concentrations. You’re averaging the two concentrations and multiplying by the width of the time interval. Add up every trapezoid from the first sample to the last, and you get the total AUC over the measured period (written as AUC₀₋ₙ, where n is your last time point).

This is called the linear trapezoidal method. It works well during the absorption phase, when concentrations are rising or plateauing. But during the elimination phase, when drug levels decline in a curve that bends downward, straight lines between points tend to overestimate the area. For that portion of the curve, a log-linear trapezoidal method fits better because it accounts for the exponential decay. Many pharmacokinetic software packages use a combined approach: linear trapezoidal for pre-peak data and log-linear trapezoidal for post-peak data.

Extrapolating to Infinity

Blood sampling has to stop at some point, but the drug doesn’t vanish from your body the moment the last sample is drawn. To capture the remaining tail of the curve, researchers extrapolate from the last measured concentration to infinity. The formula is:

AUC from last point to infinity = C_last / λz

C_last is the final measured concentration, and λz is the terminal elimination rate constant, which describes how quickly the drug is being cleared during that final decay phase. Adding this extrapolated piece to the measured trapezoids gives AUC₀₋∞, the total exposure from time zero to complete elimination. If the extrapolated portion accounts for too large a share of the total (commonly more than 20%), the data is considered unreliable because too much of the answer is being estimated rather than measured.

How AUC Is Used in Drug Approval

When a company wants to sell a generic version of an existing drug, regulators require proof that the generic delivers essentially the same exposure as the original. The standard set by the FDA is that the 90% confidence interval for the AUC ratio between the two products must fall within 0.80 to 1.25. In plain terms, the generic’s exposure can’t be more than 20% lower or 25% higher than the brand-name product’s exposure. For drugs with a narrow therapeutic range, where small differences in blood levels can cause toxicity or treatment failure, this window may be tightened further.

AUC in Diagnostic Testing and Machine Learning

In a completely different context, AUC measures how well a test or predictive model distinguishes between two groups, such as “has the disease” versus “doesn’t have the disease.” Here the curve is a ROC curve (receiver operating characteristic), and the AUC summarizes the model’s overall accuracy in a single number between 0.5 and 1.0.

A ROC curve plots the true-positive rate on the y-axis against the false-positive rate on the x-axis. Every point on the curve represents a different threshold for calling a result “positive.” Set the threshold low and you’ll catch almost every true case (high true-positive rate), but you’ll also flag many healthy people as positive (high false-positive rate). Raise the threshold and you’ll make fewer false alarms, but you’ll miss more real cases. The ROC curve traces that entire tradeoff.

Building the ROC Curve

Start with a model that outputs a probability or score for each person. Pick a threshold: anyone above it is predicted positive, anyone at or below it is predicted negative. Compare predictions to actual outcomes and count the true positives, false positives, true negatives, and false negatives. From those counts, calculate two rates:

  • True-positive rate: true positives divided by (true positives + false negatives). This is the fraction of actual positives the model correctly identifies.
  • False-positive rate: false positives divided by (false positives + true negatives). This is the fraction of actual negatives the model incorrectly flags.

Repeat this at many thresholds, from the most restrictive to the most lenient. Plot each pair of rates as a point, connect the points, and you have the ROC curve. The AUC is then calculated by summing the areas of trapezoids formed between consecutive points on that curve, the same trapezoidal approach used in pharmacology, just applied to a different graph.

Interpreting the AUC Score

An AUC of 0.5 means the model performs no better than flipping a coin. An AUC of 1.0 means it perfectly separates the two groups with no overlap. There’s also a useful probabilistic interpretation: the AUC equals the probability that the model will assign a higher score to a randomly chosen positive case than to a randomly chosen negative case.

In clinical and research practice, AUC values are generally graded on this scale:

  • 0.9 and above: Excellent discrimination
  • 0.8 to 0.89: Considerable (strong) discrimination
  • 0.7 to 0.79: Fair discrimination
  • 0.6 to 0.69: Poor discrimination
  • 0.5 to 0.59: No useful discrimination

Values above 0.80 are generally considered clinically useful, while anything below that threshold has limited practical value for making decisions about individual patients. These cutoffs aren’t rigid rules, though. A screening test for a rare and deadly condition might be worth using even at an AUC of 0.75 if it’s the best available option, while a test meant to guide expensive treatment might need an AUC well above 0.90 to justify the cost.

Same Math, Different Questions

Both versions of AUC rely on the trapezoidal rule to sum area under a plotted curve, but they answer fundamentally different questions. Pharmacokinetic AUC tells you how much drug your body was exposed to over time. ROC AUC tells you how accurately a test separates positive cases from negative ones. If you’re reading a study or report that mentions AUC, the context will always make it clear which version is being used: look for concentration-time data in pharmacology, or sensitivity-specificity data in diagnostics and machine learning.