NONMEM related implementation question

5 messages 4 people Latest: Feb 28, 2024

NONMEM related implementation question

From: Santosh Date: February 25, 2024 technical
Hi, I am familiar with the classic estimation/simulation methodology, wherein predicted values (of DV, for example) are obtained after applying estimation ($ESTIMATION) followed by simulation ($SIMULATION) .... Is there a way to use an input NM dataset (having inserted longitudinal records with blank DV ( EVID=2) such that non-missing DV records are used for estimation and predicted DV values are generated for all EVID (including EVID=2) records with only $ESTIMATION method? TIA Santosh
Hi Santosh, The prediction (PRED/IPRED) is supplied by the $TABLE step for all records, whether EVID=0 or EVID=2, so I do not understand your question as such. Perhaps you can share model code and a dataset stub for us to help you better? Jeroen http://pd-value.com [email protected] @PD_value +31 6 23118438 -- More value out of your data!
Quoted reply history
On 25-02-2024 21:41, Santosh wrote: > Hi, > > I am familiar with the classic estimation/simulation methodology, wherein predicted values (of DV, for example) are obtained after applying estimation ($ESTIMATION) followed by simulation ($SIMULATION) .... > > Is there a way to use an input NM dataset (having inserted longitudinal records with blank DV ( EVID=2) such that non-missing DV records are used for estimation and predicted DV values are generated for all EVID (including EVID=2) records with only $ESTIMATION method? > > TIA > Santosh

Re: NONMEM related implementation question

From: Jakob Ribbing Date: February 25, 2024 technical
Hi Santosh, Yes, with your setup, having EVID=2 records with e.g. DV=“.” for missing: the $TABLE output would per default include both the EVID=0 (observation) and EVID=2 (to obtain predictions) records. So if you output (in table file) IPRED or e.g. CIPREDI, these could contain predictions for both types of records. Best regards Jakob Jakob Ribbing, Ph.D. Principal Consultant, Pharmetheus AB Cell/Mobile: +46 (0)70 514 33 77 [email protected] www.pharmetheus.com Phone, Office: +46 (0)18 513 328 Uppsala Science Park, Dag Hammarskjölds väg 36B SE-752 37 Uppsala, Sweden
Quoted reply history
> On 25 Feb 2024, at 21:41, Santosh <[email protected]> wrote: > > Hi, > > I am familiar with the classic estimation/simulation methodology, wherein > predicted values (of DV, for example) are obtained after applying estimation > ($ESTIMATION) followed by simulation ($SIMULATION) .... > > > Is there a way to use an input NM dataset (having inserted longitudinal > records with blank DV ( EVID=2) such that non-missing DV records are used for > estimation and predicted DV values are generated for all EVID (including > EVID=2) records with only $ESTIMATION method? > > > TIA > Santosh > > -- *This communication is confidential and is only intended for the use of the individual or entity to which it is directed. It may contain information that is privileged and exempt from disclosure under applicable law. If you are not the intended recipient please notify us immediately. Please do not copy it or disclose its contents to any other person.* *Any personal data will be processed in accordance with Pharmetheus' privacy notice, available here https://pharmetheus.com/privacy-policy/.** *

Re: NONMEM related implementation question

From: Philip Harder Delff Date: February 26, 2024 technical
Hi Santosh, While this is not a direct answer to your question, you may be interested in using NMsim to do the simulation from R. NMsim calls Nonmem to do the actual simulation so you need Nonmem on the same system as where you run R. With the recent version 0.1.0 NMsim runs on Windows as well as Linux/Unix systems. You must know the location of the Nonmem executable for this to work. See help on the website in the link below. If using NMsim, you would estimate your model first (with or without EVID=2 records doesn´t matter), and then you run NMsim() with a simulation data set on the estimation control stream: simres <- NMsim(file.mod="path/to/your/control_stream.mod",data="df.sim") df.sim must be a data.frame with ID and other columns needed by Nonmem. This could be EVID, TIME, AMT, etc. for ADVAN-type models. NMsim will then create a new control stream tailored to your df.sim but with $SIMULATION instead of $ESTIMATION, and with updated parameter values from your estimate, save df.sim with that new simulation control stream, run Nonmem on it. Finally, it will collect the resulting data and combine it with the input data. "simres" is your complete simulation results data set. The code above will simulate new subjects. In your case, you want to reuse emperical base estimates for your simulation, so you can use the provided "NMsim_known()" function for that: simres <- NMsim(file.mod="path/to/your/control_stream.mod", data="df.sim", method.sim=NMsim_known) Just make sure df.sim contains ID values that match the ID numbers you used in the estimation, and the ETA's will be reused. If you are using SAEM based estimation, you must output the ETA's in your output tables of the estimation control stream for this to work. NMsim also includes functions to help creating the simulation data set (in your case, see ?addEVID2). The advantage of this approach is that you separate the simulation from the estimation process. You can do a wide range of simulations with very little modification to the above code. You can also send the models to a cluster if you have access to one such. See the NMsim website and github page for much more information and vignettes with examples: https://philipdelff.github.io/NMsim/ Best, Philip
Quoted reply history
On 2/25/24 16:08, Jakob Ribbing wrote: > Hi Santosh, > > Yes, with your setup, having EVID=2 records with e.g. DV=“.” for missing: the $TABLE output would per default include both the EVID=0 (observation) and EVID=2 (to obtain predictions) records. So if you output (in table file) IPRED or e.g. CIPREDI, these could contain predictions for both types of records. > > Best regards > > Jakob > > Jakob Ribbing, Ph.D. > > Principal Consultant, Pharmetheus AB > > Cell/Mobile: +46 (0)70 514 33 77 > [email protected] > > www.pharmetheus.com > Phone, Office: +46 (0)18 513 328 > > Uppsala Science Park, DagHammarskjölds väg 36B > SE-752 37 Uppsala, Sweden > > > On 25 Feb 2024, at 21:41, Santosh <[email protected]> wrote: > > > > Hi, > > > > I am familiar with the classic estimation/simulation methodology, wherein predicted values (of DV, for example) are obtained after applying estimation ($ESTIMATION) followed by simulation ($SIMULATION) .... > > > > Is there a way to use an input NM dataset (having inserted longitudinal records with blank DV ( EVID=2) such that non-missing DV records are used for estimation and predicted DV values are generated for all EVID (including EVID=2) records with only $ESTIMATION method? > > > > TIA > > Santosh > > /This communication is confidential and is only intended for the use of the individual or entity to which it is directed. It may contain information that is privileged and exempt from disclosure under applicable law. If you are not the intended recipient please notify us immediately. Please do not copy it or disclose its contents to any other person./ /Any personal data will be processed in accordance with Pharmetheus' privacy notice, available here < https://pharmetheus.com/privacy-policy/ >.// > > /

Re: NONMEM related implementation question

From: Santosh Date: February 28, 2024 technical
Dear Jeroen, Jakob, Philip & all Many thanks for sharing your insights & responses. Thanks, Santosh
Quoted reply history
On Sun, Feb 25, 2024 at 6:14 PM Philip Harder Delff <[email protected]> wrote: > Hi Santosh, > > While this is not a direct answer to your question, you may be > interested in using NMsim to do the simulation from R. NMsim calls > Nonmem to do the actual simulation so you need Nonmem on the same system > as where you run R. With the recent version 0.1.0 NMsim runs on Windows > as well as Linux/Unix systems. You must know the location of the Nonmem > executable for this to work. See help on the website in the link below. > > If using NMsim, you would estimate your model first (with or without > EVID=2 records doesn´t matter), and then you run NMsim() with a > simulation data set on the estimation control stream: > > simres <- NMsim(file.mod="path/to/your/control_stream.mod",data="df.sim") > > df.sim must be a data.frame with ID and other columns needed by Nonmem. > This could be EVID, TIME, AMT, etc. for ADVAN-type models. NMsim will > then create a new control stream tailored to your df.sim but with > $SIMULATION instead of $ESTIMATION, and with updated parameter values > from your estimate, save df.sim with that new simulation control stream, > run Nonmem on it. Finally, it will collect the resulting data and > combine it with the input data. "simres" is your complete simulation > results data set. > > The code above will simulate new subjects. In your case, you want to > reuse emperical base estimates for your simulation, so you can use the > provided "NMsim_known()" function for that: > > simres <- NMsim(file.mod="path/to/your/control_stream.mod", > data="df.sim", > method.sim=NMsim_known) > > Just make sure df.sim contains ID values that match the ID numbers you > used in the estimation, and the ETA's will be reused. If you are using > SAEM based estimation, you must output the ETA's in your output tables > of the estimation control stream for this to work. NMsim also includes > functions to help creating the simulation data set (in your case, see > ?addEVID2). > > The advantage of this approach is that you separate the simulation from > the estimation process. You can do a wide range of simulations with very > little modification to the above code. You can also send the models to a > cluster if you have access to one such. > > See the NMsim website and github page for much more information and > vignettes with examples: > https://philipdelff.github.io/NMsim/ > > Best, > Philip > > On 2/25/24 16:08, Jakob Ribbing wrote: > > Hi Santosh, > > > > Yes, with your setup, having EVID=2 records with e.g. DV=“.” for > > missing: the $TABLE output would per default include both the EVID=0 > > (observation) and EVID=2 (to obtain predictions) records. > > So if you output (in table file) IPRED or e.g. CIPREDI, these could > > contain predictions for both types of records. > > > > Best regards > > > > Jakob > > > > Jakob Ribbing, Ph.D. > > > > Principal Consultant, Pharmetheus AB > > > > > > Cell/Mobile: +46 (0)70 514 33 77 > > [email protected] > > > > www.pharmetheus.com > > Phone, Office: +46 (0)18 513 328 > > > > Uppsala Science Park, DagHammarskjölds väg 36B > > SE-752 37 Uppsala, Sweden > > > > > > > >> On 25 Feb 2024, at 21:41, Santosh <[email protected]> wrote: > >> > >> Hi, > >> > >> I am familiar with the classic estimation/simulation methodology, > >> wherein predicted values (of DV, for example) are obtained after > >> applying estimation ($ESTIMATION) followed by simulation ($SIMULATION) > >> .... > >> > >> > >> Is there a way to use an input NM dataset (having inserted > >> longitudinal records with blank DV ( EVID=2) such that non-missing DV > >> records are used for estimation and predicted DV values are generated > >> for all EVID (including EVID=2) records with only $ESTIMATION method? > >> > >> > >> TIA > >> Santosh > >> > >> > > > > > > /This communication is confidential and is only intended for the use of > > the individual or entity to which it is directed. It may contain > > information that is privileged and exempt from disclosure under > > applicable law. If you are not the intended recipient please notify us > > immediately. Please do not copy it or disclose its contents to any other > > person./ > > /Any personal data will be processed in accordance with Pharmetheus' > > privacy notice, available here https://pharmetheus.com/privacy-policy/ >.// > > / >