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
How do I access the total number of subject?
5 messages
2 people
Latest: Jun 26, 2019
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: [email protected]
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.
Quoted reply history
On Tue, Jun 11, 2019, at 1:20 AM, [email protected] 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: [email protected]
>
>
>
--
Alison Boeckmann
[email protected]
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
Quoted reply history
-----Original Message-----
From: owner-nmusers_at_globomaxnm.com <owner-nmusers_at_globomaxnm.com> On Behalf
Of Alison Boeckmann
Sent: Tuesday, June 18, 2019 2:29 AM
To: ryota-j_at_chiba-u.jp; nmusers_at_globomaxnm.com; ajbf
<alisonboeckmann_at_fastmail.fm>
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_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
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
Quoted reply history
-----Original Message-----
From: [email protected] <[email protected]> On Behalf
Of Alison Boeckmann
Sent: Tuesday, June 18, 2019 2:29 AM
To: [email protected]; [email protected]; ajbf
<[email protected]>
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, [email protected] 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: [email protected]
>
>
>
--
Alison Boeckmann
[email protected]