Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mrgsolve_package

mrgsolve


Description

mrgsolve is an R package maintained under the auspices of Metrum Research Group that facilitates simulation from models based on systems of ordinary differential equations (ODE) that are typically employed for understanding pharmacokinetics, pharmacodynamics, and systems biology and pharmacology. mrgsolve consists of computer code written in the R and C++ languages, providing an interface to a C++ translation of the lsoda differential equation solver. See aboutsolver for more information.

Resources

Package-wide options

  • mrgolve.project: sets the default project director (mread)

  • mrgsolve.soloc: sets the default package build directory (mread)

  • mrgsolve_mread_quiet: don't print messages during mread

  • mrgsolve.update.strict: if TRUE, print warning when trying to update an item in the model object that doesn't exist

Examples

## example("mrgsolve")

mod <- mrgsolve::house(delta=0.1)  %>% param(CL=0.5)

events <-  ev(amt=1000, cmt=1, addl=5, ii=24)

events

mod

see(mod)

## Not run: 
stime(mod)

## End(Not run)
param(mod)

init(mod)

out <- mod %>% ev(events) %>% mrgsim(end=168)

head(out)
tail(out)
dim(out)

plot(out, GUT+CP~.)

sims <- as.data.frame(out)

t72 <- dplyr::filter(sims, time==72)

str(t72)

idata <- data.frame(ID=c(1,2,3), CL=c(0.5,1,2),VC=12)
out <- mod %>% ev(events) %>% mrgsim(end=168, idata=idata, req="")
plot(out)

out <- mod %>% ev(events) %>% mrgsim(carry_out="amt,evid,cmt,CL")
head(out)

ev1 <- ev(amt=500, cmt=2,rate=10)
ev2 <- ev(amt=100, cmt=1, time=54, ii=8, addl=10)
events <- c(ev1+ev2)
events

out <- mod %>% ev(events) %>% mrgsim(end=180, req="")
plot(out)



## "Condensed" data set
data(extran1)
extran1

out <- mod %>% data_set(extran1) %>% mrgsim(end=200)

plot(out,CP~time|factor(ID))


## idata
data(exidata)

out <- 
  mod %>% 
  ev(amt=1000, cmt=1) %>% 
  idata_set(exidata) %>%  
  mrgsim(end=72)

plot(out, CP~., as="log10")


# Internal model library
## Not run: 
mod <- mread("irm1", modlib())

mod

x <- mod %>% ev(amt=300, ii=12, addl=3) %>% mrgsim


## End(Not run)

mrgsolve

Simulate from ODE-Based Models

v0.11.1
GPL (>= 2)
Authors
Kyle T Baron [aut, cre] (<https://orcid.org/0000-0001-7252-5656>), Bill Gillespie [ctb], Charles Margossian [ctb], Devin Pastoor [ctb], Bill Denney [ctb] (<https://orcid.org/0000-0002-5759-428X>), Dilawar Singh [ctb], Felicien Le Louedec [ctb] (<https://orcid.org/0000-0003-3699-2729>), Timothy Waterhouse [ctb] (<https://orcid.org/0000-0002-0954-9660>), Metrum Research Group [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.