$MIX and $CONTR

7 messages 5 people Latest: Jul 31, 2007

$MIX and $CONTR

From: Nick Holford Date: July 30, 2007 technical
I wonder if someone can explain this item in the online NONMEM help guide for $MIX. $INPUT ... AGE ... $CONTR DATA=(AGE) Then AGE may be used on the right in $MIX. AGE and AGE(1) both refer to the value of AGE on the first observation record of the individual record. AGE(i) refers to the value of AGE on the i- th. observation record of the individual record. Assume there are 2 records for each subject like this ID AGE DV 1 0 10.506 1 50 10.331 2 0 10.039 2 50 10.99 3 0 9.3782 3 50 9.9395 4 0 98.438 4 50 99.411 5 0 10.598 5 50 9.6335 and this code is used to simulate with a different mixing fraction if AGE is less than 25 compared with AGE greater than or equal to 25: $PROB MIX $DATA agemix.csv $INPUT ID AGE DV $SIM (20070730) ONLYSIM NSUB=1 $THETA 0.25 ; PLT25 25% of young are non-responder 0.75 ; PGE25 75% of older are non-responder 10 ; NONRESPONDER 100 ; RESPONDER $OMEGA 0.01 $OMEGA 0.1 $SIGMA 1 $PRED IF (MIXNUM.EQ.1) THEN ; non-responder Y=THETA(3) + ETA(1) + EPS(1) ELSE ; responder Y=THETA(4) + ETA(2) + EPS(1) ENDIF $CONTR DATA=(AGE) $MIX NSPOP=2 IF (AGE.LT.25) THEN P(1)=THETA(1) ; young non-responder P(2)=1-THETA(1) ELSE P(1)=THETA(2) ; older non-responder P(2)=1-THETA(2) ENDIF $TABLE ID AGE DV NOAPPEND NOPRINT ONEHEADER FILE=agemix.fit I choose to define a response > 50 as a responder and <=50 as a non-responder. The simulated DV values (10,000 subjects) had 75% of non-responders (with the same proportion at both ages). I had expected 25% because AGE in $MIX is supposed to be the AGE on the first obs record i.e. AGE=0. I got identical results with NONMEM VI and NONMEM V. First question: Why is the proportion of simulated subjects different from what I expected? It seems like all the values are being simulated with AGE=50 instead of AGE=0. Second question: More generally, if we used AGE in other subroutines (e.g. $PK, $PRED) then AGE would change depending on the value in the current event record. Why doesn't this happen with $MIX? Third question: Is there a way to know the index of the observation record that is being used by $MIX? If I wanted to use AGE like I do in $PK it seems I must give the index of the current observation record. Nick -- Nick Holford, Dept Pharmacology & Clinical Pharmacology University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 www.health.auckland.ac.nz/pharmacology/staff/nholford

Re: $MIX and $CONTR

From: Leonid Gibiansky Date: July 30, 2007 technical
Nick, I am not sure that the entire idea is correct: subject can only belong to one population, it cannot jump from population to population. Therefore, time dependent P() should not be allowed. Record-number dependence in $MIX was probably invented to have an option of defining the Ps either by the baseline values, or by the values at the end of the study, but not for time-dependence. This could explains differences with the PK block approach. Thanks Leonid > First question: Why is the proportion of simulated subjects different from what I expected? It seems like all the values are being simulated with AGE=50 instead of AGE=0. > > Second question: More generally, if we used AGE in other subroutines (e.g. $PK, $PRED) then AGE would change depending on the value in the current event record. Why doesn't this happen with $MIX? > > Third question: Is there a way to know the index of the observation record that is being used by $MIX? If I wanted to use AGE like I do in $PK it seems I must give the index of the current observation record. Nick Holford wrote: > I wonder if someone can explain this item in the online NONMEM help guide for > $MIX. > > $INPUT ... AGE ... > $CONTR DATA=(AGE) > Then AGE may be used on the right in $MIX. AGE and AGE(1) both > refer to the value of AGE on the first observation record of the > individual record. AGE(i) refers to the value of AGE on the i- > th. observation record of the individual record. > > Assume there are 2 records for each subject like this > > ID AGE DV > 1 0 10.506 > 1 50 10.331 > 2 0 10.039 > 2 50 10.99 > 3 0 9.3782 > 3 50 9.9395 > 4 0 98.438 > 4 50 99.411 > 5 0 10.598 > 5 50 9.6335 > > and this code is used to simulate with a different mixing fraction if AGE is > less than 25 compared with AGE greater than or equal to 25: > > $PROB MIX > $DATA agemix.csv > $INPUT ID AGE DV > $SIM (20070730) ONLYSIM NSUB=1 > $THETA > 0.25 ; PLT25 25% of young are non-responder > 0.75 ; PGE25 75% of older are non-responder > 10 ; NONRESPONDER > 100 ; RESPONDER > $OMEGA 0.01 > $OMEGA 0.1 > > $SIGMA 1 > > $PRED > IF (MIXNUM.EQ.1) THEN ; non-responder > Y=THETA(3) + ETA(1) + EPS(1) > ELSE ; responder > Y=THETA(4) + ETA(2) + EPS(1) > ENDIF > > $CONTR DATA=(AGE) > $MIX > NSPOP=2 > IF (AGE.LT.25) THEN > P(1)=THETA(1) ; young non-responder > P(2)=1-THETA(1) > ELSE > P(1)=THETA(2) ; older non-responder > P(2)=1-THETA(2) > ENDIF > > $TABLE ID AGE DV > NOAPPEND NOPRINT ONEHEADER FILE=agemix.fit > > I choose to define a response > 50 as a responder and <=50 as a non-responder. > The simulated DV values (10,000 subjects) had 75% of non-responders (with the > same proportion at both ages). I had expected 25% because AGE in $MIX is > supposed to be the AGE on the first obs record i.e. AGE=0. I got identical > results with NONMEM VI and NONMEM V. > > First question: Why is the proportion of simulated subjects different from what > I expected? It seems like all the values are being simulated with AGE=50 > instead of AGE=0. > > Second question: More generally, if we used AGE in other subroutines (e.g. > $PK, $PRED) then AGE would change depending on the value in the current event > record. Why doesn't this happen with $MIX? > > Third question: Is there a way to know the index of the observation record that > is being used by $MIX? If I wanted to use AGE like I do in $PK it seems I must > give the index of the current observation record. > > Nick > > -- > Nick Holford, Dept Pharmacology & Clinical Pharmacology > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > www.health.auckland.ac.nz/pharmacology/staff/nholford

Re: $MIX and $CONTR

