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

## -----------------------------------------------------------------------------
library(gp3bayes)
sim <- simulate_pupil_response_shape(
  n_participants = 12,
  trials_per_participant = 4,
  time_points = 41,
  condition_amplitude_ratio = 1.25,
  condition_onset_shift = 100,
  seed = 3060
)

## -----------------------------------------------------------------------------
spec <- specify_pupil_response_shape_model(
  sim$data,
  family = "gaussian",
  condition_effects = c("amplitude", "onset", "duration"),
  participant_effects = c("baseline", "amplitude")
)
spec

## ----eval=FALSE---------------------------------------------------------------
# translated <- translate_pupil_response_shape_to_brms(spec)
# fit <- fit_pupil_response_shape_model(
#   spec,
#   backend = "cmdstanr",
#   chains = 4,
#   iter = 2500,
#   warmup = 1250,
#   cores = 2
# )
# 
# pars <- estimate_pupil_response_parameters(fit)
# pupil_response_parameter_table(pars)
# plot_pupil_response_parameters(pars)

