NONMEM Users Network Archive

Hosted by Cognigen

RE: How do I access the total number of subject?

From: ryota-j
Date: Wed, 26 Jun 2019 10:07:35 +0900

Dear Alison,

Thanks for the detail explanation!
I tried your example code and confirmed NINDR has the total number of
individual.
Then, I implement NINDR into my PRED subroutine. It ran well!

Sorry for the late reply.

Ryota Jin

-----Original Message-----
From: owner-nmusers
Of Alison Boeckmann
Sent: Tuesday, June 18, 2019 2:29 AM
To: ryota-j
<alisonboeckmann
Subject: Re: [NMusers] How do I access the total number of subject?

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
> 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
>
>
>

--
  Alison Boeckmann
  alisonboeckmann

Received on Tue Jun 25 2019 - 21:07:35 EDT

The NONMEM Users Network is maintained by ICON plc. Requests to subscribe to the network should be sent to: nmusers-request@iconplc.com.

Once subscribed, you may contribute to the discussion by emailing: nmusers@globomaxnm.com.