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

## -----------------------------------------------------------------------------
simulation <- simulate_hierarchical_binary_data(
  n_participants = 12,
  trials_per_participant = 10,
  n_items = 6,
  random_slope_sd = 0,
  seed = 11
)

contract <- create_model_contract(
  family = "binary",
  outcome_col = "selected",
  participant_col = "participant_id",
  item_col = "item_id",
  trial_col = "trial_id",
  condition_col = "condition",
  predictors = "trial_covariate"
)

## -----------------------------------------------------------------------------
with_missing <- simulation$data
with_missing$trial_covariate[c(3, 17, 41)] <- NA_real_

missingness <- audit_missingness_structure(
  with_missing,
  contract
)
missingness
plot(missingness)

## -----------------------------------------------------------------------------
fixed_design <- audit_fixed_effect_design(
  simulation$data,
  contract
)
fixed_design
plot(fixed_design)

## -----------------------------------------------------------------------------
random_support <- audit_random_effects_support(
  simulation$data,
  contract
)
random_support
plot(random_support)

## -----------------------------------------------------------------------------
design <- audit_design_support(
  simulation$data,
  contract,
  separation = FALSE,
  strict_readiness = TRUE
)
design
plot(design)

## ----eval=FALSE---------------------------------------------------------------
# audit_design_support(
#   simulation$data,
#   contract,
#   separation = TRUE
# )

