$RCOV, $RCOVI

Inputting Variance-Covariance information from another problem.

1
2
3
4
5
6
7
 $RCOV
        FILE=filename [FORMAT|DELIM=s1]  [TBLN=n]
 $RCOVI
        FILE=filename [FORMAT|DELIM=s1]  [TBLN=n]

;# EXAMPLE
$RCOV FILE=sirsample.cov TBLN=1 DELIM=,

The $RCOV record can be used to load the variance-covariance matrix of estimates results from a previous problem, and use it for subsequent use in assessing total standard errors of table items without having to re-calculate the variance with a $COV step. Consider the control stream snippet below that brings in the covariance-variance of estimates from a previous control stream, located in rcov.cov, to be used in

1
2
3
  $EST METHOD=1 FNLETA=2 FORMAT=,1PE23.15
  $RCOV FILE=rcov.cov TBLN=1 DELIM=,
  $TABLE ID TIME IPRED CL V1 Q V2 LTVCL VARCALC=3 FILE=rcov3.tab NOPRINT NOAPPEND

Alternatively the record $RCOVI may be used to load the the variance-covariance information from the inverse-covariance file:

1
  $RCOVI FILE=sirsample.coi TBLN=1 DELIM=,

So $RCOV reading in variance-covariance from rcov.cov of a previous run can be used in place of executing the $COV step, and then used in evaluating the total standard error for table items (VARCALC=3). Thus, you may bring in a variance-covariance evaluated by any possible method (IMP, SAEM, BAYES, SIR) from the previous run, and use it for evaluating total standard errors of table items.

The FILE=filename option is required.

If FORMAT or DELIM is used, it should be the same as was specified on the $ESTIMATION record that created the file to be used. The default is s1PE12.5.

TBLN is the table number in the file. If TBLN is not specified, it defaults to 1.

NONMEM describes the use of these records with a message in the report file and to the terminal such as the following:

LOADED VARIANCE/COVARIANCE DATA FROM FILE c5.cov If NONMEM is unable to read the file, the message is COULD NOT FIND APPROPRIATE VARIANCE/COVARIANCE DATA IN FILE c5.cov

$RCOV and $RCOVI can be used with the $CHAIN record. For examples, final parameter results using the $CHAIN record, and final empirical Bayes estimates of ETAs (and their covariances) using the $ETAS record, may also be read in from the previous run:

1
2
3
$CHAIN FILE=rcov.ext NSAMPLE=0 ISAMPLE=-1000000000 FORMAT=,1PE23.15
$ETAS FILE=rcov.phi TBLN=1 DELIM=,
$RCOV FILE=rcov.cov TBLN=1 DELIM=,

The final THETAs, SIGMAs, OMEGAs, ETAs, covariances of ETAs, and covariances of THETAs, OMEGAs and SIGMAs from the previous run can then be used without any re-estimation by setting FNLETA=2, and without any re-evaluation of the $COV step:

1
2
3
$EST METHOD=1 FNLETA=2 FORMAT=,1PE23.15
$TABLE ID TIME IPRED CL V1 Q V2 LTVCL VARCALC=3 FILE=rcov3.tab NOPRINT
       NOAPPEND

$RCOV can also be used to import a prior in a $PRIOR TNPRI problem, replacing the variance-covariance that was last written to an MSF file with alternative values. This may have value if you wish to use variance-covariance estimated by an alternative method in a previous run, (IMP, SAEM, BAYES, SIR), and use it as the prior in a TNPRI problem. A proper MSFI file was generated from a previous run (call it pre_tnpri), and it is desired to input variance-covariance from another source, perhaps yet another previous run (call it sirsampling, because the SIR assessed covariance will be used), so that the contents of the MSFI file, along with the $RCOV record, are read in on the first problem:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  $PROB Read in MSFI file.
  $INPUT C SET ID JID TIME  DV=CONC AMT=DOSE RATE EVID MDV CMT
  $DATA example1b.csv IGNORE=C
  ;# Comment out ONLYREAD in next line if msf file does not contain covariance
  ;# step. If covariance step failed, it should still be okay to use ONLYREAD
  $MSFI pre_tnpri.msf ONLYREAD
  $SUBROUTINES ADVAN=3 TRANS4
  $PK
  MU_1=THETA(1)
  MU_2=THETA(2)
  MU_3=THETA(3)
  MU_4=THETA(4)
  CL=DEXP(MU_1+ETA(1))
  V1=DEXP(MU_2+ETA(2))
  Q=DEXP(MU_3+ETA(3))
  V2=DEXP(MU_4+ETA(4))
  S1=V1
  $ERROR
  Y = F + F*EPS(1)

  ;# Bring in prior means
  $CHAIN FILE=sirsampling.ext ISAMPLE=-1000000000 NSAMPLE=0
  ; Bring in prior variance
  $RCOV FILE=sirsampling.cov TBLN=3 DELIM=S
  $PRIOR TNPRI (PROBLEM 2) IFND=0 MODE=0 PLEV=0 IVAR=0
  $EST OMIT

