NONMEM Users Network Archive

Hosted by Cognigen

Re: [NMusers] How do I access the total number of subject?

From: Alison Boeckmann <alisonboeckmann_at_fastmail.fm>
Date: Mon, 17 Jun 2019 10:29:19 -0700

Dear Ryota,
The variable you need is NINDR, which is a reserved variable in abbreviated code.
You should look at NINDR and PRED in on-line help and Guide VIII.
The help item describes it as
"The number of individual records in the data set containing an observation record."
With typical NONMEM data sets, every individual record contains at least one observation record,
so NINDR describes how many individual records (subjects) there are in the data set.
(INDR1 is the first, INDR2 is the last.)

Here is a trivial example of how NINDR can be used in a PRED subroutine.
Control stream prednindr.ctl uses a data file THEO that is distributed
in the util directory of your NONMEM installation for use with CONTROL4.

Here is prednindr.ctl:

$PROBLEM prednindr
$DATA THEO
$INPUT ID DOSE TIME CP=DV WT
$SUBR PRED=prednindr.for
$THETA 1
$OMEGA 1
$SIGMA 1

Here is PRED subroutine prednindr.for:

 SUBROUTINE PRED (ICALL,NEWIND,THETA,DATREC,INDXS,F,G,H)
 USE SIZES, ONLY: DPSIZE,ISIZE
 USE PRDIMS,ONLY: GPRD,HPRD,GERD,HERD,GPKD
! NINDR,INDR1,INDR2 are reserved variables in abbreviated code.
! The following USE statement makes them usable in the Fortran code
 USE ROCM_INT, ONLY: NINDR=>NINDOBS,INDR1=>IDXOBSF,INDR2=>IDXOBSL

 IMPLICIT REAL(KIND=DPSIZE) (A-Z)
 REAL(KIND=DPSIZE) :: DATREC
 INTEGER(KIND=ISIZE) :: ICALL,NEWIND,INDXS
 REAL(KIND=DPSIZE) :: G(GPRD,*),H(HPRD,*)
 DIMENSION :: THETA(*),DATREC(*),INDXS(*)

if (icall.eq.0) print *,'nindr,indr1,indr2',nindr,indr1,indr2
      f=1.
      g(1,1)=1.
      h(1,1)=1.
 END

When prednindr.ctl runs, it generates a line of output

 nindr,indr1,indr2 12 1 12

Nindr will have value 12 for the entire problem.


On Tue, Jun 11, 2019, at 1:20 AM, ryota-j_at_chiba-u.jp wrote:
> Dear NMusers,
>
> I'm making PRED subroutine using Fortran 95 now. In my PRED subroutine, it
> is necessary to know the total number of subjects of the data. I found that
> the total number of subjects is described in the output file of NONMEM as
> "TOT. NO. OF INDIVIDUALS". So, I think it is accessible. Could you please
> tell me how to access the variable from PRED subroutine?
>
> Regards
>
> Ryota Jin
> Chiba university, Japan.
> email: ryota-j_at_chiba-u.jp
>
>
>

--
  Alison Boeckmann
  alisonboeckmann_at_fastmail.fm

Received on Mon Jun 17 2019 - 13:29:19 EDT

The NONMEM Users Network is maintained by ICON plc. Requests to subscribe to the network should be sent to: nmusers-request_at_iconplc.com. Once subscribed, you may contribute to the discussion by emailing: nmusers@globomaxnm.com.