knitr::opts_chunk$set(
  collapse = TRUE,
  comment = ".",
  fig.path = "man/figures/README-",
  warning = FALSE, 
  message = FALSE,
  fig.width = 5, 
  fig.height = 4
)

pmplots

The goal of pmplots is to create exploratory and diagnostic plots commonly used in pharmacometrics.

Installation

You can install the released version of pmplots from MPN with:

mpn <- "https://mpn.metworx.com/snapshots/stable/2021-06-20"
install.packages("pmplots", repos = mpn)

This installs from a specific, dated snapshot. Please check https://mpn.metworx.com/docs/snapshots/ for the most recent snapshot date.

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("metrumresearchgroup/pmplots")

Examples

library(pmplots)
library(dplyr)

data <- pmplots_data_obs()

The default pmplots behavior is to expect names following NONMEM convention, for example DV refers to observed values, PRED refers to population predicted values. With that convention, we can easily make observed versus predicted plots

dv_pred(data, yname = "MyDrug (ng/ml)")
dv_pred(data, loglog = TRUE)

NPDE plots

npde_time(data)
npde_pred(data)

QQ plots

cwres_q(data)

Exploratory plots

id <- pmplots_data_id()
cont_cat(id, x = "STUDYc", y = c("WT", "SCR", "AAG")) %>% pm_grid()
pairs_plot(id, y = c("WT//Weight (kg)", "SCR//Creat (mg/dL)", "BMI//BMI (kg/m2)"))

Some faceted versions

wrap_cont_time(data, y = c("RES","WRES", "CWRES", "NPDE"), ncol = 2)

Function and workflow overview

A functions and features (code + output) listing is available at pmplots_complete.md.

Suggested packages

Consider installing the cowplot package to help arranging plots on a page. Also, consider installing latex2exp to allow you to use latex in axis titles.



metrumresearchgroup/pmplots documentation built on Oct. 15, 2024, noon