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

## -----------------------------------------------------------------------------
library(gp3bayes)
sim <- simulate_advanced_pupil_timecourse(
  n_participants = 12,
  trials_per_participant = 4,
  time_points = 41,
  seed = 3020
)

## -----------------------------------------------------------------------------
gp32 <- create_pupil_gp_spec("matern32", "approximate", k = 30)
gp52 <- create_pupil_gp_spec("matern52", "approximate", k = 30)
gpeq <- create_pupil_gp_spec("exp_quad", "approximate", k = 30)

gp32
gp52
gpeq

## -----------------------------------------------------------------------------
spec <- specify_advanced_pupil_timecourse_model(
  sim$data,
  temporal_structure = "gaussian_process",
  gp_spec = gp32,
  family = "gaussian",
  autocorrelation = "none",
  predictive_target = "future_segment"
)

spec
plot_pupil_model_complexity(spec)

## ----eval=FALSE---------------------------------------------------------------
# fit <- fit_advanced_pupil_model_backend(spec, backend = "cmdstanr")
# hyper <- pupil_gp_hyperparameters(fit)
# pupil_gp_table(hyper)
# plot_pupil_gp_hyperparameters(hyper)
# 
# trajectory <- predict_advanced_pupil_trajectory(fit)
# plot_advanced_pupil_trajectory(trajectory)

