Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/metrumresearchgroup/mrgsolve

Simulate from ODE-based population PK/PD and QSP models in R
https://github.com/metrumresearchgroup/mrgsolve

mrgsolve ode r rstats

Last synced: about 1 month ago
JSON representation

Simulate from ODE-based population PK/PD and QSP models in R

Awesome Lists containing this project

README

        

---
pagetitle: "mrgsolve"
date: ""
author: ""
output: github_document
---

```{r,echo=FALSE}
library(lattice)
library(knitr)
```

```{r, include = FALSE}
knitr::opts_chunk$set(
comment = ".",
fig.path = "man/figures/README-"
)
options(tibble.print_min = 5, tibble.print_max = 5)
```

# mrgsolve

[![Build Status](https://github.com/metrumresearchgroup/mrgsolve/actions/workflows/main.yaml/badge.svg)](https://github.com/metrumresearchgroup/mrgsolve/actions/workflows/main.yaml)
[![CRAN](http://www.r-pkg.org/badges/version/mrgsolve)](https://cran.r-project.org/package=mrgsolve)
[![License](http://img.shields.io/badge/license-GPL%20%28%3E=%202%29-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html)
[![questions](https://img.shields.io/badge/ask_for-Help-brightgreen.svg)](https://github.com/metrumresearchgroup/mrgsolve/issues)
[![MetrumRG](https://img.shields.io/badge/contact-MetrumRG-brightgreen.svg)](http://metrumrg.com)

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](https://mrgsolve.github.io) for additional
resources, including:

- [User Guide](https://mrgsolve.github.io/user_guide)
- [R Documentation](https://mrgsolve.github.io/docs)
- [Vignettes](https://mrgsolve.github.io/vignettes)
- [Gallery](https://github.com/mrgsolve/gallery)

## Installation

Install the latest release on CRAN
```{r,eval=FALSE}
install.packages("mrgsolve")
```

__Please__ be sure to see important install-related information
[here](https://github.com/metrumresearchgroup/mrgsolve/wiki/mrgsolve-Installation).

Install the current development version

```{r,eval=FALSE}
remotes::install_github("metrumresearchgroup/mrgsolve")
```

## 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](https://github.com/metrumresearchgroup/mrgsolve/issues).
This requires a GitHub account.

## Some examples

### A simple simulation
```{r,echo=FALSE}
options(mrgsolve_mread_quiet = TRUE)
```

```{r,message=FALSE}
library(mrgsolve)
```

Load a model from the internal library
```{r}
mod <- mread("pk1", modlib())
```

Simulate a simple regimen
```{r,pk-figure}
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:

```{r,regimen-figure}
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

```{r}
mod <- mread("popex", modlib()) %>% zero_re()
```

A data set looking at different patient weights and doses

```{r, message=FALSE}
library(dplyr)

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

head(data)
```

Simulate
```{r, population-figure}
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

```{r}
mod <- modlib("pbpk")
```

Reference

```{r, comment = " ", echo=FALSE}
blocks(mod,PROB)
```

Model parameters

```{r}
param(mod)
```

Set up a batch to simulate
```{r}
idata <- expand.idata(Kpli = seq(4,20,2))

idata
```

```{r, pbpk-figure}
mod %>%
ev(amt = 150) %>%
idata_set(idata) %>%
mrgsim(end = 6, delta = 0.1) %>%
plot(Cp~time)
```