Steady state is now analysed over the dosing interval. sNCA and tblNCA gain tau (the dosing interval) and unitTau (its unit, default "h"), which are required when SS=TRUE. Two parameters are added to the result: AUCTAU, the AUC from 0 to tau computed through the same interval-AUC engine as iAUC (a tau between two samples is interpolated according to down; a tau beyond the last measurable sample is reached by lambda z extrapolation), and CAVG, the average steady-state concentration AUCTAU/tau. With SS=TRUE, CLO and CLFO are now dose/AUCTAU, VZO and VZFO are dose/AUCTAU/LAMZ, and VSSO follows from the corrected CLO. Up to 0.8.3 SS=TRUE put AUCLST in their place, which equals AUCtau only when the last sample happens to fall exactly at tau and is otherwise not the steady-state clearance at all. VZFP, CLFP, MRTEVIFO, MRTEVIFP and their intravascular counterparts remain NA at steady state, as before.
SS=TRUE without tau now stops instead of silently computing a clearance from the wrong area; a tau given with SS=FALSE is ignored with a warning. unitTau accepts s, min, h, d and wk (and their common spellings) and converts tau into timeUnit. In tblNCA, tau is a scalar or one value per NCA, like dose and dur.
An iAUC name that collides with a standard parameter name (for example "AUCTAU" together with SS=TRUE) now stops with a message instead of overwriting the parameter in silence. Scripts that computed AUCtau themselves as iAUC=data.frame(Name="AUCTAU", Start=0, End=tau) next to SS=TRUE should drop that entry and pass tau; the value is identical. Without SS the name stays free, so a first-dose "AUCTAU" still works.
Unit knows AUCTAU (time times concentration) and CAVG (concentration). An interval AUC that borrows the name of a Unit row now overwrites that row instead of appending a duplicate, which stopped with “duplicate 'row.names' are not allowed”.
Fixed the flat-profile branch of sNCA (every concentration identical): an intravascular bolus with a time-0 sample and an iAUC request stopped with “object 'x2' not found”, and the units attribute of a flat profile with iAUC was longer than the result because the interval-AUC units were appended twice.
OQNCA gains two Tier A steady-state cases on a fixture whose AUCtau is the hand-summable trapezoid 66, once with tau in hours and once with the same tau in days. ‘inst/OQ/RptCfg.csv’ maps AUCTAU and CAVG to the WinNonlin names AUC_TAU and Cavg.
‘tests/RptCfg.csv’ lacked the WNL column that ‘tests/Test.R’ reads to map the parameter names of tblNCA onto the WinNonlin reference columns. The lookup returned NULL, no parameter column matched, and the eight WinNonlin comparisons in ‘tests/Test.R’ passed without comparing a single parameter value. The file now carries the same columns as ‘inst/OQ/RptCfg.csv’; all eight comparisons pass with the values actually compared. Added ‘tests/Test-SS.R’, which fails on the 0.8.3 build.
The formula document ‘inst/extdoc/NCA-Formula.pdf’ gains the sections AUCtau (AUCTAU) and Cavg (CAVG), the steady-state forms of Vz, CL and Vss, and a worked steady-state example. Three errors in the previous edition were corrected: the linear trapezoid for AUClast was written with C_i - C_{i-1} instead of C_i + C_{i-1}, the log-down back-extrapolated area with C_0 + C_1 instead of C_0 - C_1, and the dose-normalised AUCinf sections appeared twice.
Fixed CLSTP in the UsePoints branch of sNCA. The mask was built from y[UsePoints] but used to subset the full-length x; because the mask is shorter, R recycled it silently, and since terminal-slope points are always positive the mask was all TRUE and selected the whole of x. CLSTP was therefore extrapolated to the last sampling time instead of TLST (the last non-zero time). Only profiles carrying trailing zero or BLQ samples were affected. The error propagated to AUCIFP, AUCIFPD, AUCPEP, AUMCIFP, AUMCPEP, VZFP, CLFP, MRTEVIFP and, for non-extravascular routes, VZP, CLP, MRTIVIFP, VSSP. The automatic path was never affected, so results differed between automatic slope selection and UsePoints for the same points. Introduced in 0.8.0.
Fixed the UsedPoints index remapping in sNCA. BestSlope and DetSlope return indices into the zero-stripped x1, and a single scalar offset measured at LAMZLL was used to convert them into indices into x. Every zero removed inside the lambda z window shifted the later indices by one, so the reported UsedPoints named the wrong samples and could even name a zero-concentration sample. As a consequence the documented round trip of feeding attr(, "UsedPoints") from tblNCA back in as UsePoints was not idempotent. Introduced in 0.8.0.
Fixed TLAG in sNCA. It reported the last zero anywhere in the trailing-zero-stripped profile, so a single embedded BLQ sample occurring after measurable concentrations moved TLAG to that late time; it is now the last zero before the first measurable concentration. This also retires a test on y0[x0 == 0] that failed with “the condition has length > 1” when several records shared time 0.
Slope now returns NA for R2ADJ when only two points are fit. The expression divides by n - 2 and previously yielded NaN, +Inf or -Inf depending on how R2 rounded. The automatic path never fits two points, but UsePoints can request it.
Fixed the UsedPoints reported by BestSlope when a sampling time is duplicated. The fitted points were identified by looking the lambda z limits back up with which(x == LAMZLL):which(x == LAMZUL); a duplicated time makes which return two positions, a:b then silently used only the first and emitted “numerical expression has 2 elements: only the first used”, and the reported points named the wrong samples and were one too many. As with the remapping fix above, the consequence was that feeding UsedPoints back in as UsePoints did not reproduce the original fit. The index range the fit actually spanned is now carried out of the search directly, so length(UsedPoints) always equals LAMZNPT. The same time lookup was used to seed the interactive DetSlope from sNCA, where a duplicated time made it stop with “the condition has length > 1”.
BestSlope no longer stops with “missing value where TRUE/FALSE needed” when two candidate windows tie. A zero at the start of a window is dropped by log, so that window fits exactly the same points as the next one and the two rows share both R2ADJ and LAMZNPT; both were selected, the result became a matrix instead of a parameter vector, and the caller's test on LAMZNPT then failed. Tied rows are the same fit, so the first is taken. Reachable by calling BestSlope directly, since sNCA strips zeros before calling it.
tblNCA now stops when UsePoints is not a list, or is a list whose length differs from the number of NCAs. It previously discarded such a UsePoints without a word and silently fell back to automatic slope selection, reporting a different analysis than the one requested. Subsetting the concentration data without subsetting UsePoints to match is the easy way to land here.
Unit no longer stops with “missing values are not allowed in subscripted assignments of data frames” for a concentration unit it does not recognise, nor with “non-character argument” for NA. An unrecognised unit now warns and leaves the volume and clearance conversion factors NA.
Added regression tests ‘tests/Test-UsePoints.R’, ‘tests/Test-TLAG.R’, ‘tests/Test-BestSlope.R’ and ‘tests/Test-PQNCA.R’.
OQNCA gains three Tier A (independent, closed-form) operational test cases. The eight existing cases compare against WinNonlin 6.4 outputs on Theoph and Indometh, neither of which contains a trailing or an embedded BLQ sample and neither of which exercises UsePoints, so none of the four sNCA/Slope defects above was detectable: a build carrying all of them still reported QUALIFIED. The new cases run a synthetic single-subject fixture whose terminal phase is exactly mono-exponential, so lambda z, the half-life and Clast_pred are known in closed form and the AUCs reduce to a hand-summable trapezoid. The fixture carries a lag-phase zero, an embedded BLQ inside the lambda z window and trailing BLQ, and the three cases cover automatic slope selection, an explicit UsePoints fit, and a round trip that feeds the reported UsedPoints back in and requires every parameter to be unchanged. The reference table also includes Clast_pred, which no WinNonlin reference file carried, so CLSTP was previously dropped from the comparison by name mapping and never checked at all.
PQNCA no longer truncates profile identifiers in its report. The PROFILE column was a fixed 14 characters wide (12 in the expected-value table and the failed-check list) and the identifier was cut to fit, so a multi-column key rendered as “DA-4505/01-S” for every subject - identical text for profiles that are not the same, in a document whose purpose is to record which profile was checked. The column is now sized to the longest identifier present, and where even that will not fit on a line the row is split instead of cut. A single-column key is laid out exactly as before. Key values are also formatted to 7 significant digits when they are numeric, instead of the up-to-15 that as.character emits, which is what made the identifiers unmanageably long; matching still uses the exact value.
Fixed the expected-value comparison in PQNCA. A parameter that was NA on both sides - not estimable for that profile, and not expected to be - was counted as a difference, because the comparator computed a relative difference and then required it to be non-NA. Supplying expected therefore produced “expected-values DIFFER” and an overall NOT QUALIFIED for a correct analysis whenever any profile lacked a terminal phase, which is routine in real data. The reproducibility check in the same function already treated NA/NA as equal, so the two comparators inside one report disagreed with each other. Both NA now counts as agreement; one side NA and the other a number is still a difference.
The PQNCA report now states what its reproducibility check does and does not establish. Re-running the analysis on the same data shows only that the analysis is deterministic; a deterministic error reproduces exactly, so the check cannot detect a wrong answer, and the report no longer leaves that to be inferred.
OQNCA test cases may now supply an inline data frame instead of naming a datasets object, and may set roundTrip=TRUE to re-run the analysis with the UsedPoints the first run reported.
Single-point robustness: AUC and LogAUC no longer error on a length-1 input (they return 0), so sNCA handles a subject with a single measurable (non-zero) concentration instead of stopping with "subscript out of bounds".
sNCA no longer invokes the interactive DetSlope when there is only one non-zero point (a terminal slope cannot be fit from a single point).
IQNCA added: a self-contained Installation Qualification (IQ) report in pdf documenting whether NonCompart is correctly installed, intact, loadable, and operational (environment, version, dependency satisfaction, MD5 file integrity, namespace/exports, a functional NCA check against an external reference, an overall QUALIFIED/NOT QUALIFIED verdict, a sessionInfo appendix, and a per-file md5 checksum appendix).
OQNCA added: a self-contained Operational Qualification (OQ) report in pdf. It runs eight WinNonlin-referenced NCA scenarios (shipped in ‘inst/OQ’) through tblNCA on the user's machine and lists every computed value next to its reference value, with the absolute and relative difference and a pass flag, and an overall verdict.
writeMD5NCA added: writes the standard R ‘MD5’ integrity manifest into an installed package directory (using tools::md5sum) so that the IQNCA file-integrity check reports PASS for local installs. CRAN installs already include this manifest.
PQNCA added: a Performance Qualification (PQ) report generator. It runs the analysis the user intends on the user's own data and checks reproducibility, per-profile scientific plausibility, and (optionally) agreement with the user's expected values, with an input-data md5 fingerprint and a signed record.
addSigFieldNCA added (and a sigField argument to IQNCA/OQNCA/PQNCA): insert Adobe Acrobat Reader signature fields into the report PDF (pure base-R PDF incremental update, no external tools) so it can be signed with one click in the free Acrobat Reader, instead of printing and scanning.
signPDFNCA and verifyPDFNCA added: digitally sign a report PDF (a detached SHA-256 signature written to ‘<pdf>.sig’, using the openssl package) and verify it, as a scriptable alternative.
The IQ and OQ reports use 1 inch margins on every side, select Letter paper in a United States locale and A4 elsewhere, and place the signature/approval page first.
sNCA and tblNCA support predetermined indices of points (UsePoints) to calculate terminal slope.
tblNCA supports vector input for dur argument.
Fixed a bug in Slope where sequential is.finite filtering could cause misaligned x and y vectors.
Fixed typo 'umul/mL' to 'umol/mL' in concentration unit normalization (Unit, UnitUrine).
Replaced unsafe eval(parse(text=...)) with direct logical subsetting in tblNCA and tblAUC.
Extracted duplicated slope-finding logic in BestSlope into helper function findBestSlope.
Normalized adm parameter once at the top of sNCA instead of calling toupper(trimws()) repeatedly.
Extracted shared unit conversion helpers (normalizeConcUnit, convertVolUnit) in Unit.R.
Reduced redundant toupper(trimws(down)) calls in AUC and IntAUC.
Minor updates.
SS option for steady-state added in sNCA and tblNCA
tblAUC, gAUC, gInterpol functions are added for general purpose AUC such as AUC for pharmacodynamic(PD) data.
Rare cases raising NaN in BestSlope are handled.
DetSlope no longer opens a new device when closed.
Data type error with tibble data is fixed.
Bug when a slope is determined by manual selection is fixed.
excludeDelta option added to tblNCA, sNCA, and BestSlope functions.
UT function removed
returnNA option in sNCA function is removed.
When it is impossible to determine slope, it skips.
tblNCA supports iAUC argument.
Some sentences are revised.
Nonnumeric Subject ID is supported.
tblNCA is rewritten.
Issue on reverse dependence on ncar is solved.
Validation document is added.
DetSlope now accepts default slope from BestSlope.
Errata in manual corrected.
DetSlope function is added to determine slope manually.
NonCompart is more tolerable to the input error.
sNCA can accept key of multiple columns instead of single column colSubj.
NonCompart can handle the case of no or one positive y value.
NonCompart A bug in C0 calcuation of IV bolus case was fixed.
NonCompart Only essential functions for calculation were remained.