Learn R Programming

mrgsolve (version 1.7.2)

Simulate from ODE-Based Models

Description

Fast simulation from ordinary differential equation (ODE) based models typically employed in quantitative pharmacology and systems biology.

Copy Link

Version

Install

install.packages('mrgsolve')

Monthly Downloads

3,778

Version

1.7.2

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Kyle T Baron

Last Published

January 22nd, 2026

Functions in mrgsolve (1.7.2)

data_set

Select and modify a data set for simulation
env_update

Update objects in model environment
carry_out

Select items to carry into simulated output
ev-class

S4 events class
ev_seq

Schedule a series of event objects
evd

Create an event object with data-like names
mutate.ev

dplyr verbs for event objects
design

Set observation designs for the simulation
ev_days

Schedule dosing events on days of the week
details

Extract model details
exdatasets

Example input data sets
expand.idata

Create template data sets for simulation
ev_rep

Replicate an event object
idata_set

Select and modify a idata set for simulation
env_eval

Re-evaluate the code in the ENV block
expand_observations

Insert observations into a data set
house

Return a pre-compiled, PK/PD model
file_show

Show model specification and C++ files
get_tol

Extract rtol and atol information from a model object
ev_ops

Operations for ev objects
init

Methods for working with the model compartment list
ev

Event objects for simulating PK and other interventions
$,ev-method

Select columns from an ev object
collapse_matrix

Collapse the matrices of a matlist object
ev_assign

Replicate a list of events into a data set
collapse_omega

Collapse OMEGA or SIGMA matrix lists
as_bmat

Coerce R objects to block or diagonal matrices
matrix_helpers

Create matrices from vector input
lctran

Change the case of nmtran-like data items
modlib_pk

modlib: Pharmacokinetic models
ev_methods

Various methods for event objects
is.mrgsims

Check if an object is mrgsims output
inventory

Check whether all required parameters needed in a model are present in an object
is.mrgmod

Check if an object is a model object
merge.list

Merge two lists
mod

Return the model object
modlib_pkpd

modlib: Pharmacokinetic / pharmacodynamic models
mread_yaml

Read a model from yaml format
mread

Read a model specification file
c,matlist-method

Operations with matlist objects
matlist

Methods for working with matrix-list objects
knobs

Run sensitivity analysis on model settings
modlib

Internal model library
code

Extract the code from a model
mvgauss

Simulate from a multivariate normal distribution with mean zero
mcRNG

Set RNG to use L'Ecuyer-CMRG
mcode

Write, compile, and load model code
loadso

Load the model shared object
mrgmod-class

S4 class for mrgsolve model object
mwrite_yaml

Write model code to yaml format
names,mrgmod-method

Get all names from a model object
modlib_details

modlib: PK/PD Model parameters, compartments, and output variables
ev_repeat

Repeat a block of dosing events
env_get

Return model environment
ev_rx

Create intervention objects from Rx input
env_ls

List objects in the model environment
numeric2diag

Create a diagonal numeric matrix from diagonal elements
$,mrgmod-method

Select parameter values from a model object
modMATRIX

Create a matrix
modlib_tmdd

modlib: Target mediated disposition model
nmext

Import model estimates from a NONMEM ext file
modlib_viral

modlib: HCV viral dynamics models
modelparse

Parse model specification text
lower2matrix

Create a square numeric matrix from the lower-triangular elements
matlist-class

S4 class matlist
mrgsim_variants

mrgsim variant functions
param_tags

Return parameter tags
mrgsims_modify

Methods for modifying mrgsims objects
mrgsims-class

S4 class for mrgsolve simulation output
param

Create and work with parameter objects
reserved

Reserved words
mrgsim

Simulate from a model object
numericlist-class

S4 class numeric list
render

Render a model to a document
obsaug

Augment observations in the simulated output
mwrite_cpp

Write a model to native mrgsolve format
plot_mrgsims

Generate a quick plot of simulated data
obsonly

Collect only observation records in the simulated output
show,parameter_list-method

Show the parameter list
plot_sims

Plot data as an mrgsims object
reset_tol

Reset all model tolerances
revar

Get model random effect variances and covariances
show,mrgmod-method

Print model details
mrgsim_q

Simulate from a model object with quicker turnaround
omega

Manipulate OMEGA matrices
mrgsolve-package

mrgsolve: Simulate from ODE-Based Models
nmxml

Import model estimates from a NONMEM xml file
reexports

Objects exported from other packages
realize_addl

Make addl doses explicit in an event object or data set
update

Update the model object
use_custom_tol

Set up a model object to use either scalar or custom tolerances
scrape_and_call

Scrape options and pass to function
read_nmext

Extract estimates from NONMEM ext file
tscale

Re-scale time in the simulated output
outvars

Show names of current output variables
touch_funs

Get inits from compiled function
scrape_opts

Scrape options from a code block
see

Print model code to the console
qsim

Basic, simple simulation from model object
show,cmt_list-method

Show the compartment list
valid_idata_set

Validate and prepare idata data sets for simulation
valid_data_set

Validate and prepare data sets for simulation
summary.mrgmod

Print summary of a mrgmod object
stime

Get the times at which the model will be evaluated
mrgsims

Methods for working with mrgsims objects
solversettings

Optional inputs for lsoda
soloc

Return the location of the model shared object
within

Update parameters, initials, and settings within a model object
wf_sweep

Simulate a sequence of parameters
%>%

Forward pipe
numerics_only

Prepare data.frame for input to mrgsim()
mrgsims_dplyr

Methods for handling output with dplyr verbs
parameter_list-class

S4 parameter_list class
numericlist

Methods for numericlist
simargs

Access or clear arguments for calls to mrgsim()
tgrid

Create a simtime object
c,tgrid-method

Operations with tgrid objects
plot,batch_mrgsims,missing-method

Plot method for mrgsims objects
sigma

Manipulate SIGMA matrices
zero_re

Zero out random effects in a model object
as.list,mrgsims-method

Coerce an mrgsims object to list
as.ev

Coerce an object to class ev
blocks

Return the code blocks from a model specification file
aboutsolver

About the lsoda differential equation solver used by mrgsolve
Req

Request simulated output
as_data_set

Create a simulation data set from ev objects or data frames
PKMODEL

Parse PKMODEL BLOCK data
BLOCK_PARSE

Functions to parse code blocks
as.list,mrgmod-method

Coerce a model object to list
as_deslist

Create a list of designs from a data frame
cmt_list-class

S4 cmt_list class
cmtn

Get the compartment number from a compartment name
custom_tol

Customize tolerances for specific compartments
check_data_names

Check input data set names against model parameters
cvec

Create create character vectors
cama

Run the model cama function