From: Nick Holford Date: July 31, 2007 technical
Leonid, Thanks for your thoughtful comments. I think there are two things to keep separate: 1. Imagine a drug response can be described by a bi-modal distribution when one examines a sample of subjects who are all children. A mixture model can be used to identify the parameters of this mixed distribution. One can then categorize people as being more likely to be in distribution ('responders') than in the other distribution ('non-responders'). Supposing that we now observe that in a different sample of older subjects that the mixing probability is different but the two distributions have similar parameters. We would therefore conclude that the mixing probability changes with age. The underlying basis for the distinction between responder and non-responder may be due to the expression of a gene. The expression of some genes is well known to vary during human development. Imagine that this gene is either turned on ('responder') or is turned off ('non-responder'). This would be a biological explanation of the age dependence of the mixing parameter. If the genotype is unknown then we would need to use a mixture model to try to decide which genotype is most likely in an individual. But because the probability of expression of the gene is also unknown but varies with age then a mixture model with age as a covariate seems reasonable. If we observed the same subjects as children and later as adults then we should be able to describe the age related shift in the probability of being a 'responder' or a 'non-responder'. It is this kind of situation that I tried to describe using the NM-TRAN code. 2. NONMEM is a particular implementation of a method for describing and estimating the parameters of mixture model. It seems that NONMEM may only have a rather simple view of mixtures i.e. an individual always belongs to the same distribution and this cannot change. I am not sure yet if it is true that NONMEM assumes a fixed (life long) within subject assignment to a distribution but I dont see any a priori reason why an individual should not shift from one distribution to another (as explained in the example above). Nick Leonid Gibiansky wrote: > > Nick, > > I think you are reading it incorrectly. I would guess that for a long-term > study you may relate > probability of response to either baseline age or to the end-of-study age, or > to any other age in > between, but this value should be one per subject, not one per record. > Probability of a subject be > in one group is assigned based on the entire data set for this subject, and > not extracted from one > record. Probability of being a responder may depend on age, but it should be > 1 value for a subject, > not 1 value for a record. If you want to simulate subject with same > covariates but different age, > give them separate IDs. You may need to simulate ETAs separately (if you want > patients with the same > random effects but different ages). > > I do not have sufficient experience or knowledge of the nonmem code to be > more assertive. This is my > guess only, but guess confirmed by a special treatment of a time dependency > in the $MIX block (as > you described). > > Leonid > > Nick Holford wrote: > > Leonid, > > > > I dont see why a proportion should not change with time. The documentation > > for $MIX says this: > > > > "Then AGE may be used on the right in $MIX. ... > > AGE(i) refers to the value of AGE on the i-th. observation record of the > > individual record." > > > > This clearly shows that it was anticipated that one might wish to use AGE > > from any observation record in the individual record. If the records > > represent a time series (which is 100% necessary if AGE varies!) then this > > implies that a time varying covariate can be used to model the mixing > > probability. > > > > In my example I propose that the probability of being a responder changes > > with age. E.g. children tend to respond to amphetamine like drugs by being > > less active while adults tend to be stimulated. > > > > This seems like a very plausible way to describe the response in a > > population. I dont think there is any a priori reason why there should not > > be a within subject variation in a mixing fraction. > > > > My view of a mixing fraction is that it is a substitute for a missing > > covariate. If one has a time varying covariate then the mixing fraction > > would be time varying. In the example proposed in the NONMEM help the > > covariate proposed for use in $MIX is AGE. If AGE is properly recorded in > > the data set then AGE is guaranteed to be a time varying covariate! > > > > Nick > > > > Leonid Gibiansky wrote: > >> Nick, > >> I am not sure that the entire idea is correct: subject can only belong to > >> one population, it cannot > >> jump from population to population. Therefore, time dependent P() should > >> not be allowed. > >> Record-number dependence in $MIX was probably invented to have an option > >> of defining the Ps either > >> by the baseline values, or by the values at the end of the study, but not > >> for time-dependence. This > >> could explains differences with the PK block approach. > >> Thanks > >> Leonid > >> > >> > First question: Why is the proportion of simulated subjects different > >> from what I expected? It > >> seems like all the values are being simulated with AGE=50 instead of AGE=0. > >> > > >> > Second question: More generally, if we used AGE in other subroutines > >> (e.g. $PK, $PRED) then AGE > >> would change depending on the value in the current event record. Why > >> doesn't this happen with $MIX? > >> > > >> > Third question: Is there a way to know the index of the observation > >> record that is being used by > >> $MIX? If I wanted to use AGE like I do in $PK it seems I must give the > >> index of the current > >> observation record. > >> > >> Nick Holford wrote: > >>> I wonder if someone can explain this item in the online NONMEM help guide > >>> for $MIX. > >>> > >>> $INPUT ... AGE ... > >>> $CONTR DATA=(AGE) > >>> Then AGE may be used on the right in $MIX. AGE and AGE(1) both > >>> refer to the value of AGE on the first observation record of the > >>> individual record. AGE(i) refers to the value of AGE on the i- > >>> th. observation record of the individual record. > >>> > >>> Assume there are 2 records for each subject like this > >>> > >>> ID AGE DV > >>> 1 0 10.506 > >>> 1 50 10.331 > >>> 2 0 10.039 > >>> 2 50 10.99 > >>> 3 0 9.3782 > >>> 3 50 9.9395 > >>> 4 0 98.438 > >>> 4 50 99.411 > >>> 5 0 10.598 > >>> 5 50 9.6335 > >>> > >>> and this code is used to simulate with a different mixing fraction if AGE > >>> is less than 25 compared with AGE greater than or equal to 25: > >>> > >>> $PROB MIX > >>> $DATA agemix.csv > >>> $INPUT ID AGE DV > >>> $SIM (20070730) ONLYSIM NSUB=1 > >>> $THETA > >>> 0.25 ; PLT25 25% of young are non-responder > >>> 0.75 ; PGE25 75% of older are non-responder > >>> 10 ; NONRESPONDER > >>> 100 ; RESPONDER > >>> $OMEGA 0.01 > >>> $OMEGA 0.1 > >>> $SIGMA 1 > >>> > >>> $PRED > >>> IF (MIXNUM.EQ.1) THEN ; non-responder > >>> Y=THETA(3) + ETA(1) + EPS(1) > >>> ELSE ; responder > >>> Y=THETA(4) + ETA(2) + EPS(1) > >>> ENDIF > >>> > >>> $CONTR DATA=(AGE) > >>> $MIX > >>> NSPOP=2 > >>> IF (AGE.LT.25) THEN > >>> P(1)=THETA(1) ; young non-responder > >>> P(2)=1-THETA(1) > >>> ELSE > >>> P(1)=THETA(2) ; older non-responder > >>> P(2)=1-THETA(2) > >>> ENDIF > >>> > >>> $TABLE ID AGE DV > >>> NOAPPEND NOPRINT ONEHEADER FILE=agemix.fit > >>> > >>> I choose to define a response > 50 as a responder and <=50 as a > >>> non-responder. > >>> The simulated DV values (10,000 subjects) had 75% of non-responders (with > >>> the same proportion at both ages). I had expected 25% because AGE in $MIX > >>> is supposed to be the AGE on the first obs record i.e. AGE=0. I got > >>> identical results with NONMEM VI and NONMEM V. > >>> > >>> First question: Why is the proportion of simulated subjects different > >>> from what I expected? It seems like all the values are being simulated > >>> with AGE=50 instead of AGE=0. > >>> > >>> Second question: More generally, if we used AGE in other subroutines > >>> (e.g. $PK, $PRED) then AGE would change depending on the value in the > >>> current event record. Why doesn't this happen with $MIX? > >>> > >>> Third question: Is there a way to know the index of the observation > >>> record that is being used by $MIX? If I wanted to use AGE like I do in > >>> $PK it seems I must give the index of the current observation record. > >>> > >>> Nick > >>> > >>> -- > >>> Nick Holford, Dept Pharmacology & Clinical Pharmacology > >>> University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New > >>> Zealand > >>> [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > >>> www.health.auckland.ac.nz/pharmacology/staff/nholford > >>> > >>> > > > > -- > > Nick Holford, Dept Pharmacology & Clinical Pharmacology > > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > www.health.auckland.ac.nz/pharmacology/staff/nholford > > > > -- Nick Holford, Dept Pharmacology & Clinical Pharmacology University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 www.health.auckland.ac.nz/pharmacology/staff/nholford

RE: $MIX and $CONTR

From: Ekaterina Gibiansky Date: July 31, 2007 technical
Nick, As I understand the mixture model, it allows to describe multimodal distributions of random effects (ETAs). In the context of the mixed-effect model these distributions (and individual ETAs) do not change with time. It is similar to $PK or $PRED where individual ETAs do not change with time while the parameters itself (CL, V, etc) can depend on time. In $MIX, each subject is classified into one of the subpopulations, based on estimated mixing probabilities, population parameter estimates and subject's individual data. Once classified, predictions for that subject are based on the submodel for that population. Katya --- Ekaterina Gibiansky Director, PK/PD MedImmune, Inc. [EMAIL PROTECTED] Phone: 301-398-5356 Fax: 301-398-8356
Quoted reply history
________________________________ From: [EMAIL PROTECTED] on behalf of Nick Holford Sent: Mon 7/30/2007 5:14 PM To: nmusers Subject: Re: [NMusers] $MIX and $CONTR Leonid, I dont see why a proportion should not change with time. The documentation for $MIX says this: "Then AGE may be used on the right in $MIX. ... AGE(i) refers to the value of AGE on the i-th. observation record of the individual record." This clearly shows that it was anticipated that one might wish to use AGE from any observation record in the individual record. If the records represent a time series (which is 100% necessary if AGE varies!) then this implies that a time varying covariate can be used to model the mixing probability. In my example I propose that the probability of being a responder changes with age. E.g. children tend to respond to amphetamine like drugs by being less active while adults tend to be stimulated. This seems like a very plausible way to describe the response in a population. I dont think there is any a priori reason why there should not be a within subject variation in a mixing fraction. My view of a mixing fraction is that it is a substitute for a missing covariate. If one has a time varying covariate then the mixing fraction would be time varying. In the example proposed in the NONMEM help the covariate proposed for use in $MIX is AGE. If AGE is properly recorded in the data set then AGE is guaranteed to be a time varying covariate! Nick Leonid Gibiansky wrote: > > Nick, > I am not sure that the entire idea is correct: subject can only belong to one > population, it cannot > jump from population to population. Therefore, time dependent P() should not > be allowed. > Record-number dependence in $MIX was probably invented to have an option of > defining the Ps either > by the baseline values, or by the values at the end of the study, but not for > time-dependence. This > could explains differences with the PK block approach. > Thanks > Leonid > > > First question: Why is the proportion of simulated subjects different from > what I expected? It > seems like all the values are being simulated with AGE=50 instead of AGE=0. > > > > Second question: More generally, if we used AGE in other subroutines > (e.g. $PK, $PRED) then AGE > would change depending on the value in the current event record. Why doesn't > this happen with $MIX? > > > > Third question: Is there a way to know the index of the observation record > that is being used by > $MIX? If I wanted to use AGE like I do in $PK it seems I must give the index > of the current > observation record. > > Nick Holford wrote: > > I wonder if someone can explain this item in the online NONMEM help guide > > for $MIX. > > > > $INPUT ... AGE ... > > $CONTR DATA=(AGE) > > Then AGE may be used on the right in $MIX. AGE and AGE(1) both > > refer to the value of AGE on the first observation record of the > > individual record. AGE(i) refers to the value of AGE on the i- > > th. observation record of the individual record. > > > > Assume there are 2 records for each subject like this > > > > ID AGE DV > > 1 0 10.506 > > 1 50 10.331 > > 2 0 10.039 > > 2 50 10.99 > > 3 0 9.3782 > > 3 50 9.9395 > > 4 0 98.438 > > 4 50 99.411 > > 5 0 10.598 > > 5 50 9.6335 > > > > and this code is used to simulate with a different mixing fraction if AGE > > is less than 25 compared with AGE greater than or equal to 25: > > > > $PROB MIX > > $DATA agemix.csv > > $INPUT ID AGE DV > > $SIM (20070730) ONLYSIM NSUB=1 > > $THETA > > 0.25 ; PLT25 25% of young are non-responder > > 0.75 ; PGE25 75% of older are non-responder > > 10 ; NONRESPONDER > > 100 ; RESPONDER > > $OMEGA 0.01 > > $OMEGA 0.1 > > $SIGMA 1 > > > > $PRED > > IF (MIXNUM.EQ.1) THEN ; non-responder > > Y=THETA(3) + ETA(1) + EPS(1) > > ELSE ; responder > > Y=THETA(4) + ETA(2) + EPS(1) > > ENDIF > > > > $CONTR DATA=(AGE) > > $MIX > > NSPOP=2 > > IF (AGE.LT.25) THEN > > P(1)=THETA(1) ; young non-responder > > P(2)=1-THETA(1) > > ELSE > > P(1)=THETA(2) ; older non-responder > > P(2)=1-THETA(2) > > ENDIF > > > > $TABLE ID AGE DV > > NOAPPEND NOPRINT ONEHEADER FILE=agemix.fit > > > > I choose to define a response > 50 as a responder and <=50 as a > > non-responder. > > The simulated DV values (10,000 subjects) had 75% of non-responders (with > > the same proportion at both ages). I had expected 25% because AGE in $MIX > > is supposed to be the AGE on the first obs record i.e. AGE=0. I got > > identical results with NONMEM VI and NONMEM V. > > > > First question: Why is the proportion of simulated subjects different from > > what I expected? It seems like all the values are being simulated with > > AGE=50 instead of AGE=0. > > > > Second question: More generally, if we used AGE in other subroutines (e.g. > > $PK, $PRED) then AGE would change depending on the value in the current > > event record. Why doesn't this happen with $MIX? > > > > Third question: Is there a way to know the index of the observation record > > that is being used by $MIX? If I wanted to use AGE like I do in $PK it > > seems I must give the index of the current observation record. > > > > Nick > > > > -- > > Nick Holford, Dept Pharmacology & Clinical Pharmacology > > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > www.health.auckland.ac.nz/pharmacology/staff/nholford > > > > -- Nick Holford, Dept Pharmacology & Clinical Pharmacology University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 www.health.auckland.ac.nz/pharmacology/staff/nholford

Re: $MIX and $CONTR

From: Leonid Gibiansky Date: July 31, 2007 technical
Hi Nick, I fully agree with #1. It is a very reasonable model biologically, but the mixture model is not an appropriate tool to describe this model. You may want to describe it with the different procedure: describe probability (not jump, but continuous function of age or something else) of being a responder, and on top of it define different conditional probability of a response for responders and non responders. P(AGE): probability of being a responder Presp: probability of response for responders Pnresp: probability of response for non-responders Y=P*Presp+(1-P)Pnresp Of course, each of P, Presp, Pnresp should be expressed via THETAs, ETAs, whatever we need; may depend on gene expression if you like. I am not sure that I agree with #2: this is not a nonmem implementation deficiency. The biological problem that you describe simply does not fit in the framework of the mixture model, it should be described differently, may be as above (this was only a quick sketch, may not work for you), may be in a more complicated way, but not as a mixture model. Alternatively, you may assign different IDs to the same subject at age 10 and 50 (it is naive to expect that we stay unchanged for a lifetime): if the person changes so much that it jumps from responders to non-responders, you may expect other changes as well. Please, let us know if you come up with NONMEM description of your problem. Leonid Nick Holford wrote: > Leonid, > > Thanks for your thoughtful comments. > > I think there are two things to keep separate: > > 1. Imagine a drug response can be described by a bi-modal distribution when one > examines a sample of subjects who are all children. A mixture model can be used > to identify the parameters of this mixed distribution. One can then categorize > people as being more likely to be in distribution ('responders') than in the > other distribution ('non-responders'). > > Supposing that we now observe that in a different sample of older subjects that > the mixing probability is different but the two distributions have similar > parameters. We would therefore conclude that the mixing probability changes > with age. > > The underlying basis for the distinction between responder and non-responder > may be due to the expression of a gene. The expression of some genes is well > known to vary during human development. Imagine that this gene is either turned > on ('responder') or is turned off ('non-responder'). This would be a biological > explanation of the age dependence of the mixing parameter. If the genotype is > unknown then we would need to use a mixture model to try to decide which > genotype is most likely in an individual. But because the probability of > expression of the gene is also unknown but varies with age then a mixture model > with age as a covariate seems reasonable. If we observed the same subjects as > children and later as adults then we should be able to describe the age related > shift in the probability of being a 'responder' or a 'non-responder'. > > It is this kind of situation that I tried to describe using the NM-TRAN code. > > 2. NONMEM is a particular implementation of a method for describing and estimating the parameters of mixture model. It seems that NONMEM may only have a rather simple view of mixtures i.e. an individual always belongs to the same distribution and this cannot change. > > I am not sure yet if it is true that NONMEM assumes a fixed (life long) within > subject assignment to a distribution but I dont see any a priori reason why an > individual should not shift from one distribution to another (as explained in > the example above). > > Nick > > Leonid Gibiansky wrote: > > > Nick, > > > > I think you are reading it incorrectly. I would guess that for a long-term > > study you may relate > > probability of response to either baseline age or to the end-of-study age, or > > to any other age in > > between, but this value should be one per subject, not one per record. > > Probability of a subject be > > in one group is assigned based on the entire data set for this subject, and not > > extracted from one > > record. Probability of being a responder may depend on age, but it should be 1 > > value for a subject, > > not 1 value for a record. If you want to simulate subject with same covariates > > but different age, > > give them separate IDs. You may need to simulate ETAs separately (if you want > > patients with the same > > random effects but different ages). > > > > I do not have sufficient experience or knowledge of the nonmem code to be more > > assertive. This is my > > guess only, but guess confirmed by a special treatment of a time dependency in > > the $MIX block (as > > you described). > > > > Leonid > > > > Nick Holford wrote: > > > > > Leonid, > > > > > > I dont see why a proportion should not change with time. The documentation for > > > $MIX says this: > > > > > > "Then AGE may be used on the right in $MIX. ... > > > AGE(i) refers to the value of AGE on the i-th. observation record of the > > > individual record." > > > > > > This clearly shows that it was anticipated that one might wish to use AGE from > > > any observation record in the individual record. If the records represent a > > > time series (which is 100% necessary if AGE varies!) then this implies that a > > > time varying covariate can be used to model the mixing probability. > > > > > > In my example I propose that the probability of being a responder changes with > > > age. E.g. children tend to respond to amphetamine like drugs by being less > > > active while adults tend to be stimulated. > > > > > > This seems like a very plausible way to describe the response in a population. > > > I dont think there is any a priori reason why there should not be a within > > > subject variation in a mixing fraction. > > > > > > My view of a mixing fraction is that it is a substitute for a missing > > > covariate. If one has a time varying covariate then the mixing fraction would > > > be time varying. In the example proposed in the NONMEM help the covariate > > > proposed for use in $MIX is AGE. If AGE is properly recorded in the data set > > > then AGE is guaranteed to be a time varying covariate! > > > > > > Nick > > > > > > Leonid Gibiansky wrote: > > > > > > > Nick, > > > > I am not sure that the entire idea is correct: subject can only belong to one > > > > population, it cannot > > > > jump from population to population. Therefore, time dependent P() should not be > > > > allowed. > > > > Record-number dependence in $MIX was probably invented to have an option of > > > > defining the Ps either > > > > by the baseline values, or by the values at the end of the study, but not for > > > > time-dependence. This > > > > could explains differences with the PK block approach. > > > > Thanks > > > > Leonid > > > > > > > > > First question: Why is the proportion of simulated subjects different from > > > > what I expected? It > > > > seems like all the values are being simulated with AGE=50 instead of AGE=0. > > > > > > > > > > Second question: More generally, if we used AGE in other subroutines (e.g. > > > > $PK, $PRED) then AGE > > > > would change depending on the value in the current event record. Why doesn't > > > > this happen with $MIX? > > > > > > > > > > Third question: Is there a way to know the index of the observation record > > > > that is being used by > > > > $MIX? If I wanted to use AGE like I do in $PK it seems I must give the index of > > > > the current > > > > observation record. > > > > > > > > Nick Holford wrote: > > > > > > > > > I wonder if someone can explain this item in the online NONMEM help guide for > > > > > $MIX. > > > > > > > > > > $INPUT ... AGE ... > > > > > $CONTR DATA=(AGE) > > > > > Then AGE may be used on the right in $MIX. AGE and AGE(1) both > > > > > refer to the value of AGE on the first observation record of the > > > > > individual record. AGE(i) refers to the value of AGE on the i- > > > > > th. observation record of the individual record. > > > > > > > > > > Assume there are 2 records for each subject like this > > > > > > > > > > ID AGE DV > > > > > 1 0 10.506 > > > > > 1 50 10.331 > > > > > 2 0 10.039 > > > > > 2 50 10.99 > > > > > 3 0 9.3782 > > > > > 3 50 9.9395 > > > > > 4 0 98.438 > > > > > 4 50 99.411 > > > > > 5 0 10.598 > > > > > 5 50 9.6335 > > > > > > > > > > and this code is used to simulate with a different mixing fraction if AGE is > > > > > less than 25 compared with AGE greater than or equal to 25: > > > > > > > > > > $PROB MIX > > > > > $DATA agemix.csv > > > > > $INPUT ID AGE DV > > > > > $SIM (20070730) ONLYSIM NSUB=1 > > > > > $THETA > > > > > 0.25 ; PLT25 25% of young are non-responder > > > > > 0.75 ; PGE25 75% of older are non-responder > > > > > 10 ; NONRESPONDER > > > > > 100 ; RESPONDER > > > > > $OMEGA 0.01 > > > > > $OMEGA 0.1 > > > > > $SIGMA 1 > > > > > > > > > > $PRED > > > > > IF (MIXNUM.EQ.1) THEN ; non-responder > > > > > Y=THETA(3) + ETA(1) + EPS(1) > > > > > ELSE ; responder > > > > > Y=THETA(4) + ETA(2) + EPS(1) > > > > > ENDIF > > > > > > > > > > $CONTR DATA=(AGE) > > > > > $MIX > > > > > NSPOP=2 > > > > > IF (AGE.LT.25) THEN > > > > > P(1)=THETA(1) ; young non-responder > > > > > P(2)=1-THETA(1) > > > > > ELSE > > > > > P(1)=THETA(2) ; older non-responder > > > > > P(2)=1-THETA(2) > > > > > ENDIF > > > > > > > > > > $TABLE ID AGE DV > > > > > NOAPPEND NOPRINT ONEHEADER FILE=agemix.fit > > > > > > > > > > I choose to define a response > 50 as a responder and <=50 as a non-responder. > > > > > The simulated DV values (10,000 subjects) had 75% of non-responders (with the > > > > > same proportion at both ages). I had expected 25% because AGE in $MIX is > > > > > supposed to be the AGE on the first obs record i.e. AGE=0. I got identical > > > > > results with NONMEM VI and NONMEM V. > > > > > > > > > > First question: Why is the proportion of simulated subjects different from what > > > > > I expected? It seems like all the values are being simulated with AGE=50 > > > > > instead of AGE=0. > > > > > > > > > > Second question: More generally, if we used AGE in other subroutines (e.g. > > > > > $PK, $PRED) then AGE would change depending on the value in the current event > > > > > record. Why doesn't this happen with $MIX? > > > > > > > > > > Third question: Is there a way to know the index of the observation record that > > > > > is being used by $MIX? If I wanted to use AGE like I do in $PK it seems I must > > > > > give the index of the current observation record. > > > > > > > > > > Nick > > > > > > > > > > -- > > > > > Nick Holford, Dept Pharmacology & Clinical Pharmacology > > > > > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > > > > > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > > > > www.health.auckland.ac.nz/pharmacology/staff/nholford > > > > > > -- > > > Nick Holford, Dept Pharmacology & Clinical Pharmacology > > > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > > > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > > www.health.auckland.ac.nz/pharmacology/staff/nholford > > -- > Nick Holford, Dept Pharmacology & Clinical Pharmacology > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > www.health.auckland.ac.nz/pharmacology/staff/nholford

Re: $MIX and $CONTR

From: Erik Olofsen Date: July 31, 2007 technical
Dear Nick, According to the online manual of ROCM1, the DATA matrix, which is used in your example to store AGE, changes with each individual record (so not with each data record of each individual record). With the statement "PRINT *, ICALL, DATA(1,1), DATA(2,1) added to the $MIX code, one may observe that the DATA matrix indeed contains AGE as is described according to the $MIX help (AGE(i) is translated to DATA(i,1) by NM-TRAN.) Therefore, the mixture probabilities may depend on the age data, but only such that each P(.) has one value for each individual. But: it seems that with ICALL=4 (during simulation) the DATA matrix does not hold AGE as described, while with ICALL=2 it does; one may observe this by removing the ONLYSIM option of the $SIMULATION record... Best regards, Erik
Quoted reply history
On Tue, 2007-07-31 at 16:10 +1200, Nick Holford wrote: > Leonid, > > The model you propose is based on the response variable being a binary > categorical variable - responder or non-responder. Such a likelihood based > model is straightforward and can easily use age or other time varying > covariates to help make the prediction. > > But the problem I am proposing is based on a continuous scale observation -- > it is not categorical and I do not want to waste information by making some > kind of categories out of the continuous variable. > > You do not describe why "the mixture model is not an appropriate tool to > describe this model". You also say "The biological problem that you describe > simply does not fit in the framework of the mixture model". You just say it > isn't appropriate or does not fit the framework but don't give any reasons > for your assertions. > > I would be interested in you trying to describe exactly why the biological > problem I proposed is not suitable for a mixture model. > > Nick > > Leonid Gibiansky wrote: > > > > Hi Nick, > > I fully agree with #1. It is a very reasonable model biologically, but the > > mixture model is not an > > appropriate tool to describe this model. You may want to describe it with > > the different procedure: > > describe probability (not jump, but continuous function of age or something > > else) of being a > > responder, and on top of it define different conditional probability of a > > response for responders > > and non responders. > > > > P(AGE): probability of being a responder > > > > Presp: probability of response for responders > > Pnresp: probability of response for non-responders > > > > Y=P*Presp+(1-P)Pnresp > > > > Of course, each of P, Presp, Pnresp should be expressed via THETAs, ETAs, > > whatever we need; may > > depend on gene expression if you like. > > > > I am not sure that I agree with #2: this is not a nonmem implementation > > deficiency. The biological > > problem that you describe simply does not fit in the framework of the > > mixture model, it should be > > described differently, may be as above (this was only a quick sketch, may > > not work for you), may be > > in a more complicated way, but not as a mixture model. > > > > Alternatively, you may assign different IDs to the same subject at age 10 > > and 50 (it is naive to > > expect that we stay unchanged for a lifetime): if the person changes so > > much that it jumps from > > responders to non-responders, you may expect other changes as well. > > > > Please, let us know if you come up with NONMEM description of your problem. > > > > Leonid > > > > Nick Holford wrote: > > > Leonid, > > > > > > Thanks for your thoughtful comments. > > > > > > I think there are two things to keep separate: > > > > > > 1. Imagine a drug response can be described by a bi-modal distribution > > > when one examines a sample of subjects who are all children. A mixture > > > model can be used to identify the parameters of this mixed distribution. > > > One can then categorize people as being more likely to be in distribution > > > ('responders') than in the other distribution ('non-responders'). > > > > > > Supposing that we now observe that in a different sample of older > > > subjects that the mixing probability is different but the two > > > distributions have similar parameters. We would therefore conclude that > > > the mixing probability changes with age. > > > > > > The underlying basis for the distinction between responder and > > > non-responder may be due to the expression of a gene. The expression of > > > some genes is well known to vary during human development. Imagine that > > > this gene is either turned on ('responder') or is turned off > > > ('non-responder'). This would be a biological explanation of the age > > > dependence of the mixing parameter. If the genotype is unknown then we > > > would need to use a mixture model to try to decide which genotype is most > > > likely in an individual. But because the probability of expression of the > > > gene is also unknown but varies with age then a mixture model with age as > > > a covariate seems reasonable. If we observed the same subjects as > > > children and later as adults then we should be able to describe the age > > > related shift in the probability of being a 'responder' or a > > > 'non-responder'. > > > > > > It is this kind of situation that I tried to describe using the NM-TRAN > > > code. > > > > > > 2. NONMEM is a particular implementation of a method for describing and > > > estimating the parameters of mixture model. It seems that NONMEM may only > > > have a rather simple view of mixtures i.e. an individual always belongs > > > to the same distribution and this cannot change. > > > > > > I am not sure yet if it is true that NONMEM assumes a fixed (life long) > > > within subject assignment to a distribution but I dont see any a priori > > > reason why an individual should not shift from one distribution to > > > another (as explained in the example above). > > > > > > Nick > > > > > > Leonid Gibiansky wrote: > > >> Nick, > > >> > > >> I think you are reading it incorrectly. I would guess that for a > > >> long-term study you may relate > > >> probability of response to either baseline age or to the end-of-study > > >> age, or to any other age in > > >> between, but this value should be one per subject, not one per record. > > >> Probability of a subject be > > >> in one group is assigned based on the entire data set for this subject, > > >> and not extracted from one > > >> record. Probability of being a responder may depend on age, but it > > >> should be 1 value for a subject, > > >> not 1 value for a record. If you want to simulate subject with same > > >> covariates but different age, > > >> give them separate IDs. You may need to simulate ETAs separately (if you > > >> want patients with the same > > >> random effects but different ages). > > >> > > >> I do not have sufficient experience or knowledge of the nonmem code to > > >> be more assertive. This is my > > >> guess only, but guess confirmed by a special treatment of a time > > >> dependency in the $MIX block (as > > >> you described). > > >> > > >> Leonid > > >> > > >> Nick Holford wrote: > > >>> Leonid, > > >>> > > >>> I dont see why a proportion should not change with time. The > > >>> documentation for $MIX says this: > > >>> > > >>> "Then AGE may be used on the right in $MIX. ... > > >>> AGE(i) refers to the value of AGE on the i-th. observation record of > > >>> the individual record." > > >>> > > >>> This clearly shows that it was anticipated that one might wish to use > > >>> AGE from any observation record in the individual record. If the > > >>> records represent a time series (which is 100% necessary if AGE > > >>> varies!) then this implies that a time varying covariate can be used to > > >>> model the mixing probability. > > >>> > > >>> In my example I propose that the probability of being a responder > > >>> changes with age. E.g. children tend to respond to amphetamine like > > >>> drugs by being less active while adults tend to be stimulated. > > >>> > > >>> This seems like a very plausible way to describe the response in a > > >>> population. I dont think there is any a priori reason why there should > > >>> not be a within subject variation in a mixing fraction. > > >>> > > >>> My view of a mixing fraction is that it is a substitute for a missing > > >>> covariate. If one has a time varying covariate then the mixing fraction > > >>> would be time varying. In the example proposed in the NONMEM help the > > >>> covariate proposed for use in $MIX is AGE. If AGE is properly recorded > > >>> in the data set then AGE is guaranteed to be a time varying covariate! > > >>> > > >>> Nick > > >>> > > >>> Leonid Gibiansky wrote: > > >>>> Nick, > > >>>> I am not sure that the entire idea is correct: subject can only belong > > >>>> to one population, it cannot > > >>>> jump from population to population. Therefore, time dependent P() > > >>>> should not be allowed. > > >>>> Record-number dependence in $MIX was probably invented to have an > > >>>> option of defining the Ps either > > >>>> by the baseline values, or by the values at the end of the study, but > > >>>> not for time-dependence. This > > >>>> could explains differences with the PK block approach. > > >>>> Thanks > > >>>> Leonid > > >>>> > > >>>> > First question: Why is the proportion of simulated subjects > > >>>> different from what I expected? It > > >>>> seems like all the values are being simulated with AGE=50 instead of > > >>>> AGE=0. > > >>>> > > > >>>> > Second question: More generally, if we used AGE in other > > >>>> subroutines (e.g. $PK, $PRED) then AGE > > >>>> would change depending on the value in the current event record. Why > > >>>> doesn't this happen with $MIX? > > >>>> > > > >>>> > Third question: Is there a way to know the index of the observation > > >>>> record that is being used by > > >>>> $MIX? If I wanted to use AGE like I do in $PK it seems I must give the > > >>>> index of the current > > >>>> observation record. > > >>>> > > >>>> Nick Holford wrote: > > >>>>> I wonder if someone can explain this item in the online NONMEM help > > >>>>> guide for $MIX. > > >>>>> > > >>>>> $INPUT ... AGE ... > > >>>>> $CONTR DATA=(AGE) > > >>>>> Then AGE may be used on the right in $MIX. AGE and AGE(1) > > >>>>> both > > >>>>> refer to the value of AGE on the first observation record of > > >>>>> the > > >>>>> individual record. AGE(i) refers to the value of AGE on the > > >>>>> i- > > >>>>> th. observation record of the individual record. > > >>>>> > > >>>>> Assume there are 2 records for each subject like this > > >>>>> > > >>>>> ID AGE DV > > >>>>> 1 0 10.506 > > >>>>> 1 50 10.331 > > >>>>> 2 0 10.039 > > >>>>> 2 50 10.99 > > >>>>> 3 0 9.3782 > > >>>>> 3 50 9.9395 > > >>>>> 4 0 98.438 > > >>>>> 4 50 99.411 > > >>>>> 5 0 10.598 > > >>>>> 5 50 9.6335 > > >>>>> > > >>>>> and this code is used to simulate with a different mixing fraction if > > >>>>> AGE is less than 25 compared with AGE greater than or equal to 25: > > >>>>> > > >>>>> $PROB MIX > > >>>>> $DATA agemix.csv > > >>>>> $INPUT ID AGE DV > > >>>>> $SIM (20070730) ONLYSIM NSUB=1 > > >>>>> $THETA > > >>>>> 0.25 ; PLT25 25% of young are non-responder > > >>>>> 0.75 ; PGE25 75% of older are non-responder > > >>>>> 10 ; NONRESPONDER > > >>>>> 100 ; RESPONDER > > >>>>> $OMEGA 0.01 > > >>>>> $OMEGA 0.1 > > >>>>> $SIGMA 1 > > >>>>> > > >>>>> $PRED > > >>>>> IF (MIXNUM.EQ.1) THEN ; non-responder > > >>>>> Y=THETA(3) + ETA(1) + EPS(1) > > >>>>> ELSE ; responder > > >>>>> Y=THETA(4) + ETA(2) + EPS(1) > > >>>>> ENDIF > > >>>>> > > >>>>> $CONTR DATA=(AGE) > > >>>>> $MIX > > >>>>> NSPOP=2 > > >>>>> IF (AGE.LT.25) THEN > > >>>>> P(1)=THETA(1) ; young non-responder > > >>>>> P(2)=1-THETA(1) > > >>>>> ELSE > > >>>>> P(1)=THETA(2) ; older non-responder > > >>>>> P(2)=1-THETA(2) > > >>>>> ENDIF > > >>>>> > > >>>>> $TABLE ID AGE DV > > >>>>> NOAPPEND NOPRINT ONEHEADER FILE=agemix.fit > > >>>>> > > >>>>> I choose to define a response > 50 as a responder and <=50 as a > > >>>>> non-responder. > > >>>>> The simulated DV values (10,000 subjects) had 75% of non-responders > > >>>>> (with the same proportion at both ages). I had expected 25% because > > >>>>> AGE in $MIX is supposed to be the AGE on the first obs record i.e. > > >>>>> AGE=0. I got identical results with NONMEM VI and NONMEM V. > > >>>>> > > >>>>> First question: Why is the proportion of simulated subjects different > > >>>>> from what I expected? It seems like all the values are being > > >>>>> simulated with AGE=50 instead of AGE=0. > > >>>>> > > >>>>> Second question: More generally, if we used AGE in other subroutines > > >>>>> (e.g. $PK, $PRED) then AGE would change depending on the value in the > > >>>>> current event record. Why doesn't this happen with $MIX? > > >>>>> > > >>>>> Third question: Is there a way to know the index of the observation > > >>>>> record that is being used by $MIX? If I wanted to use AGE like I do > > >>>>> in $PK it seems I must give the index of the current observation > > >>>>> record. > > >>>>> > > >>>>> Nick > > >>>>> > > >>>>> -- > > >>>>> Nick Holford, Dept Pharmacology & Clinical Pharmacology > > >>>>> University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New > > >>>>> Zealand > > >>>>> [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > >>>>> www.health.auckland.ac.nz/pharmacology/staff/nholford > > >>>>> > > >>>>> > > >>> -- > > >>> Nick Holford, Dept Pharmacology & Clinical Pharmacology > > >>> University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New > > >>> Zealand > > >>> [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > >>> www.health.auckland.ac.nz/pharmacology/staff/nholford > > >>> > > >>> > > > > > > -- > > > Nick Holford, Dept Pharmacology & Clinical Pharmacology > > > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New > > > Zealand > > > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > > www.health.auckland.ac.nz/pharmacology/staff/nholford > > > > > > > > -- > Nick Holford, Dept Pharmacology & Clinical Pharmacology > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > www.health.auckland.ac.nz/pharmacology/staff/nholford

RE: $MIX and $CONTR

From: Thomas Ludden Date: July 31, 2007 technical
The following is a general description of NONMEM's mixture model feature. During each iteration, after fitting each submodel to an individual's data, the most probable subpopulation is selected as the one with the maximum product of "likelihood" X prior where "likelihood" is an ofv for the individual and the subpopulation and prior is the current value of P(i) for a subpopulation. At termination of the search the most probable subpopulation for a given individual from the last iteration is assigned to that individual. Thus, an individual can only belong to one subpopulation with this implementation of mixture models. With simulation, a subpopulation is first chosen based on a uniform random variable, 0 - 1, and the vector of P(i) values and this submodel is used to simulate for that individual. As in Nick Holford's example, P(i) can be a function of covariates but not time-varying covariates. For simulation or estimation, the MIX subroutine is called only once per individual record, not with each observation or data record. There is a bug in the simulation routine (both NONMEM V and VI) that results in DATA(1,.) containing the last observation record of the individual record instead of the first when the MIX routine is called for simulation, as reported by Nick Holford. This is a problem only if the first and last observation records of an individual record do not contain the same value(s) for the covariate(s) made available to MIX by the $DATA statement in the control stream. The fix requires several changes. We will provide the code changes to Metrum so that they can add these changes to the next release of NMQUAL and will place a fixed subroutine on our ftp site in the next day or two. We will delay for a few days issuing a more formal bug alert because we are working on two other issues that we would like to include in that alert. Thanks to Nick Holford for bringing this bug to our attention and for providing an example that facilitated the debugging procedure and to Alison Boeckmann for very quickly identifying the specific part of the NONMEM code that was responsible. Tom Ludden
Quoted reply history
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nick Holford Sent: Tuesday, July 31, 2007 6:29 AM To: nmusers Subject: Re: [NMusers] $MIX and $CONTR Erik, Thanks for your detective work. It does seem like there is a problem with simulation because AGE is not provided to $MIX as described in the NONMEM documentation i.e. AGE should be the AGE on the first observation record. Nick "Olofsen, E. (ANST)" wrote: > > Dear Nick, > > According to the online manual of ROCM1, the DATA matrix, which is used > in your example to store AGE, changes with each individual record (so > not with each data record of each individual record). > > With the statement > > "PRINT *, ICALL, DATA(1,1), DATA(2,1) > > added to the $MIX code, one may observe that the DATA matrix indeed > contains AGE as is described according to the $MIX help (AGE(i) is > translated to DATA(i,1) by NM-TRAN.) Therefore, the mixture > probabilities may depend on the age data, but only such that each P(.) > has one value for each individual. > > But: it seems that with ICALL=4 (during simulation) the DATA matrix does > not hold AGE as described, while with ICALL=2 it does; one may observe > this by removing the ONLYSIM option of the $SIMULATION record... > > Best regards, > > Erik > > On Tue, 2007-07-31 at 16:10 +1200, Nick Holford wrote: > > Leonid, > > > > The model you propose is based on the response variable being a binary categorical variable - responder or non-responder. Such a likelihood based model is straightforward and can easily use age or other time varying covariates to help make the prediction. > > > > But the problem I am proposing is based on a continuous scale observation -- it is not categorical and I do not want to waste information by making some kind of categories out of the continuous variable. > > > > You do not describe why "the mixture model is not an appropriate tool to describe this model". You also say "The biological problem that you describe simply does not fit in the framework of the mixture model". You just say it isn't appropriate or does not fit the framework but don't give any reasons for your assertions. > > > > I would be interested in you trying to describe exactly why the biological problem I proposed is not suitable for a mixture model. > > > > Nick > > > > Leonid Gibiansky wrote: > > > > > > Hi Nick, > > > I fully agree with #1. It is a very reasonable model biologically, but the mixture model is not an > > > appropriate tool to describe this model. You may want to describe it with the different procedure: > > > describe probability (not jump, but continuous function of age or something else) of being a > > > responder, and on top of it define different conditional probability of a response for responders > > > and non responders. > > > > > > P(AGE): probability of being a responder > > > > > > Presp: probability of response for responders > > > Pnresp: probability of response for non-responders > > > > > > Y=P*Presp+(1-P)Pnresp > > > > > > Of course, each of P, Presp, Pnresp should be expressed via THETAs, ETAs, whatever we need; may > > > depend on gene expression if you like. > > > > > > I am not sure that I agree with #2: this is not a nonmem implementation deficiency. The biological > > > problem that you describe simply does not fit in the framework of the mixture model, it should be > > > described differently, may be as above (this was only a quick sketch, may not work for you), may be > > > in a more complicated way, but not as a mixture model. > > > > > > Alternatively, you may assign different IDs to the same subject at age 10 and 50 (it is naive to > > > expect that we stay unchanged for a lifetime): if the person changes so much that it jumps from > > > responders to non-responders, you may expect other changes as well. > > > > > > Please, let us know if you come up with NONMEM description of your problem. > > > > > > Leonid > > > > > > Nick Holford wrote: > > > > Leonid, > > > > > > > > Thanks for your thoughtful comments. > > > > > > > > I think there are two things to keep separate: > > > > > > > > 1. Imagine a drug response can be described by a bi-modal distribution when one examines a sample of subjects who are all children. A mixture model can be used to identify the parameters of this mixed distribution. One can then categorize people as being more likely to be in distribution ('responders') than in the other distribution ('non-responders'). > > > > > > > > Supposing that we now observe that in a different sample of older subjects that the mixing probability is different but the two distributions have similar parameters. We would therefore conclude that the mixing probability changes with age. > > > > > > > > The underlying basis for the distinction between responder and non-responder may be due to the expression of a gene. The expression of some genes is well known to vary during human development. Imagine that this gene is either turned on ('responder') or is turned off ('non-responder'). This would be a biological explanation of the age dependence of the mixing parameter. If the genotype is unknown then we would need to use a mixture model to try to decide which genotype is most likely in an individual. But because the probability of expression of the gene is also unknown but varies with age then a mixture model with age as a covariate seems reasonable. If we observed the same subjects as children and later as adults then we should be able to describe the age related shift in the probability of being a 'responder' or a 'non-responder'. > > > > > > > > It is this kind of situation that I tried to describe using the NM-TRAN code. > > > > > > > > 2. NONMEM is a particular implementation of a method for describing and estimating the parameters of mixture model. It seems that NONMEM may only have a rather simple view of mixtures i.e. an individual always belongs to the same distribution and this cannot change. > > > > > > > > I am not sure yet if it is true that NONMEM assumes a fixed (life long) within subject assignment to a distribution but I dont see any a priori reason why an individual should not shift from one distribution to another (as explained in the example above). > > > > > > > > Nick > > > > > > > > Leonid Gibiansky wrote: > > > >> Nick, > > > >> > > > >> I think you are reading it incorrectly. I would guess that for a long-term study you may relate > > > >> probability of response to either baseline age or to the end-of-study age, or to any other age in > > > >> between, but this value should be one per subject, not one per record. Probability of a subject be > > > >> in one group is assigned based on the entire data set for this subject, and not extracted from one > > > >> record. Probability of being a responder may depend on age, but it should be 1 value for a subject, > > > >> not 1 value for a record. If you want to simulate subject with same covariates but different age, > > > >> give them separate IDs. You may need to simulate ETAs separately (if you want patients with the same > > > >> random effects but different ages). > > > >> > > > >> I do not have sufficient experience or knowledge of the nonmem code to be more assertive. This is my > > > >> guess only, but guess confirmed by a special treatment of a time dependency in the $MIX block (as > > > >> you described). > > > >> > > > >> Leonid > > > >> > > > >> Nick Holford wrote: > > > >>> Leonid, > > > >>> > > > >>> I dont see why a proportion should not change with time. The documentation for $MIX says this: > > > >>> > > > >>> "Then AGE may be used on the right in $MIX. ... > > > >>> AGE(i) refers to the value of AGE on the i-th. observation record of the individual record." > > > >>> > > > >>> This clearly shows that it was anticipated that one might wish to use AGE from any observation record in the individual record. If the records represent a time series (which is 100% necessary if AGE varies!) then this implies that a time varying covariate can be used to model the mixing probability. > > > >>> > > > >>> In my example I propose that the probability of being a responder changes with age. E.g. children tend to respond to amphetamine like drugs by being less active while adults tend to be stimulated. > > > >>> > > > >>> This seems like a very plausible way to describe the response in a population. I dont think there is any a priori reason why there should not be a within subject variation in a mixing fraction. > > > >>> > > > >>> My view of a mixing fraction is that it is a substitute for a missing covariate. If one has a time varying covariate then the mixing fraction would be time varying. In the example proposed in the NONMEM help the covariate proposed for use in $MIX is AGE. If AGE is properly recorded in the data set then AGE is guaranteed to be a time varying covariate! > > > >>> > > > >>> Nick > > > >>> > > > >>> Leonid Gibiansky wrote: > > > >>>> Nick, > > > >>>> I am not sure that the entire idea is correct: subject can only belong to one population, it cannot > > > >>>> jump from population to population. Therefore, time dependent P() should not be allowed. > > > >>>> Record-number dependence in $MIX was probably invented to have an option of defining the Ps either > > > >>>> by the baseline values, or by the values at the end of the study, but not for time-dependence. This > > > >>>> could explains differences with the PK block approach. > > > >>>> Thanks > > > >>>> Leonid > > > >>>> > > > >>>> > First question: Why is the proportion of simulated subjects different from what I expected? It > > > >>>> seems like all the values are being simulated with AGE=50 instead of AGE=0. > > > >>>> > > > > >>>> > Second question: More generally, if we used AGE in other subroutines (e.g. $PK, $PRED) then AGE > > > >>>> would change depending on the value in the current event record. Why doesn't this happen with $MIX? > > > >>>> > > > > >>>> > Third question: Is there a way to know the index of the observation record that is being used by > > > >>>> $MIX? If I wanted to use AGE like I do in $PK it seems I must give the index of the current > > > >>>> observation record. > > > >>>> > > > >>>> Nick Holford wrote: > > > >>>>> I wonder if someone can explain this item in the online NONMEM help guide for $MIX. > > > >>>>> > > > >>>>> $INPUT ... AGE ... > > > >>>>> $CONTR DATA=(AGE) > > > >>>>> Then AGE may be used on the right in $MIX. AGE and AGE(1) both > > > >>>>> refer to the value of AGE on the first observation record of the > > > >>>>> individual record. AGE(i) refers to the value of AGE on the i- > > > >>>>> th. observation record of the individual record. > > > >>>>> > > > >>>>> Assume there are 2 records for each subject like this > > > >>>>> > > > >>>>> ID AGE DV > > > >>>>> 1 0 10.506 > > > >>>>> 1 50 10.331 > > > >>>>> 2 0 10.039 > > > >>>>> 2 50 10.99 > > > >>>>> 3 0 9.3782 > > > >>>>> 3 50 9.9395 > > > >>>>> 4 0 98.438 > > > >>>>> 4 50 99.411 > > > >>>>> 5 0 10.598 > > > >>>>> 5 50 9.6335 > > > >>>>> > > > >>>>> and this code is used to simulate with a different mixing fraction if AGE is less than 25 compared with AGE greater than or equal to 25: > > > >>>>> > > > >>>>> $PROB MIX > > > >>>>> $DATA agemix.csv > > > >>>>> $INPUT ID AGE DV > > > >>>>> $SIM (20070730) ONLYSIM NSUB=1 > > > >>>>> $THETA > > > >>>>> 0.25 ; PLT25 25% of young are non-responder > > > >>>>> 0.75 ; PGE25 75% of older are non-responder > > > >>>>> 10 ; NONRESPONDER > > > >>>>> 100 ; RESPONDER > > > >>>>> $OMEGA 0.01 > > > >>>>> $OMEGA 0.1 > > > >>>>> $SIGMA 1 > > > >>>>> > > > >>>>> $PRED > > > >>>>> IF (MIXNUM.EQ.1) THEN ; non-responder > > > >>>>> Y=THETA(3) + ETA(1) + EPS(1) > > > >>>>> ELSE ; responder > > > >>>>> Y=THETA(4) + ETA(2) + EPS(1) > > > >>>>> ENDIF > > > >>>>> > > > >>>>> $CONTR DATA=(AGE) > > > >>>>> $MIX > > > >>>>> NSPOP=2 > > > >>>>> IF (AGE.LT.25) THEN > > > >>>>> P(1)=THETA(1) ; young non-responder > > > >>>>> P(2)=1-THETA(1) > > > >>>>> ELSE > > > >>>>> P(1)=THETA(2) ; older non-responder > > > >>>>> P(2)=1-THETA(2) > > > >>>>> ENDIF > > > >>>>> > > > >>>>> $TABLE ID AGE DV > > > >>>>> NOAPPEND NOPRINT ONEHEADER FILE=agemix.fit > > > >>>>> > > > >>>>> I choose to define a response > 50 as a responder and <=50 as a non-responder. > > > >>>>> The simulated DV values (10,000 subjects) had 75% of non-responders (with the same proportion at both ages). I had expected 25% because AGE in $MIX is supposed to be the AGE on the first obs record i.e. AGE=0. I got identical results with NONMEM VI and NONMEM V. > > > >>>>> > > > >>>>> First question: Why is the proportion of simulated subjects different from what I expected? It seems like all the values are being simulated with AGE=50 instead of AGE=0. > > > >>>>> > > > >>>>> Second question: More generally, if we used AGE in other subroutines (e.g. $PK, $PRED) then AGE would change depending on the value in the current event record. Why doesn't this happen with $MIX? > > > >>>>> > > > >>>>> Third question: Is there a way to know the index of the observation record that is being used by $MIX? If I wanted to use AGE like I do in $PK it seems I must give the index of the current observation record. > > > >>>>> > > > >>>>> Nick > > > >>>>> > > > >>>>> -- > > > >>>>> Nick Holford, Dept Pharmacology & Clinical Pharmacology > > > >>>>> University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > > > >>>>> [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > > >>>>> www.health.auckland.ac.nz/pharmacology/staff/nholford > > > >>>>> > > > >>>>> > > > >>> -- > > > >>> Nick Holford, Dept Pharmacology & Clinical Pharmacology > > > >>> University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > > > >>> [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > > >>> www.health.auckland.ac.nz/pharmacology/staff/nholford > > > >>> > > > >>> > > > > > > > > -- > > > > Nick Holford, Dept Pharmacology & Clinical Pharmacology > > > > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > > > > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > > > www.health.auckland.ac.nz/pharmacology/staff/nholford > > > > > > > > > > > > -- > > Nick Holford, Dept Pharmacology & Clinical Pharmacology > > University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand > > [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 > > www.health.auckland.ac.nz/pharmacology/staff/nholford -- Nick Holford, Dept Pharmacology & Clinical Pharmacology University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand [EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:+64(9)373-7090 www.health.auckland.ac.nz/pharmacology/staff/nholford _______________________________________________________________________________________________________________________________