Pupil_summary

Mental calculation

We should be able to, very reliably, expect a difference here in the pupil!

Average trace for easy and hard problems:

Separating the trace for easy and hard problems into an arbitrary 5 bins:

Shopping game, maintenance delay

Visualize:

# Filter, group, and calculate the averages
merged_data <- merged_data %>%
  mutate(MU = ifelse(mean_MU > 8, "over8", "under8"))

average_trace <- merged_data %>%
  filter(!is.na(d_time)) %>%
  group_by(MU, milliseconds) %>%
  summarize(mean_change = mean(change_from_baseline, na.rm = TRUE), .groups = "drop")

ggplot(average_trace, aes(x = milliseconds, y = mean_change, group = MU, color = as.factor(MU))) +
  geom_line(size = 1) +  
  labs(title = "Avg Trace of Baseline Corrected Pupil Across Avg MUs",
       subtitle = "blah",
       x = "Milliseconds",
       y = "Avg Pupil Change (mm)") +
  theme_minimal() +
  theme(legend.position = "bottom") +
  scale_color_viridis_d() +
  coord_cartesian(ylim = c(-0.4, 0.5)) 

Old median split: Shopping game, maintenance delay

Visualize: