blk.addl: Count Additional Doses at a Fixed Interval

View source: R/PCSmisc.R

blk.addlR Documentation

Count Additional Doses at a Fixed Interval

Description

These are special functions to help reduce multiple dose records at a fixed interval to single dose records with an ADDL column for the number of additional doses and an II column for the interdose interval in the style of NONMEM.

Usage

blk.ii(time, id, dose.ind, diff.op=difftime.default)
blk.addl(ii, id, dose.ind, dose, tol.ii=1e-5, tol.dose=1e-5, min.consec=2, include.last=FALSE, diff.op=difftime.default)

Arguments

time

A vector of event times in block-format with respect to id.

ii

A vector of interdose intervals in block-format with respect to id, as returned by blk.addl.

id

A valid block-format ID.

dose.ind

A logical vector in block-format with respect to id. Indicates rows corresponding to dose events.

dose

Vector of dose amounts in block-format with respect to id.

tol.ii

A numeric tolerance for comparing the interdose intervals. See details.

tol.dose

A numeric tolerance for comparing dose amounts. See details.

min.consec

An integer specifying the minumum number of dose records to be considered for ADDL grouping.

include.last

A logical. Should the last dose before a non-dosing event be considered for merging?

diff.op

A function that subtracts one time from another.

Details

These functions operates on a PK data set in block-format. Event times are specified by time and rows that corresponding to dose events are indicated by dose.ind.

In NONMEM (many other software packages used in pharmcometrics have adopted the same convention), multiple dose events with the same dose amount given at a fixed time interval can be specified on a single dose record by specifying two variables: ADDL for the number of additional doses (i.e., not counting the current dose record, making the total number of dose events equal to ADDL + 1), and II for the interdose interval (the fixed time interval between consecutive dose events). These functions will help to derive these variable from a data set in which each dose event is its own records, leading to a more compact dataset (in some cases, much more compact if many dose records can be eliminated).

When determining if multiple dose records can safely be combined, successive dose amounts and iterdose time intervals need to be compared to make sure they are the same. Those numeric comparisons can be made to have a certain tolerance, specified by the tol.dose and tol.ii respectively. If two successive values are within the tolerance of each other in absolute value, they will be considered the same.

Value

For blk.ii, a numeric vector in block-format with respect to id containing the interdose intervals.

For blk.addl, a numeric vector in block-format with respect to id containing the ADDL count for dose events that could represent multiple doses, the value -1 for dose events that should be removed if ADDL dosing records are used, and 0 for all other events.

Author(s)

Benjamin Rich <mail@benjaminrich.net>

See Also

  • block-format

  • blk.intereventTime

  • blk.isSteadyState

  • blk.findConsecutive

  • difftime.default

Examples

require(nlme)
data(Phenobarb)
dat <- Phenobarb[1:56,]  # First 4 subjects
attach(dat)

cbind(dat, II=blk.ii(time, asID(Subject), !is.na(dose)),
           ADDL1=blk.addl(blk.ii(time, asID(Subject), !is.na(dose)), asID(Subject), !is.na(dose), dose),
           ADDL2=blk.addl(blk.ii(time, asID(Subject), !is.na(dose)), asID(Subject), !is.na(dose), dose, min.consec=5),
           ADDL3=blk.addl(blk.ii(time, asID(Subject), !is.na(dose)), asID(Subject), !is.na(dose), dose, include.last=TRUE))

detach(dat)


benjaminrich/PCSmisc documentation built on Feb. 11, 2024, 9:25 p.m.