Terminal phase and partial areas. Before this version the package had no lambda z, no half-life, no AUCINF and no partial AUC, and — worse — said so nowhere, so the only way to find out was to notice they were missing from the metric list.
derive_terminal_phase() estimates the terminal elimination rate constant LAMZ by log-linear regression over the best-fit window (every window of at least min_points = 3 points strictly after TMAX; the longest whose adjusted R-squared is within tol = 1e-4 of the best), and derives LAMZHL = log(2) / LAMZ, AUCIFO (observed variant, from CLST) and AUCIFP (predicted variant, from the fitted CLSTP) — both are returned, neither is called the answer.LAMZNPT, LAMZLL, LAMZUL, R2 and R2ADJ, so a reviewer can judge the fit.AUCPEO and AUCPEP, with AUCPEFL = "Y" when AUCPEO exceeds max_pct_extrap (default 20, the conventional acceptance threshold).min_points quantifiable points after TMAX, a non-negative fitted slope, or no quantifiable concentration at all — returns NA for LAMZ and everything derived from it, with the reason in words in LAMZNRS.derive_partial_auc(pc, start, end) for AUC[0, 24], AUC over a dosing interval, or any other window. The window-edge rule is documented rather than assumed: linear interpolation under method = "linear", logarithmic interpolation on a descending segment under "lin_up_log_down", and INTRPFL reports whether an edge was interpolated at all. Over the full observed window AUCINT is identical to AUCLST.eradam_structure() now documents six datasets, adding "terminal" and "partial"; the same tables render into the new help pages.AUCTAU, CAVG, CLSS, accumulation ratio, fluctuation. A partial AUC over the dosing interval gives the AUCTAU number under the name AUCINT and nothing else.CL, CLF, VZ, VZF, MRT, AUMC, VSS.LAMZ window — best-fit or nothing.derive_partial_auc() refuses a window outside the observed range: it never back-extrapolates to time zero and never forward-extrapolates with LAMZ. It returns NA and the reason in AUCINTRS.derive_terminal_phase() treats a whole by group as one profile. On the shipped two-dose fixture, 10 of 24 subjects therefore have TMAX after the second dose with only two terminal points left, and return NA with the reason. Subset to one dosing interval for a multiple-dose study.AUCLST from derive_terminal_phase() runs to the last positive concentration (the NCA convention); derive_exposure_metrics() runs its AUCLST over every non-missing record. They differ only on profiles with trailing zeros, e.g. after make_adpc(blq = "zero").Initial development version.
derive_exposure_metrics() computes CMAX, TMAX, CMIN, CTROUGH and AUCLST per subject and analyte, by the linear trapezoidal rule or the linear up / log down variant, with dose-normalised AUC when dosing data is supplied.make_adpc() builds one record per subject, analyte and timepoint with nominal and actual time, actual time since the most recent dose, and a BLQ policy ("half", "zero", "drop", "keep") chosen by argument, flagged in BLQFL and marked in DTYPE.make_poppk() interleaves dosing and observation records in time order per subject and returns ID, TIME, TAD, AMT, DV, MDV, EVID, CMT, BLQ and the subject-level covariates.make_ader() joins exposure metrics to a response endpoint and derives labelled exposure quantile groups.eradam_structure() returns the variable, meaning and source of every column the package produces, and the same table is rendered into each function’s help page.eradam_example() loads the self-contained 24-subject concentration, dosing, subject-level and response fixtures shipped in inst/extdata, so every example, test and vignette runs offline.eradam_exposure, eradam_adpc, eradam_poppk and eradam_ader, each with a print() method.