Skip to contents

Introduction

This describes the structure of patient records compatible with posologyr.

Structure

Data for input into posologyr is the same type of data input for rxode2. As stated in the rxode2 documentation (rxode2 datasets), it is also similar to data for NONMEM.

The patient dataset is a table of sequential event records, in which each line is an event. A description of the different event types is available in the rxode2 documentation (rxode2 Event Types).

Below is a minimal working example:

data.frame(ID=1,
           TIME=c(0.0,3),
           DV=c(NA,60.0),
           AMT=c(1000,0),
           EVID=c(101,0))
#>   ID TIME DV  AMT EVID
#> 1  1    0 NA 1000  101
#> 2  1    3 60    0    0

Required fields and data

TIME
Dosing times, and sampling times of therapeutic drug monitoring (TDM). The units depend on the specification of the population pharmacokinetics (ppk) model.
AMT
Amount of drug administered. The units depend on the specification of the ppk model.
EVID
Event type. Must be 0 for all observations (concentrations from TDM).
DV
For concentrations. Must be NA when EVID is not 0.
Covariates
Every covariate defined in the prior posologyr model. The column names must match the covariate vector from the ppk model.
OCC
Occasions. Required for models with inter-occasion variability.
DVID
Observation type. Required for models with multiple endpoints.
CMT
Name (or number) of the compartment where the dose is administered, see vignette("route_of_administration").

Common use cases

A priori dose adjustment

Before dosing: the simplest patient record is a single line dataframe, with individual patient covariates, and all other columns (TIME, DV, AMT, EVID) set to zero.

data.frame(ID=1,
           TIME=0,
           DV=0,
           AMT=0,
           EVID=0,
           COVAR1=c("X"),
           COVAR2=c("Y"))
#>   ID TIME DV AMT EVID COVAR1 COVAR2
#> 1  1    0  0   0    0      X      Y

Oral administration or IV bolus

EVID = 1 for an instantaneous administration in the first compartment defined in the ppk model: either the central compartment for an IV bolus, or a depot compartment for an oral administration.

data.frame(ID=1,
           TIME=c(0.0,3),
           DV=c(NA,60.0),
           AMT=c(1000,0),
           EVID=c(1,0),
           COVAR1=c("X"),
           COVAR2=c("Y"))
#>   ID TIME DV  AMT EVID COVAR1 COVAR2
#> 1  1    0 NA 1000    1      X      Y
#> 2  1    3 60    0    0      X      Y

Intermittent infusion

EVID = 1 for a bolus infusion, administered in the first compartment defined in the ppk model.

DUR defines its duration.

AMT is the amount administered over the duration DUR.

data.frame(ID=1,
           TIME=c(0.0,1.0,14.0),
           DV=c(NA,25.0,5.5),
           AMT=c(1000,0,0),
           DUR=c(0.5,NA,NA),
           EVID=c(1,0,0),
           COVAR1=c("X"),
           COVAR2=c("Y"))
#>   ID TIME   DV  AMT DUR EVID COVAR1 COVAR2
#> 1  1    0   NA 1000 0.5    1      X      Y
#> 2  1    1 25.0    0  NA    0      X      Y
#> 3  1   14  5.5    0  NA    0      X      Y

Inter-occasion variability

For a given occasion, the value of OCC must be repeated for each row. OCC must be specified for all the rows in the table.

data.frame(ID=1,
           TIME=c(0.0,1.0,14.0,24.0,25.0,36.0),
           DV=c(NA,25.0,5.5,NA,30.0,6.0),
           AMT=c(1000,0,0,1000,0,0),
           DUR=c(0.5,NA,NA,0.5,NA,NA),
           EVID=c(1,0,0,1,0,0),
           OCC=c(1,1,1,2,2,2),
           COVAR1=c("X"),
           COVAR2=c("Y"))
#>   ID TIME   DV  AMT DUR EVID OCC COVAR1 COVAR2
#> 1  1    0   NA 1000 0.5    1   1      X      Y
#> 2  1    1 25.0    0  NA    0   1      X      Y
#> 3  1   14  5.5    0  NA    0   1      X      Y
#> 4  1   24   NA 1000 0.5    1   2      X      Y
#> 5  1   25 30.0    0  NA    0   2      X      Y
#> 6  1   36  6.0    0  NA    0   2      X      Y

Multiple endpoints

DVID is used to specify the type of each observation. The values of DVID in the dataset must match the names of the residual error models, see vignette("multiple_endpoints").

data.frame(ID=1,
           TIME=c(0.0,1.0,14.0,24.0,25.0,36.0),
           DV=c(NA,20.0,80,35.5,60.0,40.0),
           AMT=c(1000,0,0,0,0,0),
           EVID=c(1,0,0,0,0,0),
           DVID=c("parent","parent","metabolite","parent","metabolite","metabolite"),
           COVAR1=c("X"),
           COVAR2=c("Y"))
#>   ID TIME   DV  AMT EVID       DVID COVAR1 COVAR2
#> 1  1    0   NA 1000    1     parent      X      Y
#> 2  1    1 20.0    0    0     parent      X      Y
#> 3  1   14 80.0    0    0 metabolite      X      Y
#> 4  1   24 35.5    0    0     parent      X      Y
#> 5  1   25 60.0    0    0 metabolite      X      Y
#> 6  1   36 40.0    0    0 metabolite      X      Y