## ----setup, message = FALSE---------------------------------------------------
library(dplyr)
library(mrgsim.sa)
library(patchwork)
library(ggplot2)

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(fig.height = 4, comment = ".", fig.align = "center")

## -----------------------------------------------------------------------------
mod <- house(outvars = "CP,RESP")

## -----------------------------------------------------------------------------
param(mod)

## -----------------------------------------------------------------------------
outvars(mod)

## -----------------------------------------------------------------------------
out <- 
  mod %>% 
  ev(amt = 100) %>% 
  parseq_fct(CL, VC, .factor = 2, .n = 5) %>% 
  sens_each()

## -----------------------------------------------------------------------------
param(mod)[c("CL", "VC")]

## -----------------------------------------------------------------------------
out
class(out)

## -----------------------------------------------------------------------------
count(out, p_name, dv_name)

## ----fig.height = 4, fig.width = 7--------------------------------------------
sens_plot(out, "RESP")

## -----------------------------------------------------------------------------
mod %>% 
  ev(amt = 100) %>% 
  parseq_cv(CL, .cv = 50, .nsd = 2) %>% 
  sens_each() %>% 
  sens_plot("CP")

## ----fig.height = 4, fig.width = 7--------------------------------------------
out <- 
  mod %>% 
  ev(amt = 100, ii = 24, addl = 10) %>%
  update(end = 240) %>% 
  parseq_manual(VC = seq(10,100,20)) %>% 
  sens_each()

sens_plot(out, "CP")

## -----------------------------------------------------------------------------
out <- 
  mod %>% 
  ev(amt = 100) %>%
  parseq_fct(CL, KA, .n = 4) %>% 
  sens_each(end = 96)

## ----fig.height = 6, fig.width = 7--------------------------------------------
sens_plot(out, layout = "facet_wrap")

## ----fig.height = 6, fig.width = 7--------------------------------------------
sens_plot(out, layout = "facet_grid")

## ----fig.height = 4, fig.width = 7--------------------------------------------
sens_plot(out, dv_name = "CP", grid = TRUE)

## ----fig.height = 6, fig.width = 7--------------------------------------------
out %>% 
  select_sens(dv_name = "RESP,CP") %>% 
  sens_plot(grid = TRUE) %>% 
  patchwork::wrap_plots(ncol = 1)

## ----fig.height = 4, fig.width = 7, eval = requireNamespace("ggsci")----------
sens_plot(
  out, 
  "CP", 
  grid = TRUE,
  palette = ggsci::scale_color_atlassian()
)

