## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(FragiliTidy)
library(dplyr)
library(tibble)

## -----------------------------------------------------------------------------
trials <- tribble(
  ~study,    ~ie, ~ce, ~in_, ~cn,
  "Trial A",  10,  20,  100,  100,
  "Trial B",   5,  15,   80,   80,
  "Trial C",  30,  30,  200,  200
)

trials |>
  fragility_index(ie, ce, in_, cn) |>
  revfragility_index(ie, ce, in_, cn)

## -----------------------------------------------------------------------------
set.seed(1)
x <- rnorm(50, mean = 70, sd = 10)
y <- rnorm(50, mean = 50, sd = 10)
continuous_fragility_index_raw(x, y)

## -----------------------------------------------------------------------------
continuous_fragility_index_summary(
  mean1 = 70, sd1 = 10, n1 = 100,
  mean2 = 50, sd2 = 10, n2 = 100,
  seed  = 1
)

## -----------------------------------------------------------------------------
reverse_continuous_fragility_index_summary(
  mean1 = 55, sd1 = 10, n1 = 30,
  mean2 = 50, sd2 = 10, n2 = 30,
  seed  = 1
)

## -----------------------------------------------------------------------------
trials_continuous <- tribble(
  ~study,    ~m1, ~s1, ~k1, ~m2, ~s2, ~k2,
  "Trial X",  70,  10,  50,  50,  10,  50,
  "Trial Y",  60,  15,  40,  55,  15,  40
)

trials_continuous |>
  continuous_fragility_index(m1, s1, k1, m2, s2, k2) |>
  reverse_continuous_fragility_index(m1, s1, k1, m2, s2, k2)

