-
modlib()
model1005
re-coded to reflect the "traditional" model specification syntax (#1069). -
The model object
update()
method will again issue a warning when unrecognized arguments are passed (#1068).
- Fix signatures for
compiled.mrgmod()
andas_tibble.mrgsims()
based on new R-devel check findings (#1065).
-
SIGMA()
is a new model macro which allows users to access on-diagonal elements ofSIGMA
in the model (e.g.SIGMA(2)
in$ERROR
) (#1051, #1052). -
mrgsim()
andmrgsim_q()
gain anetasrc
argument, allowingETAs
to be either simulated fromOMEGA
(new default and previously the only behavior) or taken from the input data set (new option), similar to the way parameters can be scraped from the data set (#1037). -
@etas
is a new option for use with the$CAPTURE
block to let users nameETAs
to be captured into the simulated output; for example, use@etas 1:last
to capture all modelETAs
in the simulated output (#1055). -
Drop
CXX_STD
statement from Makevars file and DESCRIPTION to be consistent with current changes in R-devel; mrgsolve continues to require compiler capable of implementing C++11 standard, but this should be selected automatically by R (#1060). -
mrgsolve now depends on
R >= 3.6.2
(#1060).
-
Fix bug when the
path
argument is used in the$NMXML
or$NMEXT
blocks; this bug was introduced through the@cppstem
feature in version1.0.7
(#1046, #1048). -
Fix bug in
mread_cache()
where theproject
directory wasn't getting rendered properly when passing the complete path to the model specification file (#1056).
-
$NMXML
and$NMEXT
now accept therun
argument set to"@cppstem"
(i.e
run = "@cppstem"
); in this case, the stem of the NONMEM run will be assumed to be the same as the stem of the mrgsolve model file (#1025). -
Missing values (
NA
) in input data sets will be replaced with 0 for the following columns:AMT
,CMT
,EVID
,II
,ADDL
,RATE
,SS
as well as their lower case counterparts (#1030). -
Refactored include order when building a model; this is an internal update and not expected to be visible to the user (#1038).
- Fix bug in generating certain model definitions when using the
nm-vars
plugin; the bug would have resulted in a warning from the pre-processor and did not affect function of the model (#1039).
- Fix bug in
TOUCH_FUNS
where parameter and compartment lists were not getting generated properly whenmrgsolve
was not loaded; bug was detected and fixed prior to upload to CRAN or MPN (#1013).
-
Changed behavior for dosing records where EVID = 4 and SS != 0 to match what is done by NONMEM: the system will be advanced to steady-state but will not be reset; behavior prior to 1.0.5 release was to advance to steady-state and then reset (#1011).
-
Any column in an input data set that has a class attribute will now be dropped in addition to non-numeric columns; this includes columns that are
integer64
which can be present in data frames derived fromdata.table::fread()
or other.csv
readers (#1008). -
The
$MAIN
and$TABLE
blocks will no longer get called for actual dose administration records with lag times; this could change time after dose calculations or other calculations that could be happening in those blocks when the actual administration is taking place (#992). -
Code to update the parameter list was re-factored to be much more efficient (#978).
-
Fix bug where apparent dosing events for additional doses with lag times were not getting scheduled (only records for the actual administration); this doesn't change the simulated output but could change time after dose calculation (#992).
-
Fix bug where special
nm-vars
variables were not getting recognized as valid capture items during dynamic capture (#987). -
Fix bug when updating the parameter list with a data frame that included non-numeric columns that were not parameters (#978).
-
Fix bug where
as_data_frame()
was not properly working when leading event object wasevd
type (#948, #955). -
Add
uctran()
to convert nmtran data names to upper case (#955). -
Both
lctran()
anductran()
are generic and work ondata.frame
or event (ev
) objects (#949, #955). -
Fix bug where data records with
EVID = 3
were getting shifted in time byALAG
(#964, #969). -
Small negative eigenvalues from
OMEGA
orSIGMA
are set to zero in multivariate normal simulation ofETA
andEPS
, following the pattern seen inMASS::mvrnorm()
(#956, #957). -
Fixed bug where template parameters (
T
) were getting modified whennm-vars
plugin was used in conjunction withmrgx
plugin (#965, #968).
- Removed
assert()
statement in LSODA code found by CRAN check (#943).
- Test class using
inherits()
notclass()
from CRAN check (#943).
-
Add
LOG()
,EXP()
,SQRT()
macros whennm-vars
plugin is invoked #931, #936. -
Use
evd()
to create an event object which renders nmtran names in upper case (e.g.TIME
rather thantime
) #935, #919. -
Fixed bug where
rate
was not getting set for modeled events #934. -
Fixed bug where
self.stop_id()
andself.stop_id_cf()
had reversed behavior as documented #927, #928. -
Refactored EVID=3 behavior to leave
NEWIND
as-is #934.
-
New model syntax:
THETA(n)
is interpreted asTHETAn
in the model code;THETA
is now a reserved word (#837, #891, #892). -
New functions
collapse_omega()
,collapse_sigma()
andcollapse_matrix()
added which help to reshape OMEGA and SIGMA matrix objects with multiple blocks (#897, #900). -
New plugin
nm-vars
which implements NONMEM-like syntax for referring to compartments, differential equations, bioavailability factor, infusion duration and rate, and lag time (#904, #891). -
New plugin
autodec
which will find user-defined variables in the model code and automatically declare them as typedouble
(#905, #893). -
Use
ii
as spacer for setting the between-dose interval when putting event objects in a sequence (c.f.wait
) (#906, #901). -
Start deprecating
simeta(n)
andsimeps(n)
, calls tosimeta()
orsimeps()
with an integer argument thus limiting the update to just a singleETA(n)
orEPS(n)
; use in model code will generate warning when loading the model that contains then
integer value (#908, #909).
-
In
pk2iv
, change scaling volume forCENT
fromV2
(incorrect) toV1
(#831, #832, #833) -
Fix bug collating multiple
$OMEGA
or$SIGMA
matrices when parsing a model (#863) -
Refactor how debugging information is processed when using the
recover
argument tomread()
(#853) -
Fix typo in documentation for
as_cmat()
; the off-diagonals are assumed to contain correlations (#856) -
Wrote a
as.data.frame.matrix()
function in Rcpp; all simulation results return from the C++ simulation code as a data frame (#857) -
Fix bug where dynamic capture (via
mread()
) was not allowed for variables declared in$GLOBAL
(#868)
mrgsim()
will now periodically check for user interrupt signal so that long-running simulations can be stopped usingEsc
and / orControl-C
; the check interval can be modified through theinterrupt
argument tomrgsim()
, but for most applications, this shouldn't need to be changed (#823)mrgsim()
will issue a warning if duplicate columns are found in simulated output and rename duplicates usingmake.names()
; thanks @FelicienLL for the report (#827, #828)- Users can now turn compartments to
OFF
when they have active infusions running; this was previously an error (#822)
- The absolute paths to nonmem output files (
root.xml
orroot.ext
) are now saved in the model object when nonmem results are imported via$NMEXT
or$NMXML
; paths are accessible by coercing the model object withas.list()
and looking at thenm_import
item (#802) - Add Tim Waterhouse as contributor (#809)
- Add
root
argument to$NMEXT
and$NMXML
so that the nonmem output files are located relative to theworking
directory (default, previous behavior) or the directory where thecppfile
is stored;cppfile
will eventually replaceworking
as the default (#803) - Models based on
$PRED
now respect theobsonly
option (#811)
- Dosing into a compartment that is off at the time of the dose turns the compartment back on regardless of whether bioavailability is zero or non-zero (this is a bug fix where the compartment was not turned on when bioavailability was zero). (#800)
simeta()
andsimeps()
now accept an (optional) integer argument to limit re-simulation to single ETA or EPS values (#789)as.list(mod)
output now includes a data frame ofC++
variables and pre-processor definitions in thecpp_variables
slot. (#780)$PARAM
,$THETA
,$CMT
,$INIT
,$OMEGA
and$SIGMA
blocks all include the directives@object
and@as_object
so that block contents can be specified programmatically.@object
names an object that was coded into$ENV
and@as_object
indicates that the block contains code to realize the object. See?BLOCK_PARSE
help topic for more information on how this all works. (#783)$NMEXT
now lets the user select between multiple tables for scraping parameter estimates. (#782)
- Allow simulation from compartmental models with negative times #778
- Enable dynamic capture of pre-processor directives at compile time #776
- Fix error message when requesting invalid items during dynamic capture #776
- Stop testing test_equal using lattice
- Fix url endings for check on r-devel
- Adjust test comparing lattice plots based on change in r-devel; passing check.environments now
- Suppress warnings when non-numeric columns are dropped when those columns are not relevant to the simulation #709
- Add
$ERROR
as an alias for$TABLE
in the model file #710 - Fix bug where warning messages during steady-state finding referenced
rtol
andatol
rather thanss_rtol
andss_atol
#703 - Fix annotation parsing bug when the description included semi-colon #696
loadso
issues a proper error when the model dll doesn't exist #724- Try loading the model with loadso once of the model isn't loaded at the time of simulation #725
- Throw an error when
addl
orss
are negative #733 - Internal refactoring so that there is a hard solver reset when parameters that are copied from data change #744
- Add
tad
plugin to calculate time after dose in a specific compartment #702 - Internal refactor
carry_out
to respect defaultnocb
behavior #759; see also #744 - Throw an error when matlist labels are duplicated #730
- Add
capture
argument tomread
to add to$CAPTURE
when compiling the model #704
- The simulation time grid was adjusted so that rendering the grid could result in no times (length 0 vector of times); this is a breaking change from previous behavior where the time grid resolved to 0 when there were no observations to be found. While this is a breaking change, the old behavior was almost always wrong when the desired output was a series of non-observation records #640
- Added 1005 model
- Added
recover
mechanism to join items in input data sets to the output #646 - Allow simulation from empty time grid; this would potentially break some existing code; but not common #648
- Add collapse_omega and collapse_sigma arguments to [ set ] block #651
- Add separate tolerances (
ss_rtol
andss_atol
) to control advance to steady state #652 - Fix bug in
realize_addl
whenaddl
is zero byii
is not #653 - Fix bug where system did not reset with EVID 4 and infusion dose #683
- NMXML will now take vector for
tname
to add custom names to imported THETAs #687 - Add NMEXT block that works similar (not identical) to NMXML, but reads from
the
run.ext
file #509
- Add
select_sims
method for selecting columns inmrgsims
object #585 - Fix bug where system was improperly advanced on steady state dosing record with a lag time when the system failed to reach steady state #596
- Add better compartment level control for advancing system to steady state #598
- Allow user to set
CXX_FLAGS
in$ENV
block #603 - Add
N_CMT
plugin so that the number (index) of every compartment is available by name (e.g.N_CENT
for the number index of the central compartment) #606 - Fix bug where
blocks()
failed when the model was defined inRmd
file #608 - Call ODE block every time the system tries to advance so that variables calculated in ODE are properly calculated in output #613
- Add
within
method for mrgmod #616 - Access initial compartment values and other model object items with
$
operator formrgmod
#620 - Add plot method for signature
c("mrgsims", "character")
; pass in a character vector of outputs to plot #630 - The house model, previously accessible by
mrgsolve:::house()
is now an exported function #625 - Exporting outvars function to extract names of current output variables from the model object
- Now importing lifecycle and glue packages
- Remove
qsim
and all associated functions - Export new function / workflow as
qsim
as a simpler, quicker simulation routine #490 - tad calculation (when called through
mrgsim()
and variants) recognizes evid 4 in addition to evid 1 #502 - Fix bug where
$NMXML
fails whennm
namespace not found in xml file #510 - Arguments to
ev
constructor are now evaluated; for example,ev(amt = 100, rate = amt/2)
#512 - Add
$
and[[
operators for event objects #513 - Recalculate rate (from tinf), addl (from total or until) upon mutate #513
- Standardize column order for event objects #513
mrgsim_e
andmrgsim_ei
will try to accept data frame and validated data sets- Drop ODEPACK solver and implement lsoda in C++ #504
- Add C++11 as system requirement
- Add constant infusion at steady state #249
- Add
outvars
argument to update method; this will replaceReq
- Add two arguments to mrgsim:
ss_n
andss_fixed
to control advance to steady state; a warning will be issued whenss_fixed
isFALSE
and the system doesn't reach steady state withinss_n
iterations #533 - An error is issued when the first argument to mrgsim and variants is not a model object #547
- Argument
xpath
is added tonmxml()
to handle cases where thenm
namespace is not found in the xml file #510 - More informative error messages are included when processing input data sets #534
- When there is a problem when the ODE system is advanced, informative error
messages from both lsoda and mrgsolve will be issued along with the value
of
istate
#457 - Add ability to have
ss=1
in a dosing record with bioavailability is zero #497 - Error messages will be issued when both of the following are found in input
for event object construction:
rate/tinf
,addl/total
,addl/until
#513 - When
tinf
is used to create event object, that item is retained and used to set the infusion rate (along with dose) until it is removed; it is an error to try to setrate
whentinf
is in the event object #513 - Fix bug related to column identification in
expand_observations
#563 - Add record position argument to
expand_observations
to allow control record sort order #565
- Fix bug where system advanced to next time after advancing to steady state on a dosing record with ss=1 with no observation record at the same time but preceding the dosing record #484
- Add AMT and CMT macros for self.amt and self.cmt, respectively #354
- Re-organize
DLSODA
code to avoid CRAN LTO warning
- Fix bug in TAD plugin where time of last dose never moved from default
- Add option in
mrgsolve_q
to call the standard mrgsolve simulation rather than the streamlined function; a decision will have to be made about whether or not the streamlined function will be retained - Fix bug in the model parser where commented lines with (all) leading spaces were not handled properly #450
- Objects of class
valid_data_set
now retain the matrix attribute #448 - Block names are now coerced to upper case letters
- Change default for
simcall
to 0 in mrgsim_q - Add recover argument to mread
- Add
@as_object
option to the following blocks: PARAM, INIT, CMT, OMEGA, SIGMA; experimental - Allow multiple
ODE
blocks - Add
mtime
function toself
object for simpler mtime implementation - Add
@param
block option for ODE blocks; use comma-separated name=value pairs to add to the parameter list from within ODE - Remove BLAS code embedded in ODEPACK fortran files per CRAN request
- Added
logy
andlogbr
arguments toplot.mrgsims
so results y-axis outputs can easily be plotted on log scale - release
- Added
numerics_only
function to drop non-numeric columns from the input data set after optionally converting logical columns to integer - Added
ev_rx
function to write dosing interventions in notation similar to a prescription 'sig'
- Added
$PRED
block for models that don't utilize any compartments - Added
pred1
to the internal model library (modlib()
) - Added
mrgsim_q
function for simulation from a model object with quicker turnaround time mread
will takesoloc
andproject
arguments fromoptions()
asmrgsolve.soloc
andmrgsolve.project
, respectively- Added
output
argument tomrgsim
so that e.g. data.frame can be returned, without creating the usualmrgsims
object - The directory name passed to the
soloc
argument ofmread
(ormcode
or cache versions of both) will be created if it doesn't exist - Added
pk2iv
model as convenience option - Added
tinf
argument toev()
constructor function
time/TIME
is no longer required in a data set when$PRED
is in usecmt/CMT
is no longer required in a data set; a default value of 0 will be assigned in case it is missing and an error will continue to be generated when dosing into an invalid compartment (0 is always an invalid index for dosing compartment)- An error will be generated if missing values (
NA
) are detected in an input data set with the following names:ID
,time/TIME
, or any column that shares a name with an item in the parameter list - An
index
argument was added to the$NMXML
block to allow results selection when multiple estimation blocks were used. The new default is to use the last result. modlib
is now able to function as a wrapper tomread
for models in the model library so that, for example,modlib("pk1")
is equivalent tomread("pk1", modlib())
.
- Fixed bug related to record sort order #406
drop.re
anddrop_re
; usezero_re
instead
- An undocumented function called
report
was previously available to use in model code. This function has been moved to a namespace and is now available asmrg::report
. This feature continues to be undocumented.
- Minor changes to namespace for CRAN
- Internal release
- Removed the function
s
and replaced withs_
; this was not a problem created by mrgsolve but rather by ggplot2, which callsmgcv::s
viageom_smooth
under certain circumstances
- Re-configured the list of data coming from
as.list.mrgmod
so that the names match the names that you would pass toupdate.mrgmod
; also added some items so that all updatable slots in the model object are exported by callingas.list
#354
- Add OMEGA and SIGMA matrices to
as.list.mrgmod
output under the names omat and smat, respectively - It is no longer an error to attempt to update slots for OMEGA and SIGMA matrices when there is no matrices in the slot as long as the update is with an empty list or a matrix with zero rows
- Fix segmentation fault when both data set and idata set are used in a simulation with certain mis-matches in the ID content between the two #352
- Removes more mtime code (wasn't in use)
- Use
dplyr::filter_
forfilter_.ev
- mtime clear bug
- Fixed bug in
filter.ev
method
- Added
mutate_sims
andfilter_sims
that work onmrgsims
(output) objects, modifying thedata
slot and returning a modifiedmrgsims
object rather thandata.frame
- Added
plot_sims
function that takes a data frame of simulated output and generates a plot using themrgsims
method
- Changed
id
argument toID
inev_rep
andev_seq
; a warning is issued ifid
is used - Added
data_qsim
for creating input data sets to use withqsim
- Fixed a bug where time after dose was not correctly calculated for additional doses with a lag time #327
- Added
read_nmext
to read in nonmem model output from the .ext file
- Clean up and re-organize Rd files; more-logical grouping and ordering
- Stop importing assertthat and lazyeval
- Added better support for writing model files with any
extension. For example,
mread("mymodel.txt")
will read from the filemymodel.txt
if it exists. However, the default behavior remains unchanged so thatmread("mymodel")
will expect to find the model in the filemymodel.cpp
.
- Fixed bug where the MD5 value on the model file could not
be calculated under certain
project
path formulations #315
-
The
realize_addl
function was re-factored to better account for time-varying data items; more option are provided for seeing where rows were inserted into the data set and whether to make assumptions about other data in those rows or not -
mrgsolve no longer utilizes any functions from the XML package. All previous functionality that depended on XML now depends on xml2. As such, xml2 is listed under the Suggests dependency.
-
When using
$NMXML
, the$OMEGA
and$SIGMA
matrices are now loaded by default; see new default arguments tomrgsolve:::nmxml
- Added
solversettings
help topic that identifies some of the DLSODA inputs you can tweak - Improved documentation for
update
method as well asmrgmod-class
-
Bioavailability specified in
$MAIN
is accounted for when simulating withqsim
; there is still no bioavailability adjustment for infusions or lag times adjustments to doses -
Added capability to rename data items in
$CAPTURE
; also, names are partially sanitized, removing parens and brackets.
For example$CAPTURE WT = WGT ETA(1) TVCL = THETA1
-
Added
qsim_df
function, returning data frame rather than matrix -
Added
as.list
method formrgsims
objects -
Added
deep
argument foras.list
method formrgmod
object; it was taking a lot of time to return the function set, so now you only get it ifdeep = TRUE
-
Added
mrgsim
variant functions with explicit input requirements written into the function name. For example, callmrgsim_e
to simulate from an event object,mrgsim_d
to simulate from a data frame. All of these functions are called bymrgsim
. -
Added method so that event objects can be passed to
data_set
; also, coercing event objects todata_set
when passed in asdata
-
Added
all.equal.mrgmod
function to compare two model objects. The function returns logical (only) -
Added
env_get_env
that always just returns the model environment; it has identical result asenv_get(mod, tolist = FALSE)
-
Change
mread_cache
andmcode_cache
so that the cache is invalidated whenpreclean
argument isTRUE
- Fixed bug preventing simulation with
qsim
with no event
mrgsolve_example
andmrgsolve_template
; these had been deprecated previously with warning; usemodlib()
models instead
- Added
mrgsim_df
function to return data frame rather thanmrgsims
object
- The model environment is automatically imported as
_env
whenmrgx
plugin is invoked
- Release to CRAN
-
Added
file
argument tomread
to allow coding model specification files with any extension. The current behavior continues to be assuming that the model is in a.cpp
file, but using thefile
argument allows any file name for model specification. -
Added
nocb
argument tomrgsim
. Ifnobc
isTRUE
(default),mrgsim
continues to use next observation carried forward to advance the system when there are time-varying parameters (including covariates). Ifnocb
isFALSE
,mrgsim
will use last observation carried forward (locf
) to advance the system when there are time-varying parameters.
- Minor improvements to documentation
- Fixed bug where deslist was created in the wrong order
- Fixed bug where infusion duration was incorrect when paired with non-zero lag time (test added)
- Fixed bug where
self
object was not correctly updated for the first record for an individual (#273)
- Add support for dosing records with both lag time and ss flag; an error message will be generated if lag time is greater than ii or if lag time + infusion duration is greater than ii.
- The behavior of
ev_assign
is changed so that the unique values ofevgroup
are sorted prior to making event assignments. Details about the new behavior are now included in the R help topic.
- The bioavailability parameter now gets updated with each and every dose,
regardless of whether it was explicitly coded in the data set or implicitly
via
addl
. The previous behavior had bioavailability parameter locked at the value at the time the initiating dose was implemented - Updated package dependency requirements. Notably, mrgsolve now requires
Rcpp >= 0.12.12
anddplyr >= 0.7.1
- Dosing records with
ss=2
are recognized, allowing combining of steady-state dosing regimens under linear kinetics (e.g. 10 mg QAM and 20 mg QPM) (#221) - Added function (
inventory
) that reconciles model parameters with names in an object (e.g. a simulation data set) verify that required parameters can be found in the data object.
- PR #214 from @dastoor fixes compatibility issue with new
dplyr
- Fixed bug in
deslist
implementation #222 - PR #238 fixes incorrect steady-state values when dose is associated with lagtime (#239)
- Reconfigure use of function pointer in unit tests
- Bug fix that prevented installation on Solaris
- The first release on CRAN
- Devin Pastoor is now listed as a contributor. Thanks for all of your help!
- Added automatic, on-demand output of time-after-dose (
tad
) in the simulated output. Usemrgsim(tad=TRUE)
. - Several new functions added to
$PLUGIN mrgx
, includingmrgx::get<T>
for getting objects out of$ENV
or a package namespace andmrgx::mt_fun()
that is just a function that you can assign when declaringRcpp::Function
. - Added
object
argument toidata_set
anddata_set
to get adata.frame
(or function to call that returnsdata.frame
) out of$ENV
to use for simulation.
- Added
cmt
argument to$PKMODEL
. Whencmt
is set to a character vector or a comma-separated string,$PKMODEL
infers the number of compartments and declares them in the model. This means a separate$CMT
block is not required when using$PKMODEL
. - Added
cols
argument toas_bmat
andas_dmat
so that a character vector of names can be specified (rather than regular expression) to select data for creating matrix. - The
preclean
argument now causesunlink
to be called on the model build directory. - Added several functions to help work with
$ENV
:ls_env
,get_env
,re_eval_env
,update_env
. - When a dose is administered into a compartment that is off, the compartment is now turned on and the dosing is allowed to proceed. This is a change from previous behavior, where an error was generated.
- The
table()
macro in$TABLE
is now deprecated (metrumresearchgroup#129). To get derived values into the simulated output, users should assign to typedouble
and list that variable name in$CAPTURE
. See also thecapture
typedef introduced below. - The
mrgx
plugin was completely removed. - Parameter updates via
param
method with signaturemissing
will check names of input parameters against names of existing parameters. An error is generated if a user attempts to update a parameter that doesn't exist. Note that this does not apply for theparam
method with signaturelist
(#144). - The git repository was re-organized so that the package lives in the base directory (PR #171).
- Added
@
macros for indicating block options in model specification file. - Added
qsim
function for quick(er) simulation runs with just one parameter set. - Added
recmatrix
that creates matrix simulation template forqsim
. - Added
mrgsolve:::render
to create a document with overview of model contents. Methods for bothmrgmod
objects andcharacter
strings pointing to a model file. - Use
mrgsolve:::details
to extract model annotation. - Added
capture
typedef in the model specification file. Variables that are typecapture
are doubles and are automatically appended to$CAPTURE
.
Thecapture
typedef is not allowed in$ODE
and probably should be reserved for$TABLE
. simeta
is available in$MAIN
andsimeps
is available in$TABLE
by default, no$PLUGIN
is required.- Better support for including
R
objects in the model via$ENV
(#158). - Added
assign_ev
function to help build simulation data sets from event objects (metrumresearchgroup#164). - Added
as_data_frame
method from thetibble
package (#166). - When annotating model blocks, mrgsolve takes the last parens item as the "units" and the last bracketed item as "options"
- Added
$
operator formrgmod
objects to return the value of a parameter. - Added
mread_cache
andmcode_cache
functions to build and cache a model (#143).
- Fixed documentation issue in
PKMODEL
. The volumes for two-compartment model with no depot should beV1
/V2
. - Fixed bug in
knobs
where output column names are malformed when a user$CAPTURE
s a parameter that is also being tweaked as a knob. - Fixed bug in annotated model specification when multiple unit or option specifications are made.
- User-declared
double/int/bool
in$MAIN
,$ODE
,$TABLE
are kept in unnamed namespace and are local to the file. - Started to re-organize the
.R
files. mrgsolve:::details
returns a data frame of information regardless of whether the model was annotated or not (#165).mrgsolve::details
has additional arguments to help control output.- Removed
pkevent
class; all records aredatarecord
.
- Added annotated code blocks for
$PARAM
,$FIXED
,$THETA
,$CMT
,$INIT
, and$VCMT
. (#107) mrgsolve:::house()
model re-coded as an annotated model.- Re-implemented
$ENV
to allow users to createR
objects that can be used at certain points when parsing the model. (#115) - Added
>>
signifier to code blocks that allow options;>>
at the beginning of the line indicates that thename=value
statements that follow are to be parsed as block options. - Added
object
argument for the following blocks:$PARAM
,$OMEGA
,$SIGMA
,$FIXED
,$CMT
. Whenobject
is set to a character string naming an object in$ENV
, that object will be used to form the output from the block.
- Fixed a bug which caused simulation run to hang when implementing a dose with a very small lag time. (#109)
- Fixed a bug where
valid.numericlist
wasn't returningFALSE
for improperly-formed objects.
- Now using an
environment
to collect objects when parsing the model specification file. - Some small changes to
C++
code that calculates compartment amounts for closed form one- and two-compartment models resulting in faster simulation runs.
- The
modmrg
package was discontinued. All of the pre-coded models are now available in mrgsolve. Simply callmread
with the model stem (e.g.pk1cmt
,irm3
, etc ...) and callmodlib()
as theproject
argument.
For example:mod <- mread("emax", modlib())
will compile theemax
model and return the model object.
- Tests re-configured
- Fixed issue with record sorting for lagged doses when using full
data_set
andobsaug=TRUE
(#102) - Fixed issue where
idata_set
wasn't handled properly when it was passed in astbl
(#100)
- Addressed an issue where model compilation on
Windows
systems failed when certain symbol names were used in the model (#97). In this release, adllname-win.def
file is created insoloc
to export only the functions that mrgsolve needs to use. This is only relevant toWindows
platform. - Added a check on the
project
argument tomread
: if newline(s) are found, an error is generated and the user is prompted to usemcode
instead. - Several changes under the hood (metrumresearchgroup#99)
- Fixed bug where requested columns were not properly named in certain circumstances (#86).
- Revert back to previous behavior where
cwd
tosoloc
is not required to build the model. This was only required onWindows
systems where there was a space in the file name. Correctly rendering the path for the build directory now.
- Added
as_data_set
to convert one or more event objects into a data frame that can be passed todata_set
. Does something similar toexpand.ev
, but more control. - For special column names (
time
,amt
,rate
,evid
,ii
,addl
,ss
,cmt
) either lower case or upper case names are recognized. The determination is made on thetime
/TIME
column (always required when using a data set). Iftime
mrgsolve will continue looking for lower case names; ifTIME
it will look for upper case names. A warning is issued in case both upper and lower case names are included. - Added
$PLUGIN
to let users extend their model specification file. Valid plugins includesimeta
,Rcpp
,RcppArmadillo
, andBH
. When a plugin is used, mrgsolve will link back the the appropriate package and possibly include appropriate header files when compiling the model. For example,simeta
will link back to mrgsolve andRcppArmadillo
and allow the modeler to simulate a new set ofETA
s. UseRcpp
plugin to simulate random variates from common distributions inR
(e.g.rnorm
,rexp
etc ... ).
- Fixed issue with
ev
where no rows were returned ifamt
wasn't supplied (#44). - Shortened the path for both the shared object and the name of the
.cpp.cpp
file when compiling. - Fixed bug in
touch_funs
when large number (> 25
) of ETAs in the model (#68).
- When using
$PKMODEL
withncmt=2
anddepot=FALSE
, the default PK parameters areCL
,V1
(central volume),Q
,V2
(peripheral volume).
This is a change where the previous volumes wereV2
(central) andV3
(peripheral). $CAPTURE
now saves output items to slots instd::vector<double>
, rather thanstd::map<std::string,double>
. We've known for a while that thestd::map
wasn't very efficient especially with large simulations.
Currently, items in$TABLE
are still saved intostd::map
withtable()
macro. The plan going forward is to eliminate thattable
map
and force output variables into$CAPTURE
.- Due to major changes to
dplyr
, now requiringdplyr >= 0.5.0
(#69) - The
data
slot inmrgsims
objects is nowdata.frame
- The
knobs
function andplot
method has been re-written. Overall behavior for most applications should be the same.
C++
symbols for model functions are now stored in the model object (funs
slot)- The status of the model object (function names and compile status) can be
checked with
mrgsolve:::funset(mod)
- A model is considered to be loaded and ready to go if all functions in
funs
can be found withis.loaded
- Model shared objects are still stored within the
soloc
directory (by defaulttempdir()
), but mrgsolve will create a subdirectory structure to organize compilation artifacts. The outer directory is keyed based on the current mrgsolve version number and the computer platform. Inner directories are based on the model name (model(mod)
). - A source file is created based on the
model
name and the shared object is created based on that name. If the compilation is successful, the shared object (.so
on mac/unix,.dll
on Windows) is copied to a.so
or.dll
file with a unique stem (e.g.model2lj239wsfo.so
). This unique shared object is loaded into theR
process for use with the model. - Every time the model is rebuilt, the build directory is scanned for shared
object files. Excluding the main model shared object (unchanging name based
on the model), old shared object files are deleted and, if currently loaded
(
getLoadedDLLs()
), are attempted to bedyn.unload
ed. - Upon model rebuild (via
mread
ormcode
), if there are no changes to the source.cpp
file, the source is not overwritten. In that case,make
will not re-build the shared object. Using thepreclean
argument will force re-compilation (seeR CMD SHLIB
). - The header files
modelheader.h
andmrgsolv.h
are no longer copied into the project directory. ButCLINK_CPPFLAGS
environment variable is modified to include<path-to-mrgsolve-package>/inst/base
so that these may be linked. - The
R CMD SHLIB
build process always usesintern=TRUE
so that output is suppressed on bothWindows
andmac/unix
. The user may still request to view build output with theignore.stdout
argument. - Model build always links-to the
project
directory to look forC++
header files. When including a header file that may change from build to build, always run withpreclean=TRUE
. - mrgsolve now changes the working directory prior to building a model.
The working directory is restored on exit frommread
.
- The entire
complog
system, including:comp_forget
a message is issuedcomplog
no message is issued
trequest
argument tomrgsim
- Fixed a bug when an infusion was attempted with
rate > 0
andamt==0
.
Additionally, an error is generated when an infusion is attempted with zeroamt
(issue 43).
- Fixed a bug where infusion dosing events with
evid 4
were not properly implemented. While investigating that issue, also found similar issue withevid 4
infusions getting scheduled withaddl
(issue 31). - Removed NSE evaluation for arguments passed into
ev
to avoid unintended issues in evaluation (issue 29).
- Added
mcode
function as alternative to usingmread
when your model is written in anR
string. Note the order of the arguments: firstmodel
, thencode
, thenproject
.project
defaults totempdir
.
So the call is:mod <- mcode("mymodel", code)
. The equivalentmread
call is:mod <- mread("mymodel", tempdir(),code)
. carry.out()
andReq()
now takenewname = oldname
as input. Use this syntax incarry.out
when you want to copy a column from the input data set into the simulated data set, changing the column tonewname
fromoldname
.
Use this syntax inReq
when you want to change the names of compartments or output variables specified in$TABLE
/$CAPTURE
.- Added
pkmodel
function for easy loading and simulating from 1- and 2-compartment models (issue 39). - Added new code block:
$PKMODEL
for simulating PK model with analytical solutions. The main option for this block isncmt
, which picks the number of compartments for the pk model. See?PKMODEL
for more information and other options (issue 34).
- Added
code
attribute tomrgmod
objects. The actual source code stays with the model object.see
was modified to look atx@code
first when showing the model code. - Added a tokenizer function (
get_tokens
), a wrapper for the boost tokenizer) to help checking the model specification file. - Data items entered in
$FIXED
are now implemented as C++ preprocessor directives by default rather thanconst double
variables. Use$SET fixed_type = "define"
or$SET fixed_type = "const"
to select between the approaches.
- Added missing example model specification files (popExample, viralExample, others)
- Added
mindt
attribute tomrgmod
objects with default value of.Machine$double.eps*10
. When the problem includes an infusion, the calculated end of the infusion may come too close to another record. Usually the solver will fail with the messageDLSODA- TOUT(=R1) too close to T(=R2) to start integration.
. To fix this, setmindt
to be greater than zero but small ... maybe 1E-12. Whenmindt
is greater than zero andtto - tfrom
(the times of two adjacent records) is less thanmindt
, mrgsolve will settto
equal totfrom
(issue 9). zero.re
didn't properly update the$SIGMA
list when one matrix was named and another was unnamed. This has been fixed.
(issue 16)- Fixed a bug where infusions with
ss
=1 caused mrgsolve/R
to crash when the infusion duration was equal to or some multiple of the dosing interval. (issue 19) - Fixed a bug where setting
F_CENT
to zero gave undefined behavior.
mrgsolve will issue an error ifF_CMT
is set to zero and thess
flag is set to 1. (issue 22) - Fixed bug where dosing records with
evid=4
(reset the system and dose)
andaddl > 0
reset the system for all subsequent doses. Additional doses coming from records withevid=4
will not do system reset. (issue 23)
- New arguments for
$NMXML
(see?nmxml
) that are easier to understand and consistent with new prefixes and labels forETA
andEPS
.name
argument is removed. Usetname
(to provide a prefix forTHETAs
),oname
(to name theOMEGA
matrix), andsname
(to name theSIGMA
matrix) instead. In general, settheta
to beTRUE
to importTHETAs
, setomega
to beTRUE
to importOMEGA
, and setsigma
to beTRUE
to importSIGMA
.
Specifying character namestname
,oname
, andsname
will implytheta=TRUE
,omega=TRUE
, andsigma=TRUE
, respectively.
- New aliases available for setting bioavailability, lag time and infusion
duration and rate. For a compartment called
DEPOT
use:F_DEPOT
(bioavailability),ALAG_DEPOT
(dosing lag time),D_DEPOT
(infusion duration), and / orR_DEPOT
(infusion rate). (issue 13) - Added slightly more informative messages when
DLSODA
fails, including clear identification if the value ofistate
, which is 2 when the solver succeeds and negative when the solver fails. - Added
labels
andprefix
options to$OMEGA
and$SIGMA
. These allow descriptive aliases for ETAs ... e.g. usingETA_CL
rather thanETA(1)
.
(issue 15) - Added
dplyr::slice
method formrgsims
objects (issue 11) - New argument to
mread
:quiet
. Settingquiet
toTRUE
will prevent printing messages whenmread
is called. The default isgetOptions("mrgsolve_mread_quiet",FALSE)
... so you can calloptions(mrgsolve_mread_quiet = TRUE)
to globally turn off messages frommread
.
- Fixed paths for project (
project
) and shared object (soloc
) so that "short" paths are used when compiling the model on Windows platforms (info issue 4 and here) - Fixed a bug where bioavailability fraction was not accounted for when
setting infusion duration in
$MAIN
withrate=-2
(see issue 3) mrgsolve_example
prints a message telling the user to usemrgmod
to read and compile the model. The user should usemread
. The message has been updated. (info issue 5)- Fixed bug where parameters were not correctly read from first row of a
data set when certain
recsort
options were selected (issue 6)
- Added
$ADVAN2
and$ADVAN4
for implementing one- and two-compartment PK models with analytical solutions rather than ODEs (thanks to contributions by Bill Gillespie and Charles Margossian) - Added
soloc
attribute added tomrgmod
and argument added tomread
, giving user control over where the shared object is stored; by default it is intempdir()
.soloc
needs to be set to local directory when usingqapply
- Added generics for various
dplyr_
functions so thatmrgsims
objects can be piped tomutate
,group_by
,filter
,summarise
,do
,select
, andsummarise.each
(it's a dot not an underscore). So:mod %>% mrgsim %>% mutate(group=1)
- You can now set initial conditions though
idata
; for compartmentCMT
, include a column inidata
calledCMT_0
- Modified update policy for
$OMEGA
and$SIGMA
: if all incoming matrices are unnamed and the signature matches the model object, the update will happen - Added
mcRNG
function as alias tobase::RNGkind("L'Ecuyer-CMRG")
- Changes to
recsort
: 1 and 2 will put explicit doses after observations at the same time, 3 and 4 will put explicit doses before observations at the same time. 2 and 4 will put doses scheduled throughaddl
after observations at the same time; 1 and 3 put doses scheduled throughaddl
before observations at the same tile.
- Changed dosing lag time mechanism so that lag times are calculated as the simulation progresses and dose times in the simulated output are as in the input data
- Model shared objects are given random names every time the model is compiled and loaded
- Various fixes and expansions to documentation
- Changed
R
dependency to>= 3.1.2
- All
Ops
involvingmrgmod
objects are now deprecated loadso
now returns the model object (invisibly)- Compartment names are automatically removed from table map
- Model specification files in need of compilation are detected via md5sum
- Minimum of 2 sec wait time is required before re-compiling a model
- Added
init
method with signaturemrgmod
,ANY
, withANY
getting coerced tolist