Model syntax
model-syntax.Rmd
As shown in the various examples, models are generated using
new_stan_model()
. The main requirement is that the ODE
model dAdt
is defined.
The variable names in the table below are reserved, i.e. they cannot be used in the ODE model code, since PKPDposterior adds these to each model so that it is possible to perform structured analyses.
The following variables are recognized, with their approximate equivalent in NONMEM, if available.
Variable name | Meaning | NONMEM equivalent |
---|---|---|
dv |
Vector of observed values |
DV column in input |
ipred |
Vector of predicted values for all event times |
IPRED column in output |
ipred_obs |
Vector of predicted values for observation records only |
IPRED column in output for records where
EVID==0
|
ipred_ruv |
Vector of predicted values for observation records only, with residual variability simulated |
Y in model file, DV in output table |
n_t |
Number of event records | Number of rows in input dataset |
n_cmt |
Number of compartments | |
n_obs |
Number of observations | Number of rows in input dataset with EVID==0
|
i_obs |
Index of observation records within all event records | |
theta |
Vector of model parameters |
$THETA (although not same data format) |
ode |
Function for the ODE system | $ODE |
A |
Vector of amounts in compartments |
A in model file |
dAdt |
Vector of gradients for ODE system |
DADT in model file |
prior_<parameter> |
Samples of prior parameter distribution |
For models with more than one observation type, such as PK-PD models,
or a parent-metabolite model, the variables related to observations
(i.e. the variables listed in the first 8 rows) are appended with a tag
for the respective observation type, e.g. dv_pk
and
dv_pd
, or dv_parent
and dv_metab
,
etc. See the neutropenia model for an example.
If you want to leverage functionality within PKPDposterior, but you
cannot (or prefer not to) use new_stan_model()
to create
the model, you should use the above variable names as well, so that
output can be parsed appropriately by PKPDposterior functions.