library(lattice)
library(knitr)
knitr::opts_chunk$set(
  comment = ".",
  fig.path = "man/figures/README-"
)
options(tibble.print_min = 5, tibble.print_max = 5)

mrgsolve

Build Status CRAN License questions MetrumRG

mrgsolve is an R package for simulation from hierarchical, ordinary differential equation (ODE) based models typically employed in drug development. mrgsolve is free and open-source software.

Resources

Please see mrgsolve.github.io for additional resources, including:

Installation

Install the latest release on CRAN

install.packages("mrgsolve")

Please be sure to see important install-related information here.

Install the current development version

remotes::install_github("metrumresearchgroup/mrgsolve@develop")

Interaction

We welcome questions about anything mrgsolve: installation, getting your model to work, understanding better how mrgsolve works. We also welcome suggestions for how to make mrgsolve more useful to you and to the pharmacometrics community.

Please interact with us at the Issue Tracker. This requires a GitHub account.

Some examples

A simple simulation

options(mrgsolve_mread_quiet = TRUE)
library(mrgsolve)

Load a model from the internal library

mod <- mread("pk1", modlib())

Simulate a simple regimen

mod %>% 
  ev(amt = 100, ii = 24, addl = 9) %>%
  mrgsim(end = 300, delta = 0.1) %>% 
  plot(CP~time)

A more complicated regimen: 100 mg infusions over 2 hours every 24 hours for one week, followed by 50 mg boluses every 12 hours for 10 days:

mod %>% 
  ev_rx("100 over 2h q 24 x 7 then 50 q 12 x 20") %>%
  mrgsim(end = 600, delta = 0.1) %>% 
  plot(CP~time)

Population simulation

mod <- mread("popex", modlib()) %>% zero_re()

A data set looking at different patient weights and doses

library(dplyr)

data <- expand.ev(amt = c(100,150), WT = seq(40,140,20)) %>% mutate(dose = amt)

head(data)

Simulate

mod %>% 
  data_set(data) %>% 
  carry_out(dose,WT) %>%
  mrgsim(delta = 0.1, end = 72) %>% 
  plot(IPRED~time|factor(dose),scales = "same")

Sensitivity analysis with PBPK model

mod <- modlib("pbpk")

Reference

blocks(mod,PROB) 

Model parameters

param(mod)

Set up a batch to simulate

idata <- expand.idata(Kpli = seq(4,20,2))

idata
mod %>% 
  ev(amt = 150) %>% 
  idata_set(idata) %>%
  mrgsim(end = 6, delta = 0.1) %>%
  plot(Cp~time)


metrumresearchgroup/mrgsolve documentation built on Feb. 13, 2024, 10:27 p.m.