## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.width = 7, fig.height = 4.5)

## -----------------------------------------------------------------------------
library(gp3bayes)
sim <- simulate_binocular_pupil_timecourse(
  n_participants = 12,
  trials_per_participant = 4,
  time_points = 31,
  residual_correlation = 0.70,
  eye_bias = 0.02,
  seed = 3040
)
prep <- prepare_binocular_pupil_timecourse(sim$data)
prep
audit_binocular_pupil_readiness(prep)

## -----------------------------------------------------------------------------
spec <- specify_binocular_pupil_model(
  prep,
  temporal_structure = "smooth",
  family = "gaussian",
  residual_correlation = TRUE
)
spec

## ----eval=FALSE---------------------------------------------------------------
# fit <- fit_binocular_pupil_model(
#   spec,
#   backend = "cmdstanr",
#   chains = 4,
#   cores = 2
# )
# 
# trajectory <- estimate_binocular_pupil_trajectory(fit)
# plot_binocular_pupil_trajectory(trajectory)
# 
# pupil_binocular_correlation(fit)
# pupil_binocular_difference(trajectory)
# pupil_binocular_agreement_table(trajectory, tolerance = 0.10)