Then, the information is used in the next $PROB (same control stream) to be used as prior information:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
$PROB Evaluation
$INPUT C SET ID JID TIME  DV=CONC AMT=DOSE RATE EVID MDV CMT
$DATA example1b.csv IGNORE=C REWIND
$THETA (0.001, 2.0)x4
$OMEGA BLOCK(4) VALUES(0.15,0.01)
$SIGMA
(0.6 )   ;[P]

; Optionally retrieve initial THETAs, OMEGAs, SIGMAs from a $CHAIN record
$CHAIN FILE=sirsampling.ext ISAMPLE=37 NSAMPLE=0
$EST METHOD=1 INTERACTION NSIG=3 PRINT=10 NOABORT MAXEVAL=9999
     FORMAT=S1PE23.15
$COV MATRIX=R PRINT=E UNCONDITIONAL

Final parameter estimates from a previous run may also be entered in using the $CHAIN record, as shown above, to serve as the centrality parameters of the prior.

The lower and upper bound settings in the $THETA record on the second problem normally must match those of the problem that generated the prior. To get around this, you can set the NOMSFTEST option on the $MSFI record in the first problem. You will still get warnings if the bounds do not match.

Alternatively, you can omit an MSFI input altogether as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  $PROB Read in MSFI file.
  $INPUT C SET ID JID TIME  DV=CONC AMT=DOSE RATE EVID MDV CMT
  $DATA example1b.csv IGNORE=C
  ;# $MSFI pre_tnpri.msf ONLYREAD
  $SUBROUTINES ADVAN=3 TRANS4
  $PK
  MU_1=THETA(1)
  MU_2=THETA(2)
  MU_3=THETA(3)
  MU_4=THETA(4)
  CL=DEXP(MU_1+ETA(1))
  V1=DEXP(MU_2+ETA(2))
  Q=DEXP(MU_3+ETA(3))
  V2=DEXP(MU_4+ETA(4))
  S1=V1
  $ERROR
  Y = F + F*EPS(1)

  ;# If no MSFI file, then enter $THETA, $OMEGA, $SIGMA records with some
  ;# type of reasonable starting values. Only boundary values will be used,
  ;# however, for internal parameterization.
  $THETA (0.001, 2.0)x4
  $OMEGA BLOCK(4) VALUES(0.15,0.01)
  $SIGMA
  (0.6 )   ;[P]

  ;# Bring in prior means
  $CHAIN FILE=sirsampling.ext ISAMPLE=-1000000000 NSAMPLE=0
  ;# Bring in prior variance
  $RCOV FILE=sirsampling.cov TBLN=3 DELIM=S
  $PRIOR TNPRI (PROBLEM 2) IFND=0 MODE=0 PLEV=0 IVAR=0
  $EST OMIT

Then, the information is used in the next $PROB (same control stream) to be used as prior information:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
$PROB Evaluation
$INPUT C SET ID JID TIME  DV=CONC AMT=DOSE RATE EVID MDV CMT
$DATA example1b.csv IGNORE=C REWIND
$THETA (0.001, 2.0)x4
$OMEGA BLOCK(4) VALUES(0.15,0.01)
$SIGMA
(0.6 )   ;[P]

; Optionally retrieve initial THETAs, OMEGAs, SIGMAs from a $CHAIN record
$CHAIN FILE=sirsampling.ext ISAMPLE=37 NSAMPLE=0
$EST METHOD=1 INTERACTION NSIG=3 PRINT=10 NOABORT MAXEVAL=9999
     FORMAT=S1PE23.15
$COV MATRIX=R PRINT=E UNCONDITIONAL

Final parameter estimates from a previous run may also be entered in using the $CHAIN record, as shown above, to serve as the centrality parameters of the prior.