Re: More Levels of Random Effects
Hi Bill,
I think, description in $PRIOR and nwpri help entries are the most helpful. The simplest 1-compartment problem example is below.
Good luck!
Leonid
--------------------------------------
Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
web: www.quantpharm.com
e-mail: LGibiansky at quantpharm.com
tel: (301) 767 5566
----------
$PROBLEM 001, example
$INPUT ID,TIME,AMT,DV,MDV,EVID
$DATA data.csv
$SUBROUTINES ADVAN1 TRANS1
$PRIOR NWPRI NTHETA=3 NETA=2 NEPS=1 NTHP=3 NETP=2 NPEXP=1
$PK
CL = THETA(1)*EXP(ETA(1))
V = THETA(2)*EXP(ETA(2))
K=CL/V
SD1 = THETA(3)
S1=V
$ERROR
Y=A(1)/V*EXP(SD1*EPS(1))
$THETA ; INITIAL ESTIMATES FOR THETAS
(0,1) ; 1 CL
(0,1) ; 2 V
(0,0.3) ; 3 error SD
$THETA ; PRIOR MEAN OF THETAS
2 FIXED ; 1 CL
2 FIXED ; 2 V
0.3 FIXED ; 3 error SD
$THETA ; degrees of freedom for OMEGAs
20 FIXED ; 1 CL
20 FIXED ; 2 V1
$OMEGA ; current-problem omegas
0.1 ;[P] 1 V1
0.1 ;[P] 2 CL
$OMEGA ; variances of the distribution for thetas
1.5 FIXED ;[P] 1 CL
1.5 FIXED ;[P] 2 V
0.1 FIXED ;[P] 3 error SD
$OMEGA ; mode of priors for omegas
0.15 FIXED ; 1 CL
0.15 FIXED ; 2 V1
$SIGMA
1 FIXED ;[P]
$EST MAXEVAL=9999 NOABORT METHOD=1
----------
data.csv:
1,0,1000,0,1,1
1,0.1,0,1000,0,0
1,0.2,0,900,0,0
1,0.3,0,800,0,0
1,0.4,0,600,0,0
1,0.5,0,500,0,0
1,1,0,200,0,0
1,2,0,100,0,0
1,3,0,50,0,0
1,4,0,25,0,0
1,5,0,10,0,0
2,0,1000,0,1,1
2,0.1,0,1000,0,0
2,0.2,0,900,0,0
2,0.3,0,800,0,0
2,0.4,0,600,0,0
2,0.5,0,500,0,0
2,1,0,200,0,0
2,2,0,100,0,0
2,3,0,50,0,0
2,4,0,25,0,0
2,5,0,10,0,0
Denney, William S. wrote:
> Hi Leonid,
>
> It is not obvious to me how to make use of the next level of random
> effects using the PRIOR subroutine in the html help. Can you point me
> to an example or other documentation of how to use PRIOR for this?
>
> Thanks,
>
> Bill
>
Quoted reply history
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Leonid Gibiansky
> Sent: Friday, October 17, 2008 10:35 AM
> To: [EMAIL PROTECTED]
> Cc: nmusers; Nick Holford
> Subject: Re: [NMusers] More Levels of Random Effects
>
> The next level of random effects can be introduced in NONMEM using PRIOR
>
> subroutine. It existed as undocumented feature even in Nonmem V. Now (in
>
> Nonmem VI) it is official (see help).
> Leonid
>
> --------------------------------------
> Leonid Gibiansky, Ph.D.
> President, QuantPharm LLC
> web: www.quantpharm.com
> e-mail: LGibiansky at quantpharm.com
> tel: (301) 767 5566
>
> [EMAIL PROTECTED] wrote:
>
> > I suppose it really comes down to what you are going to do with the model. Many times I have checked the SAME assumption when modeling inter-occasional variability, and found that sometimes, removing it
>
> does
>
> > indeed improve the fit significantly. In almost every case I've retained it (despite the better fit) for the exact reasons Leonid
>
> cites:
>
> > it makes your model completely data-dependent. I suppose if the model was meant as a description or summary of the data, then it would not matter, but I make all of my models work for a living...
> >
> > There is a related topic which I'd be interested in hearing from the group about. Many times, we take several Phase 1 studies and put them together in order to develop a population model early in development. I've learned through experience to be careful when doing this, because
>
> > often, one or more studies will appear to have a different mean
>
> response
>
> > for some parameter, e.g., CL or V2. Of course, you can introduce study
>
> > as a covariate, but this intrduces the same problem as above; in a simulation context, which CL value is correct? There is a work-around for this (use both values) but this doubles the number of simulations you have to do, and from a scientific stand-point it is not very satisfying. What we need is another level of random effects at the
>
> STUDY
>
> > level, similar to what is routinely done when performing hierarchical modeling in something like WinBUGS. I'd love to see this feature in a future version of NONMEM.
> >
> > *"Leonid Gibiansky" <[EMAIL PROTECTED]>*
> > Sent by: [EMAIL PROTECTED]
> >
> > 17-Oct-2008 09:30
> >
> > To
> >
> > "Nick Holford" <[EMAIL PROTECTED]>
> > cc
> > "nmusers" <[email protected]>
> > Subject
> > Re: [NMusers] More Levels of Random Effects
> >
> > Nick,
> >
> > This is exactly what I meant. If you have a model for English, Irish
>
> and
>
> > Welsh, you may at least extrapolate it to Australians and New
>
> Zealanders
>
> > (of British descent :) ). With occasion treated as non-ordered
> > categorical covariate, you cannot extrapolate the model at all because
> > time cannot be repeated, so your covariate (occasion) will have
> > different value (level) at any future trial.
> >
> > Leonid
> >
> > --------------------------------------
> > Leonid Gibiansky, Ph.D.
> > President, QuantPharm LLC
> > web: www.quantpharm.com
> > e-mail: LGibiansky at quantpharm.com
> > tel: (301) 767 5566
> >
> > Nick Holford wrote:
> > > Leonid,
> > >
> > > I dont understand what you mean by "we lose predictive power of the
> > > model: we do not know what will be
> > > the variability on the next occasion.".
> > >
> > > Or are you concerned about the situation where you have say 3
>
> occasions
>
> > > and the IOV seems to be different on each occasion but you now want
>
> to
>
> > > predict the IOV for a future study on the 4th occasion?
> > >
> > > I agree it is hard to extrapolate to future occasions but this
>
> seems to
>
> > > be just like any other non-ordered categorical covariate - e.g. if
>
> we
>
> > > see differences between English, Irish and Welsh what difference
>
> would
>
> > > you expect for Russians? :-)
> > >
> > > Nick
> > >
> > >
> > > Leonid Gibiansky wrote:
> > >> Hi Xia, Nick
> > >> Technically, one can use different variances on different
>
> occasions but
>
> > >> then we loose predictive power of the model: we do not know what
>
> will be
>
> > >> the variability on the next occasion. One can use
>
> occasion-dependent IOV
>
> > >> variance to check for trends (for example, to investigate the time
> > >> dependence of the IOV variability, or to check whether the first
> > >> occasion (e.g., after the first dose of a long-term study) is for
>
> some
>
> > >> reasons different from the others) but the final model should have
>
> some
>
> > >> condition that specifies the relations of IOV variances at
>
> different
>
> > >> occasion (SAME being the simplest, most reasonable and the
>
> most-often
>
> > >> used option).
> > >>
> > >> Thanks
> > >> Leonid
> > >>
> > >> --------------------------------------
> > >> Leonid Gibiansky, Ph.D.
> > >> President, QuantPharm LLC
> > >> web: www.quantpharm.com
> > >> e-mail: LGibiansky at quantpharm.com
> > >> tel: (301) 767 5566
> > >>
> > >>
> > >>
> > >>
> > >> Nick Holford wrote:
> > >>> Xia,
> > >>>
> > >>> There is no requirement to use the SAME option. However, it is a
> > >>> reasonable model for IOV that it has the same variability on each
> > >>> occasion.
> > >>>
> > >>> If you dont use the SAME option then you just need to estimate an
> > >>> extra OMEGA parameter for each occasion you dont use SAME. You
>
> can
>
> > >>> test if the SAME assumption is supported by your data or not by
> > >>> comparing models with and without SAME.
> > >>>
> > >>> Nick
> > >>>
> > >>> PS Your computer clock seems to be more than 2 years out of date.
> > >>> Your email claimed it was sent in 17 Jan 2006.
> > >>>
> > >>> Xia Li wrote:
> > >>>> Dear All,
> > >>>> Do we have to assume the variability between all occasions are
>
> the
>
> > >>>> same when
> > >>>> we estimate IOV? What will happen if I don't use the 'same'
> > >>>> constrain in the
> > >>>> $OMEGA BLOCK statement? Any input will be appreciated.
> > >>>>
> > >>>> Best,
> > >>>>
> > >>>> Xia Li
> > >>>>
> > >>>> -----Original Message-----
> > >>>> From: [EMAIL PROTECTED]
> > >>>> [mailto:[EMAIL PROTECTED] On
> > >>>> Behalf Of Johan Wallin
> > >>>> Sent: Wednesday, October 15, 2008 9:17 AM
> > >>>> To: [email protected]
> > >>>> Subject: RE: [NMusers] More Levels of Random Effects
> > >>>>
> > >>>> Bill,
> > >>>> Is it really an eta you want, or is this rather solved by
>
> different
>
> > >>>> error
> > >>>> models for the different machines?
> > >>>>
> > >>>> If still want etas, one way would be to model in the same way as
> > >>>> IOV. In the
> > >>>> case of intermachine-variability you would have to assume the
> > >>>> variability
> > >>>> between all machines are the same... Or would you rather assume
> > >>>> interindividual variability is different with
> > >>>> different machine, and you then would want one eta for TH(X) for
>
> every
>
> > >>>> machine...? It depends on what you mean by different slope every
>
> day,
>
> > >>>> regarding on what your experiments like, but calibration
>
> differences
>
> > >>>> should
> > >>>> perhaps be taken care of by looking into your error model, eta
>
> on
>
> > >>>> epsilon
> > >>>> for starters...
> > >>>>
> > >>>> Without knowing your structure of data, a short example of
>
> IOV-like
>
> > >>>> variability would be:
> > >>>>
> > >>>> MA1=0
> > >>>> MA2=0
> > >>>> IF(MACH=1)MA1=1
> > >>>> IF(MACH=2)MA2=1
> > >>>> ;Intermachine variability:
> > >>>> ETAM = MA1*ETA(Y)+MA2*ETA(Z)
> > >>>>
> > >>>> PAR= TH(X) *EXP(ETA(X)+ETAM)
> > >>>>
> > >>>> $OMEGA value1
> > >>>> $OMEGA BLOCK(1) value2
> > >>>> $OMEGA BLOCK(1) same
> > >>>>
> > >>>> /Johan
> > >>>>
> > >>>>
> > >>>> _________________________________________
> > >>>> Johan Wallin, M.Sci./Ph.D.-student
> > >>>> Pharmacometrics Group
> > >>>> Div. of Pharmacokinetics and Drug therapy
> > >>>> Uppsala University
> > >>>> _________________________________________
> > >>>>
> > >>>>
> > >>>> -----Original Message-----
> > >>>> From: [EMAIL PROTECTED]
> > >>>> [mailto:[EMAIL PROTECTED] On
> > >>>> Behalf Of Denney, William S.
> > >>>> Sent: den 15 oktober 2008 14:39
> > >>>> To: [email protected]
> > >>>> Subject: [NMusers] More Levels of Random Effects
> > >>>>
> > >>>> Hello,
> > >>>>
> > >>>> I'm trying to build a model where I need to have ETAs generated
>
> on
>
> > >>>> separately for the ID and another variable (MACH). What I have
>
> is
>
> > a PD
> > >>>> experiment that was run on several different machines (MACH).
>
> Each
>
> > >>>> machine appears to have a different slope per day and a
>
> different
>
> > >>>> calibration. I still need to keep some ETAs on the ID column,
>
> so I
>
> > >>>> can't just assign MACH=ID.
> > >>>>
> > >>>> I've heard that there are ways to do similar to this, but I have
>
> been
>
> > >>>> unable to find examples of how to set etas to key off of
>
> different
>
> > >>>> columns.
> > >>>>
> > >>>> Thanks,
> > >>>>
> > >>>> Bill
>
> Notice: This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
> New Jersey, USA 08889), and/or its affiliates (which may be known
> outside the United States as Merck Frosst, Merck Sharp & Dohme or
> MSD and in Japan, as Banyu - direct contact information for affiliates is
> available at http://www.merck.com/contact/contacts.html) that may be
> confidential, proprietary copyrighted and/or legally privileged. It is
> intended solely for the use of the individual or entity named on this
> message. If you are not the intended recipient, and have received this
> message in error, please notify us immediately by reply e-mail and
> then delete it from your system.