NMsim 0.2.5
CRAN release: 2025-09-06
New features
Method to run “typical subject” simulations has been improved and the code has been simplified. This is controlled using the
typicalargument inNMsim(). The basic use of this argument istypical=FALSE(default, not a typical subject simulation) ortypical=TRUE. Iftypical=TRUE,$OMEGAparameters are fixed at zero. If the model hasOMEGAprior parameters$OMEGAPand$OMEGAPD, those are fixed to zero too. Instead of a logical (TRUE/FALSE), a character vector can now be supplied to specify what oarameter types to fix at zero. E.g. to also drop residual variability, usetypical=c("omega","sigma")(remember to add the prior parameter types if needed).A new
NMsim()argumentdir.sim.subcontrols whether a subdirectory is created indir.simsfor Nonmem execution. When usingNMsim()for estimation, it may be more convenient to usedir.sim.sub=FALSEto get all model executions in the same directory.NMcreateDoses()has a new argument,N, allowing for creation of multiple subjects.
Bugfixes
NMsim_NWPRI() in combination with typical=TRUE would fail in some cases. This has been fixed with the new implementation of the typical argument.
Other improvements
NMsim() argument name.sim supports stings with parenthesis.
NMsim 0.2.4
CRAN release: 2025-07-16
New features
NMsim()’s support for handling and control of initial values (theinitsargument) has been greatly improved. In recent versions a new method for reading, updating, and writing the parameter definitions in control streams has been implemented. This allows for modification of this information and for fixing/unfixing parameters. The downside is it comes with some limitations to control stream syntax. With 0.2.4 those limitations are getting rare. The original much simpler method is still available and provides a robust alternative for many simulation purposes and is kept as a fallback workaround.NMsim()’sinitargument supportsextandinits.tabformats. These interfaces to specifying parameter values greatly improves flexibility for programming, and for specifying multiple new parameter sets for series of model runs.NMreadSim()gains theskip.missingargument. In case some model runs fail or haven’t finished, this allowsNMreadSim()to read whatever it can and skip the ones missing.Summary function included on NMsim simulation results. There is still room for improvement - try it out with
summary()on results fromNMsim()andNMreadSim().
Bugfixes
NMREPis a data column thatNMsim()automatically adds to count subproblems whensubproblemis used. This was not added when simulating PREDPP ($PRED) models and when not providing a simulaiton data set (VPC style). Thanks to Ahmed Abulfathi for reporting.In some cases
NMsim_NMWPRI()in combination withtypical=TRUEwould create wrong$PRIORdimensions. Fixed.
Other improvements
NMaddSamples()only insertsMDVcolumn ifMDVis already present indata.NMexec()uses the-maxlim=2option when executing Nonmem. This is implemented on both the internal execution method and when PSN’s execute is used.
NMsim 0.2.3
CRAN release: 2025-05-20
New features
NMaddSamples()gains abyargument. This makesNMaddSamples()easy to use for generation of both nominal sampling schemes and recreation of observed sampling schemes.Streamlining of
NMsim_VarCov()andsamplePars().NMsim_VarCov()now always callssamplePars()internally.samplePars()uses themethodargument to switch betweenmvrnorm(multivariate normal distribution) andsimpar(inverse Wishart distribution.NMsim_VarCov()gainsmethod.sampleargument which is passed asmethodtosamplePars(). This meansNMsim_VarCov()can be used to simulated with parameter uncertainty using eithermvrnormorsimpar.
Messages have been implemented in samplePars() to summarize number of truncations in case mvrnorm results in negative variance parameters.
Bugfixes
NMsim_VarCov() sampling of OMEGA/SIGMA. Affects simulation with between-subject variability. Big thanks to Sanaya Shroff for reporting and fixing.
Other Improvements
- Improved defaults for whether to suppress Nonmem messages (
nmquietargument). Particularly, whenNMsimis not waiting on Nonmem runs, it will by default suppress those messages. Basically, NMsim will now by default only show Nonmem terminal messages if it is waiting, and only one Nonmem model is executed. Notice, thatquiet=TRUEimplies suppressing bothNMsimand Nonmem messages andnmquiet=TRUE.
Other Changes
- The deprecated
addEVID2()is kept as a snapshot of whenNMsamples()was introduced. The newbyargument is not compatible with the default behavior of the deprecatedaddEVID2(). This is to ensure reproducibility of existing code on the user side.
NMsim 0.2.2
CRAN release: 2025-05-06
New features
-
sampleCovs()is a new function to conveniently sample subject-level covariates from an existing data set.
Bugfixes
There was a bug introduced in version 0.2.1 leading
NMsim()to throw an error saving some data sets. The issue is fixed.The default Nonmem
$TABLEformat is insufficient with NMsim’s way to create row counters when simulating 1e5 rows or more. NMsim is now by default using a format with a much higher resolution. Thanks to Sanaya Shroff for helping debugging this.
NMsim 0.2.1
CRAN release: 2025-04-24
New Features
NMaddSamples()replaces theaddEVID2()function.addEVID2()will still work and redirects toNMaddSamples()for backward compatibility. Your existing work will still work but you will get a (suppressable) message about the name change. Especially due to work on optimal sampling withNMsimby Ahmed Abulfathi and myself, we need a more flexible interface for adding samples.NMaddSamples()comes with a new argumentDV. By defaultNMaddSamples()(used to be,addEVID2()) adds rows withoutDVvalues and withEVID=2andMDV=1. IfDVis supplied,NMaddSamples()will include that value in theDVcolumn and by default useEVID=0andMDV=0. An example where this is useful is when generating datasets for$DESIGNwhereDV=0is often used.samplePars()is a new function that replacessampleParsSimpar().samplePars()takes themethodargument which can be used to switch between multivariate normal distributionmethod="mvrnorm"and using thesimparpackage to get use Inverse-Wishart distribution for$OMEGAand$SIGMAparameters. Notice, both methods are fully automated in NMsim - all you need to write is the path to a control stream and the number (nsims) of parameter sets wanted.simPopEtas()by default does not overwrite an existing.phifile.simPopEtas()is used to generate sampledETAs for use in future model simulations with the same synthetic population (ETAs). If the.phifile that stores theETAs gets overwritten using a new seed, it will affect simulations using that.phifile. Overwriting the.phifile with different seeds should therefore be avoided, and this new behavior of protecting the generated.phifiles reduces that risk.
Bugfixes
NMsim_VarCov()would not include$OMEGAand$SIGMAblocks which lead to errors in Nonmem. This bug was likely introduced in NMsim 0.1.6 and has now been fixed.Version 0.2.0 gave some warnings about non-existing columns. The warnings are benign and can be safely ignored. They are avoided in Version 0.2.1.
Updating initial values in models using
SAMEargument on random effects (e.g. in between-occasion variability) would fail if the effects were fixed. Resolved. Thanks to Sergio Iadevaia for reporting this.Data sets with commas in character columns would make
NMsimfail. Support for such data sets had not been carried over with the new data handling approach implemented in version 0.2.0. This has now been resolved.NMcreateDoses()had a bug in theaddl.lastonlyfeature which would throw errors whenTIMEwas longer than two.addl.lastonly=TRUEis default and means that if the length of theADDLargument is one, it will be applied to the last dose only. This is for the common case where initial doses (say a load or an initial escalation phase) are followed by a maintenance regimen. The bug has been resolved.NMaddSamples()would fail if using theTAPDargument whenTAPDwas already available as a column in data. Fixed.
Other Improvements
The configuration of job submission is simplified when jobs are run in parallel with single-core processing.
Checks have been included in
summarizeCovs()for whetherNA’s are produced.summarizeCovs()is used to summarize simulated covariate effects (typically for forest plots). Especially, if for some reason the reference exposure is zero (likely an error by the modeler),summarizeCovs()would throw an error. NowsummarizeCovs()will try to identify this, give useful messages back, and report the estimates.Consistent ordering of columns in simulation results independently of
col.idandcol.time.
NMsim 0.2.0
CRAN release: 2025-03-13
New Features
- A greatly improved handling of data files has been implemented. This improves speed, reduced memory and disk usage, and adds features. It is fully backward compatible with the user interface of earlier versions.
- Data sets are only saved once for each model.
- Output tables are written and read more efficently. This is obtained by a combination of default
TABLEoptions and an efficient method to read the tables if those options have not been changed by the user. If the user does change them, a more robust but slower and more memory intensive method is used. - Input and output data are now by default merged using a row identifier inserted by NMsim. This makes NMsim robust to Nonmem code that does not simulate all rows in input data.
- Subproblems are automatically counted in the
NMREPcolumn in output. Force the inclusion of this column using thenmrepargument if needed even if not usingsubproblems.
- Variables from input data to be included in results can be specified using the new
carry.outargument. The default behavior byNMsim()is to include all variables from input data on the result. However, if the data set contains many rows or columns, this can be memory demanding. Now you can minimize memory use and maximize speed by limiting the variables in both input and output. For example
simres <- NMsim(file.mod,data,
table.vars=c("PRED","IPRED","Y"),
carry.out=c("ID","TIME",`EVID`)
)
simres will in this case contain only PRED, IPRED, and Y from the output table, and only ID, TIME, and EVID from the input data.frame (data). NMsim() also takes a new argument table.format which can be used to adjust the table format. But normally, that is not be necessary. There is no reason to list ID or any other column from the input data in table.vars since they can be carried over directly fro the input data, avoiding potential loss of accuracy in writing and reading to and from text files. You do not need to worry about merging input and output data correctly - NMsim() handles that internally using its own row identifier.
- Handling of Nonmem data filters. In case a sim is run without an simulation input data set,
NMsim()by default reuses the estimation data set and theIGNOREandACCEPTstatements in the estimation control stream. This is very useful for visual predictive check (VPC) simulations. However, the aim may be to run the simulation on the same data set with differnt inclusions. A common example of the is if the estimation was run without samples below the quantification limit (M1), but the simulation also be performed on those samples. This can now be done by passing new filters toNMsim(). In fact, this can even be done by first reading the filters from the control stream, then easily editing them, before passing them toNMsim().
Other changes
NMsim()’s argumentmodify.modelhas been renamed tomodify. This is to align argument names with other arguments available for model modification, namelyinits,sizes, andfilters.NMcreateDoses()requires AMT to be provided.addEVID2()only requiresCMTargument when the column of the same name is present indata. Not all models requireCMTand this change allows for building such data sets withNMcreateDoses()andaddEVID2().
NMsim 0.1.6
CRAN release: 2025-02-05
A major improvement is implemented on
NMSim_NWPRI(), the simulation method that leverages the NonmemNWPRIsubroutine to simulate models with parameter uncertainty. This method was first included in NMsim 0.1.3 but - as was clearly declared in that version - it could only be trusted for simulation ofTHETAs. After further development in bothNMsimandNMdatato support this as well as bugfixes in the new Nonmem 7.6.0, NMsim provides full support for simulation with parameter uncertainty using the inverse Wishart distribution through this simple interface.A new arguments
initsis introduced to manually specify parameter (initial) values. This is the values that go into$THETA,$OMEGAandSIGMAsections of the control stream. To simulate with the final estimated values (stored in a.extfile), simply addinits=list("theta(1)"=list(init=1.2)). For simulation, only the parameter values (init) may be of interest, but if you are using NMsim for estimation too, bounds and whether parameters are fixed can now also controlled.BLOCKstructures in$OMEGAandSIGMAcan currently not be changed (say, correlation of two random effects cannot be introduced or removed).The
$SIZEScan now easily be controlled using the simplesizesargument inNMsim(). It leverages a new functionNMupdateSizes()which can be used to edit$SIZESindependently of theNMsim()function. InNMsim()just add the argument likesizes=list(PD=100)which will update or add$SIZES PD=100as needed. See documentation for more details.Nonmem execution
Improved monitoring of Nonmem jobs. In NMsim 0.1.5,
NMsim()would not always catch and properly handled failed runs. On Linux, this is much better handled now. On Windows, failures still may not be caught properly - more work to be don on Windows to align with the approach on Linux.A new
post.funargument has been introduced inNMexec()to run additional code once Nonmem has finished. This can be used to automatically initiate creation of goodness of fit plots, simulations or any full workflows run usingRscriptafter estimation of models.
Bugfixes
overwrite()is a helper function intended to use inNMsim()’smodify.modelargument. It would not work correctly for strings containing some special, at least. Fixed.NMsim_NWPRIwould not always paste the full variance-covariance matrix for theta estimates into$THETAPVwhich would make NONMEM fail. Fixed.
NMsim 0.1.5
CRAN release: 2024-11-14
New features
NMreadSim()has a new argument calledrm.tmpwhich is used to remove the intermediate NONMEM files if they are successfully read. Remember,NMreadSim()creates a compressed results data set which will be read byNMreadSim()in future function calls, so unless debugging is needed on the simulation control streams and files returned by NONMEM running the simulations, it may be better to delete the intermediate files altogether and save the disk space.expandCovs()has a new argumentreduce.refwhich defaults toTRUEmeaning that by default there will be only one reference combination. IfFALSEexpandCovs()will return one reference for each covariate. The forest plot can be evaluated with just one reference simulation.New function
summarizeCovs()introduced to summarize simulation results for forest plots. This function is closely related toexpandCovs()NMsim()no longer requires NONMEM to be available ifreuse.results=TRUEand NONMEM does not need to be run.
Bugfixes
NMsim 0.1.4 would not submit jobs to cluster when number of cores was
nc=1. Fixed. Workaround in 0.1.4, usenc=2.NMsim 0.1.4 erroneously concluded jobs had failed when sent to the cluster if there was no existing queue. This is due to the exit status of
qsubin such cases. This has been fixed. As a workaround in 0.1.4, just run your sim again once the queue has been initiated by the first NMsim called.When NONMEM failed in 0.1.4, NMsim might not return debugging info. Fixed.
NMsim 0.1.4
CRAN release: 2024-11-02
New features
sampleParsSimpar()is a new function that automates sampling of parameter values from an estimated variance-variance matrix in a successful$COVARIANCEstep using thesimparR package from Metrum Research Group.simparis currently not on CRAN, so the user must install it from MPN or github to make use ofsampleParsSimpar(). The sampled parameter values can be fed directly toNMsimusing theNMsim_VarCovmethod making it very easy to simulate with parameter uncertainty based onsimpar. I want to thank Sanaya Shroff for her outstanding work on this functionality and for her exciting work summarizing the available methods for simulation with parameter uncertainty which she will be sharing at ACoP 2024. Also a big thanks to Eric Anderson for helping out with adjusting the github workflows to pullsimparfrom MPN.expandCovs()is a new function that puts together data sets for univariately varying covariates while keeping other at reference values. The function can derive both reference values and covariate values to simulate at by using i.e.median()andquantile().-
- Results are now equipped with three columns distinguishing simulated models. This separation of information makes it easier to summarize simulation results within/across models and/or within/across simulation of models.
-
model: The run name derived fromfile.mod. -
name.sim: The same as provided in thename.simargument. -
model.simThe name of the generated model. In the simple case, this ismodelandname.simcombined. But in many cases, multiple models are being generated for each simulated control stream.
-
- No longer requires a
.extfile if updating parameter values using PSN’supdate_inits. It is still recommended to keep the.extfile since it provides higher accuracy than the.lstfile.
- Results are now equipped with three columns distinguishing simulated models. This separation of information makes it easier to summarize simulation results within/across models and/or within/across simulation of models.
-
When submitting all updated models,
NMexec()will now by default try to detect if a model is already running before submitting it.Provides a summary of models to be submitted before starting to do so.
-
ADDLandIIare now also separate arguments providing a simpler interface than theaddlargument. Theaddlargument provides the advantage of being able to specify the two columns together in onedata.frame, possibly including covariates.add.lastonlyis a new argument. IfTRUE(default) andADDLandIIare of length 1, they are only applied to the last event in a dosing regimen.col.idargument to specify name of subject id column or to omit altogether usingcol.id=NA.Now checking that
TIMEis covering the length of all other arguments. In contrast to other arguments, it does not make much sense to try to extrapolate theTIMEargument.
addEVID2()now has two arguments,TIMEandTAPDwhich allow for specification of time since first dose and time after each dose at which to insert simulation records. The two can even be combined.TIMEreplaces the now deprecatedtime.simargument, andTAPDis new.
Bugfixes
A bug most likely affecting most Windows users for execution of Nonmem has been fixed. If on Windows, you should upgrade to NMsim 0.1.4. Thank you to Boris Grinshpun for reporting this!
When using
method.execute="nmsim"there was an issue with parallellization. This was not a major problem in most simulation applications, but it should now be fixed.-
- When not providing a simulation data set - typically a simulation for a VPC -
NMsim()would fail with messages like
- When not providing a simulation data set - typically a simulation for a VPC -
Error in `:=`((col.sim), ..name.sim) :
Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are defined for use in j, once only and in particular ways. See help(":=").
The issue has been fixed. If using NMsim 0.1.3 or earlier, the workaround is to do NMdataConf(as.fun="data.table"). Then after having the simulation results as a data.table, convert it with as.data.frame() or as preferred.
Notice, NMdataConf() affects the succeeding NMsim() calls but also other NMdata and NMsim function calls. When the VPC simulation has run, you may not want to continue recieving data.tables, you should reset the default value for as.fun: NMdataConf(as.fun=NULL) which will turn it back to returning data.frames by default. If you prefer tibbles, you can do NMdataConf(as.fun=tibble::as_tibble). Generally, if you prefer to work with something that is not data.frames (data.table and tibble the most common alternatives), it is recommended to use NMdataConf() to customize your default.
-
NMexec()-
NMexecwould fail running control streams named starting in numerals (like1.mod) whensge=TRUE. This is due to the waysgejob names are generated byNMexec(). Fixed by prepending “NMsim_” in these cases.
-
-
NMcreateDoses- Would in some cases create too many replicates if there were covariates on multiple arguments. Fixed.
NMsim 0.1.3
CRAN release: 2024-08-26
New features
-
New simulation method
NMsim_NWPRI()to simulate with parameter uncertainty. This automates simulation with parameter uncertainty using Nonmem’sNWPRIsubroutine for models with a successful covariance step. For now this method only works forTHETAsince we have found that the parameter distributions sampled forOMEGAandSIGMAdo not always match the model estimates and therefore cannot be trusted. To ensure that onlyTHETAare sampled and simulated, this method should only be run using thetypical=TRUEargument. This method is much faster than the existing methods in NMsim for simulation with parameter uncertainty (NMsim_VarCov()). This method depends onNMdataversion 0.1.7 or greater. Big thanks to Brian Reilly for his excellent work on this important contribution.The
add()function to be used inNMsim()’smodify.modelargument now supports prepending and appending of text lines to control stream sections. The default is still to append andadd("text",.pos="top")will now prepend “text”.
-
A “cleaning” feature has been added to
NMexec(), removing some of the temporary files generated by Nonmem after ended execution. The interface is inspired by PSN’scleanargument supporting values 0 (no cleaning), 1-4 (quite some cleaning - so far no difference betwen these values), and 5 for complete deletion of the temporary directory. When usingmethod.execute="PSN"NMsim calls PSN’s execute passing on thecleanvalue.Default number of cores to be used by
NMexec()can be controlled usingNMdataConf(nc=N)whereNis the desired default. Notice,NMsim()will not use this default. This is because parallellization is not as commonly used in simulation as in estimation.A useful backup feature has been added. Before execution, any existing results files related to a model are by default moved to a backup folder. The backup files are not
NMsimTestConf()- Function to summarize and test configuration. This is used internally and provides important debugging information.readParsWide()- A function to read wide-format parameter tables - is now exported. This is useful when simulating with parameter values that have been sampled outside Nonmem, e.g. using thesimparpackage.
Bugfixes
NMexec()would fail on linux when run on models with multiple$TABLEstatements. Fixed.NMsim’s internal method to update parameter initial values had an issue running on models with$OMEGAblock structures. Fixed.NMreadSim()would fail if working directory had been changed. Fixed.
NMsim 0.1.2
CRAN release: 2024-07-15
No changes since 0.1.1 except for disabling a test that was failing on some systems due to technical reasons.
NMsim 0.1.1
CRAN release: 2024-07-03
While no critical and generally only few bugs have been found in NMsim 0.1.0, NMsim 0.2.0 includes several improvements and upgrades. The interface feels smoother too. I want to thank Ron Keizer for feedback and advice.
New features
NMsim()has a much reduced and improved messaging to the user. If more than one model or data set is supplied or generated, progress trackers will be shown while starting Nonmem, while waiting for Nonmem to finish, and while collecting the simulation results.The messages include information about where intermediate files and final results files are stored.
NMexec()has improved support for estimation.method.execute="nmsim"andmethod.execute="psn"both work on linux and windows, even though less thoroughly tested on windows. Thank you to Boris Grinshpun for testing.Names of files containing final results from
NMsim()have been renamed to be more intuitive. The previous_paths.rdswill now be called_MetaData.rds. The results, once read and compressed, will be in a file called_ResultsData.fst. Notice, both these files are required to fully recover simulation results. Thanks to Brian Reilly for discussions on this and many other design aspects.It is now possible to provide specific parameters (
THETA,OMEGAandSIGMA) for Nonmem simulation.NMsim()table for simulations. See argumentfile.extandNMsim_VarCov’s argumentext.New arguments to control seeds.
NMsimcan either use R’sset.seedbefore generating the seeds for Nonmem. Detailed control of the seeds, including how many to include and the distribution of the random sources in Nonmem, can be controlled using theseed.nmargument. This way, the user can add random processes to the estimated control stream. The actual Nonmem seed values can also be provided.method.sim=NMsim_typical()has been replaced by argumenttypical=TRUE. This means typical subject simulations can now be combined with other simulations methods likeNMsim_VarCov.NMsim()now adds a column calledsimwhich carries the name of the simulation defined by thename.simargument.Several checks for existence and consistency of files are implemented.
The native Nonmem execution method now also works for estimation.
pnmfiles are now saved with the model for transparency.
Bugfixes
Running
rbindon results fromNMsimwould throw errors. Thanks to Simone Cassani for reporting this. Fixed.Using other file name extensions than
.modon input control streams in combination withNMdataConf(file.mod)would make NMsim fail. Thanks to Brian Reilly for reporting. Fixed.
Other changes
NMsim_known()renamed toNMsim_EBE().Generated control streams have been stripped off of the “NMsim_” prefix. These files are located in
NMsimgenerated folders so the prefix was uninformative.In case of multi-threaded (cluster) execution and something went wrong
NMexec()used to write some output files from Nonmem in the current working directory. All these are now being written to the model execution directory for clarity and tidyness.
NMsim 0.1.0
CRAN release: 2024-02-22
For the first time NMsim works on Windows. There may still be some limitations but initial testing looks very promising. Make sure to set path.nonmem. See the configuration vignette on the website: NMsim-config.html
0.1.0 is also an important upgrade that solidifies the way NMsim reads results from simulations. In addition to important bug fixes, it allows for NMsim to wait on Nonmem to complete simulations - even when they are run on a cluster. This means even large simulations with NMsim can be integrated in scripts.
New features
Works on Windows - at least most features do.
NMsim()andNMreadSim()now havewaitarguments which controls if they will wait for Nonmem to finish simulating. This will also work if jobs were sent to the cluster.NMsim()respects thereuse.resultsargument. IfTRUEit will use results file on the file system. This can be used in stead of puttingNMsim()calls inside an if-statement to disable the simulation but read results on file.NMsim()looks for a couple of features of the provided control streams that are known to be able to cause issues. Warnings will be issued if these are found.addEVID2has a new argument,EVIDto specify what value theEVIDcolumn should have. It can be useful sometimes to useEVID=0for simulation records.
Bugfixes
- In some cases
NMreadSim()would not get the path right to the simulation results leading to failures in reading simulation results. Fixed.
NMsim 0.0.10
CRAN release: 2024-02-08
NMsim 0.0.9 had an unfortunate bug in NMreadSim() which has been fixed. That bugfix is difference between 0.0.9 and 0.0.10.
NMsim 0.0.9
CRAN release: 2024-02-07
NMsim 0.0.9 is almost identical to 0.0.8 but ensures compatibility with older R versions.
NMsim 0.0.8
CRAN release: 2024-02-07
New features
NMsim0.0.1 would generate anrdsfile with paths to simulation files and results for each model+data set simulated. This has been changed to now only generate one table per model. This makes it simpler to read simulation results in some cases.NMreadSimshould now be the best and only way for the user to readNMsimsimulation results. It interpretsrdsfiles (which are the ones intended for reading),fstfiles, tables ofNMsimruns, andNMsimresults. This makes it less confusing what can be processed byNMreadSimand also it sometimes easier to generalize code reading simulation results. Also,NMsimnow always reads results usingNMreadSim. This has the advantage that an fst file will always be produced ifNMsimwaits to read the results.NMreadSimhas a new argument,check.timeby default disabling checking whether a collectedfstfile is newer than the results files generated byNMsim. Normally, it’s a good thing to check this but some ways of sharing file files may not retain file modification times needed to check for this.NMsimwill delete thefstfiles if it finds any so normally it should not be a problem to skip this check.modify.modelis the argument to use to modify the control stream afterNMsimis done preparing the simulation. A couple of helper functions are available making it really easy to add contents (very commonly used) or modify contents.NMsimnow tries to reuse stored results ifreuse.results=TRUE. It does so in a simple way - if they exist, they will be attempted read - so be careful to rerun simulations without this option if you change any arguments.NMsimwill by default add aDVcolumn withNAvalues ifDVis not in input data. Nonmem most often needs that column, and it is uninformative for simulations. Disable this feature by usingauto.dv=FALSE.The
transformoption has been integrated into the table of simulations created byNMsim(). This means even if the results are not read byNMsim(because the simulation is not executed or it is submitted to a cluster), the transformation will still be applied byNMreadSim()later.NMsim()'sdir.simsanddir.resarguments can be controlled usingNMdata::NMdataConf(). Often these two arguments are used all the time, so it’s convenient to be able to configure those once and for all in a script.
Bugfixes
NMreadSimwas only able to read results if the current working directory was the same as whenNMsimwas executed. Now fixed.In some cases
NMsimwould fail on models with multiple output tables when thetable.varsargument was not used. Fixed.NMsim’ssim.dir.from.scratchargument was not respected due to a simple bug, leading todir.simsgrowing each time a simulation was rerun.In case simulation data is a list of data sets
NMsimwould not order columns whenorder.columnswasTRUE. Now fixed.In case of lists of data sets, and the list element (data set) names included spaces,
NMsim()would throw and error. Spaces in data set names are now replaced with under scores (“_“) to avoid that. It will often happen when data sets are split into lists usingdata.table::split.data.table()- which is an excellent way to do this, by the way.Function
simPopEtas()was not exported, so only available asNMsim:::simPopEtas(). Fixed.
NMsim 0.0.7
CRAN release: 2024-01-08
New features
Function
simPopEtas()to generate a population from a model. The population can be saved as aphifile to be reused in subsequent simulations. The function is by mistake not exported in 0.0.7 so for now you must useNMsim:::simPopEtas()to use it.Function
NMreadSim()provides a very simple interface to reading simulation results. Especailly in cases where the simulation is being parallelized or otherwise spawns multiple Nonmem jobs, this is a useful feature.A list of simulation data sets will now be simulated with separate Nonmem runs. This is an efficient way to parellelize large simulation runs.
NMsim 0.0.6
CRAN release: 2023-11-28
New features
- Support for parallelization of simulations added when using PSN. It used to be possible to run multiple simulations simultaneously in separate threads. Now single simulation runs can be parallelized on
sgetype clusters (usingqsub). See argumentssgeandnc.
Bugfixes
- A simple mistake would create problems in
genPhiFile()when having more than 10 ETAs in a model. Now fixed.
NMsim 0.0.5
CRAN release: 2023-11-11
New features
Full support for models estimated with SAEM. Especially, simulation of “known” subjects, i.e. re-using emperical Bayes estimates, is slightly different with these models.
Experimental support for windows with PsN.
dir.psnargument has to point to a directory where executablesexecuteandupdate_initsare found. Thanks to Sjoerd Koopman for debugging and testing this. Hopefully in future versions,PsNwill not be needed on Windows (like it is not needed on Linux).The simulation method called NMsim_known now accepts other
.phifiles to use than the .phi file generated by the estimation run. This is useful if one wants to reuse subjects generated in a previous simulation.
