Skip to content

Add conc.include.end option to exclude interval end point#571

Open
Gero1999 wants to merge 4 commits into
humanpred:mainfrom
Gero1999:feat-ignore_end_point_interval
Open

Add conc.include.end option to exclude interval end point#571
Gero1999 wants to merge 4 commits into
humanpred:mainfrom
Gero1999:feat-ignore_end_point_interval

Conversation

@Gero1999

@Gero1999 Gero1999 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Adds a global conc.include.end option (default TRUE) controlling whether a concentration measured exactly at time == end is included in an interval's calculations. Set it to FALSE for half-open intervals [start, end).

Useful when a point at the interval boundary belongs to the next dose (e.g. an imputed C0) and wrongly inflates AUC/tmax for the current profile.

The internal filter_interval() already supported include_end (dose selection uses include_end = FALSE); this exposes it for concentrations via the options system.

  • R/PKNCA.options.R: register conc.include.end (logical, validated)
  • R/pk.calc.all.R: pass the option through at the concentration call site
  • Tests: boundary behavior, end-to-end AUC effect, default-unchanged regression, option validation

Default preserves existing behavior.

Gero1999 added 2 commits July 24, 2026 11:45
this prevents problems specially with multiple-dose bolus administrations, where the next profile's C0 point, if present, can affect the previous profile calculations. An example:

```r
my.conc <- PKNCAconc(d.conc, conc ~ time | subject)
my.dose <- PKNCAdose(d.dose, dose ~ time | subject, route = "intravascular")
my.data <- PKNCAdata(my.conc, my.dose,
                     intervals = data.frame(start = 0, end = 24, tmax = TRUE))

res <- as.data.frame(pk.nca(my.data))
res[res$PPTESTCD == "tmax", c("start", "end", "PPTESTCD", "PPORRES")]
#>   start end PPTESTCD PPORRES
#> 1     0  24     tmax    24.0   <- should be 0
```
@Gero1999 Gero1999 changed the title Feat ignore end point interval Add conc.include.end option to exclude interval end point Jul 24, 2026
@Gero1999
Gero1999 marked this pull request as ready for review July 24, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant