Dear Jeroen, Jakob, Philip & all
Many thanks for sharing your insights & responses. Thanks, Santosh On Sun, Feb 25, 2024 at 6:14 PM Philip Harder Delff <phi...@delff.dk> 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 > > jakob.ribb...@pharmetheus.com > > > > 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 <santosh2...@gmail.com> 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/ > >.// > > / >