Dosage Regimens, Subjects, and Populations

Dosage Regimens, Subjects, and Populations

The data is passed to a Pumas model via the Population type. A Population is a collection of Subjects. In this section we will specify the methods used for defining Subjects and Populations. These types can either be defined programmatically using the Subject and Population constructors on Julia types or by using the Pumas NLME Data format (named PumasNDF).

Dosage Regimen Terminology

Both the DosageRegimen and the PumasNDF utilize the same terminology for describing a dose. The definition of the values are as follows:

The Subject Constructor

A Subject can be constructed using the following constructor:

Subject(;id = 1,
         obs = nothing,
         cvs = nothing,
         evs = Event[],
         time = obs isa AbstractDataFrame ? obs.time : nothing

The definitions of the arguments are as follows:


The DosageRegimen type is a specification of a regimen. Its constructor is:

              time = 0,
              cmt  = 1,
              evid = 1,
              ii   = zero.(time),
              addl = 0,
              rate = zero.(amt)./oneunit.(time),
              ss   = 0)

Each of the values can either be AbstractVectors or scalars. All vectors must be of the same length, and the elementwise combinations each define an event (with scalars being repeated).

Additionally, multiple DosageRegimens can be combined to form a DosageRegimen. For example, if we have:

dr1 = DosageRegimen(100, ii = 24, addl = 6)
dr2 = DosageRegimen(50,  ii = 12, addl = 13)
dr3 = DosageRegimen(200, ii = 24, addl = 2)

then the following is the DosageRegimen for the combination of all doses:

dr = DosageRegimen(e1, e2, e3)

The current DosageRegimen can be viewed in its tabular form using the DataFrame function: DataFrame(dr).

The Population Constructor

The Population constructor is simply Population(subjects), where subjects is a collection of Subjects.


The PumasNDF is a specification for building a Population from tabular data. Generally this tabular data is given by a database like a CSV. The CSV has columns described as follows:

If a column does not exists, its values are imputed to be the defaults. Special notes:

PumasNDF Parsing

read_pumas(data; cvs=Symbol[],dvs=Symbol[:dv],
                 id=:id, time=:time, evid=:evid, amt=:amt, addl=:addl,
                 ii=:ii, cmt=:cmt, rate=:rate, ss=:ss)

The arguments are as follows:

The other arguments are optional (keyword arguments) and allow changing the column names from their default.

NMTRAN Parsing

Additionally, there exist a parsing function process_nmtran for parsing general NONMEM files. This function is a work-in-progress.

                        id=:id, time=:time, evid=:evid, amt=:amt, addl=:addl,
                        ii=:ii, cmt=:cmt, rate=:rate, ss=:ss)