$ABBREVIATED
|
|
Discussion
Optional. May be used
when $PK, $ERROR, or $PRED abbreviated code is present. Must precede
all blocks of abbreviated code. With NONMEM 7.4, may also be used
when there is no abbreviated code. For example, $ABBR REPLACE may be
used for label substitution in NONMEM report files.
Options
COMRES=n1
Stands for "common reserve". Variables defined in abbreviated codes
are stored in MODULE NMPRD4. User-supplied
Fortran routines may also store variables in NMPRD4. To differentiate
these two sets of variables, the first n1 positions in NMPRD4 are
reserved for the use of user-supplied routines. In other words, when both abbreviated code and
user-supplied subroutines (or verbatim code) are used in a control
stream, the user-supplied subroutine has the first n1 positions in
NMPRD4 reserved for its use. The first position used by NM-TRAN for
variables defined in abbreviated code is n1+1. Default n1=0 (no
reserved storage).
- A special case
n1=-1requests no variables defined in abbreviated codes are stored in NMPRD4. This is used when one would like to avoid the default global scope of variables defined in abbreviated code. WithCOMRES=-1the variables in the current abbreviated code block, e.g.$PK, is no longer accessible in other code blocks, e.g.$ERROR. - Do not use this option when there are no abbreviated codes.
-
Abbreviated code, verbatim code,
$TABLE, and$SCATTERmay explicitly reference variables in reserved positions usingCOM(I),Ibetween 1 andn1. For example, in addition to output variables defined in abbreviated code by name, one can do1$TABLE COM(1) COM(2)
COMSAV=n2
When tables and scatterplots output certain variables, the values are
copied from NMPRD4 in a copying pass. Normally with a given data
record, values in NMPRD4 are computed with the previous data record.
In order to access the values from the previous copying pass, one can
use COMSAV=n2 to designate a SAVE array in NMPRD4 with initial size
n2. A variable stored in the SAVE region has a persistent value from
one copying pass to the next. Default n2=0. n2 may not exceed
n1.
- The SAVE region has size
n2initially, but NM-TRAN may extend it if SAVE variables are used. n2=-1requests no SAVE region used.- See copying block and
COMACTvariable.
DERIV1=NO (NM74)
The option prevents the computation of first derivatives (setting the global variable
NOFIRSTDERCODE to 1). For example, one may
use the option when only SAEM or BAYES is performed, or IMPMAP/ITS/FOCE are
performed using OPTMAP>0 and ETADER>0.
DERIV2=NO | NOCOMMON
DERIV2=NO prevents the computation of second-order derivatives (needed only for the Laplacian method).
- When PREDPP is not used.
DERIV2=NOmakes the Laplacian estimation method requested in a subsequent run effectively a FOCE run. This is less efficient than a normal FOCE run and should be avoided. - When PREDPP is used with
DERIV2=NO, one cannot request the Laplacian estimation method in a subsequent run.
DERIV2=NOCOMMON permits the computation of these derivatives, but
prevents them from being stored in the global variable NMPRD4.
$ESTIMATION METHOD=COND LAPLACIAN may be specified, but variables
representing second derivatives are not stored in NMPRD4. Therefore,
they cannot be output in tables and scatterplots. In addition,
no variables computed in the $PK block may be referenced in the
$ERROR block. This is true whether or not these variables happen to
have second derivatives, and whether or not the Laplacian method is
used.
FASTDER | NOFASTDER (NM72)
Code to compute first-partial derivatives with respect to ETA
variables is always generated from abbreviated codes. These
derivatives are almost always needed by classical NONMEM methods with
population data. However, these derivatives are not necessary
for the newer Bayesian methods. By default (FASTDER) NONMEM v7.2+
collects (re-arranges) all code for first derivative computation and use them
only when needed (when IFIRSTEM=1, see partial derivative indicators). The collection (re-arrangement) of
first derivative code can be prevented with option NOFASTDER.
CHECKMU | NOCHECKMU
By default (CHECKMU) NONMEM v7.2+ checks the MU model statements in
abbreviated code for potential errors. This check can be either time
consuming for large control streams or too difficult/error-prone to
perform (see examples/tdist6_sim and examples/tdist7). In such cases
NOCHECKMU can be used to disable the check.
DES=FULL | COMPACT
- DES=FULL: Arrays of the DES routine are stored in non-compact form.
With
$ESTIMATION METHOD=COND LAPLACIAN, the option NUMERICAL is also required. DES=FULL is the default with ADVAN9 and ADVAN15 and ADVAN17. (Prior to NONMEM 7.4, FULL was required with ADVAN13.) - DES=COMPACT: Arrays of the DES routine are stored in compact form. Required with Laplacian method; optional otherwise. This is the default, except with ADVAN9 and ADVAN15 and ADVAN17.
REPLACE
|
|
There are several different forms of the REPLACE option. They do not affect verbatim code.
When $ABBR REPLACE is coded, NM-TRAN produces two files: FORIG
contains the original (pre-replacement) abbreviated code, and task
specification records $TABLE and $SCATTER. FREPL contains the new
(post-replacement) abbreviated code and task specification records.
Simple replacement
May be used in all blocks of abbreviated code and $TABLE and
$SCATTER records, to replace left_string with right_string.
Single or double quotes around a string are optional unless
the string contains punctuations such as comma. For example,
|
|
becomes
|
|
In NONMEM v7.4+, the replacement also results in label substitution in report files and table files. For example,
the above replacement
results in ETA(CL) replaced by ETA(5) in the generated subroutine,
and ETA(5) replaced by ETA(CL) in the report and table files.
For another example, one can use compartment names instead of numbering:
|
|
This "explicit" compartment name substitution is similar to the "implicit" compartment name substitution feature of the $MODEL record (NM75).
Label substitution can be turned off for an entire problem with the
$DEFAULT NOSUB=1 option. Label substitution can be turned off for
a specific NONMEM task (and all subsequent tasks) with the NOSUB=1
option of $TABLE, $SCAT, and $ESTIMATION. Substitutions will
never be made in the additional output files such as .ext, ,phi,
etc., for the reason of third party software compatibility.
By data item
|
|
May be used in $PK, $ERROR, $PRED blocks only. VAR can be
ETA, EPS, or THETA. (ERR is not permitted.) The replacement uses the
integer value of data item d, i.e. INT(d), as mask to select among
n1, n2, …, nk:
|
|
The actual generated code uses indicator variables, so that
variables such as THETA_d_ is used in place of THETA(d).
For example, suppose OCC is a data item that takes values 1 and 2.
|
|
results in
|
|
During the replacement if ni=0 the position i is skipped. One use
of this is to specify a default value. For example, assume there are
3 doses per subject (DOSN=1,2,3) and the model is:
|
|
It can be implemented as
|
|
By data item and parameter
|
|
p is a user-defined variable in the abbreviated code. The notation
can be either p_d or d_p. This allows a given data item d to be
used as a selection variable for more than one parameter, with a
different choice of elements of VAR.
Example 1:
|
|
is equivalent to
|
|
Example 2:
|
|
is equivalent to
|
|
The number of values specified for the selection data item must be consistent for all parameters in which it is used.
Replacement for multiple variables
|
|
In NONMEM v7.4+, one may replace numbering n1, n2, …, nk with
strings (may not contain space) p1, p2, …, pk, respectively.
For example,
|
|
is equivalent to
|
|
Label substition occurs with this form, the same as with the Simple replacement.
Additionally one can use short-hand notation to describe a series of
values of n: an ascending sequence of n's can be described as
|
|
BY is optional (default is 1). TO (or
equivalently :) is required.
At least one comma must appear, so NMTRAN knows it is a number list, not a variable name.
Examples:
|
|
with
|
|
is identical to
|
|
DECLARE
|
|
One or more variable names may be declared using the $ABBR DECLARE
statement.
- Variable types.
DECLARE ... INTEGERandDECLARE ... DOWHILE(for DOWHILE loop indices only) declare integers that can serve as indices of arrays. Otherwise declared variables are double precision reals, and they become random variables if assigned from an expression involving ETA or EPS. -
Arrays. One and two dimensional array can be declared using parentheses. The dimension can be a constant, variable, or expression (including
SIZESconstants likeNOorLVR). For example1$ABBR DECLARE A,B(10),C(1,NO-1),INTEGER I J ;# only I is INTEGER. - Initialization. All declared variables are initalized (or filled) with 0.
- Multiple
$ABBR DECLAREare allowed. After the first theDECLAREkeyword is optional and declarations are comma- or space-separated. No other$ABBRoptions may followDECLAREoption(s). - Declared variables have global scope, thus they are available in abbreviated code blocks.
-
Output. Elements of a declared array may be displayed in WRITE/PRINT statement using indices.
1 2PRINT *,B(1),B(2) ;! allowed PRINT *,B ;! not allowedThey cannot be output by
$TABLE. The workaround is to code, e.g.,1 2 3;#... code assigning values to B(1) etc. ... B1=B(1) $TABLE B1
PROTECT
In NONMEM v7.4+, a series of routines are available that protect
against domain violations, divide by zero, and floating point
overflows. Each of these routines start with the letter P,
followed by the name of the mathematical operation they are to
perform. For example, PLOG is the protective code routine that
performs the LOG operation. In addition, there are first derivative
(such as PLOGD1), and second derivative (such as PLOGD2) companion
routines available which NMTRAN uses for computing analytical
derivatives. The source code of these routines are available in
source/PROTECT.f90. If you wish to modify their behavior, then
copy PROTECT.f90 to your run directory as (say) myprotect.f90,
modify it, then refer to this modified code with
|
|
The OTHER option is not needed if the P
functions are coded explicitly or implicitly via $ABBR PROTECT.
The following protective code routines are available. For all
routines, if x=NAN, x is converted to machine precision
value first.
If x>INFNTY (Double pecision INFNTY is approximately 1.0E+154), then x is
converted to INFNTY first. SMALLZ
denotes the small positive floating point number limit (approximately
2.8E-103).
| Routine | Function | Protection |
|---|---|---|
| PLOG(x) | LOG(x) | PLOG(x)=LOG(SMALLZ) if x<SMALLZ |
| PLOG10(x) | LOG10(x) | PLOG10(x)=LOG10(SMALLZ) if x<SMALLZ |
| PSQRT(x) | SQRT(x) | PSQRT(0.0d0)=0.0 |
| PEXP(x) | EXP(x) | PEXP(x)=EXP(300.0) if x>300.0 |
| PDZ(x) | 1/x | PDZ(x)=1/SMALLZ if abs(x)<SMALLZ |
| PZR(x) | x | PZR(x)=SMALLZ if abs(x)<SMALLZ |
| PNP(x) | x | PNP(x)=x if x<SMALLZ |
| PHE(x) | x | PHE(x)=100 if x>100.0 |
| PNG(x) | x | PNG(x)=0.0 if x<0.0 |
| PTAN(x) | TAN(x) | Protects against infinity near Pi/2 |
| PATAN(x) | ATAN(x) | Protects against large input |
| PACOS(x) | ACOS(x) | treat x with abs(x) in [1, 1E-8] as 1 or -1 |
| PASIN(x) | ASIN(x) | treat x with abs(x) in [1, 1E-8] as 1 or -1 |
The option
|
|
requests automatical replacement of functions with the protect counterparts.
Note that the any P function name that is used explicitly or
implicitly via $ABBR PROTECT may not be used for a user-defined
variable name.
FUNCTION
|
|
User-supplied functions are permitted in abbreviated code with
reserved names such as FUNCA, FUNCB, etc., and argument vectors
with reserved names VECTRA, VECTRB, etc. NONMEM v7.4+ supports
extended reserved names FUNCxy and FUNCxyz, with each of x,
y, z as an alphabetic character A-Z, so that FUNCAB or
FUNCABC are supported. Similarly for vector names VECTRAB,
VECTRABC, etc. are supported. Reserved argument vectors and arrays
have dimension 9 and each reserved function may appear in abbreviated
code at most 9 times. (See abbreviated functions).
NONMEM v7.4+ supports $ABBR FUNCTION for user-defined function and argument vector declaration:
|
|
function_name: the name of the function.input_vector_name: the name of an input vector that may be used to pass arguments to the function.dimension: the length ofinput_vector_name. It is a property of both the function and of the input vector.usage: the maximum number of times the function may appear in the abbreviated code, that is, the maximum number of occurances of function_name. It is not an error if there are fewer occurances. If usage is omitted, NMTRAN will supply the exact number. If usage is coded, NMTRAN will generate an error message if function_name appears in abbreviated code more than "usage" number of times.
In addition a vector and its length may be declared separately:
|
|
For example,
|
|
defines VBI as a vector of length 5, to be used as the argument of
function BIVARIATE. When BIVARIATE is defined, the value 5 is
passed to its argument NDIM. Function BIVARIATE may appear in
abbreviated code at most 3 times. BIVARIATE should be specified in a
source code file listed in the $SUBROUTINES record:
|
|
so that one can use it in abbreviated code:
|
|
See examples/bivariate for the full example.
By default, there may be up to 100 different user-defined functions, which includes functions with reserved names and userdefined names. There may also be up to 100 different vectors of input arguments, which includes vectors with reserved names and user-defined names. Constants NFUNCX and NVECX in SIZES may be used to change these numbers.
It is preferable that a unique vector should be associated each function to assure that each vector-function pair are set up with comparable dimensions. This is not necessary. Any user-defined vector or function may be used with any reserved vector or reserved function, subject to the same restriction. For example:
|
|
In abbreviated code, any of the following are permitted:
|
|
NM-TRAN would give a warning:
|
|
This is because vector VBI has dimension 5 and function BIVARIATEQ was declared with dimension 10.
A vector and its length may be declared independently of a function, and vice versa. The asterisk is used as a placeholder, e.g.,
|
|
The $ABBREV FUNCTION record may be used to override the default settings for any of the reserved function or vectors. For example,
|
|
VECTRA will be defined with length 25, not 9 as for a reserved function. The code for the function should have NDIM as an argument:
|
|
NDIM should be used instead of 9 for vector and array dimensions.