May7_EM6_Analyses

Set up data and libraries

[1] 27.20588

Hypothesis 1

Hypothesis: As the cost to use external resources increases, participants will be inclined to use them less and instead rely more on memory. On the other hand, as the cost to use internal resources increases (i.e. maintaining memory), participants will be inclined to use them less and instead rely more on external resources. Our sampling-delay conditions impose a cost only on external resource use. Our maintenance-delay conditions impose a comparable external use cost and an internal use cost. On balance then, participants should prefer to use less internal memory (and instead rely more on external resources) in the maintenance-delay versus sampling-delay conditions. We expect to see this reflected in significantly lower study times and lower memory usage in the maintenance-delay conditions.

Test: paired TOSTER t-test with a smallest-effect-size-of-interest (SESOI) of Cohen’s dz = 0.4, one for MU and one for Study Time

library(TOSTER)
t_TOST(mean_MU ~ condsFile, data = study_time_FR, paired = TRUE,
       eqb = 0.4, eqbound_type = "SMD")
Warning: setting bound type to SMD produces biased results!

Paired t-test

The equivalence test was significant, t(67) = -3.3, p < 0.01
The null hypothesis test was non-significant, t(67) = 0.021, p = 0.98
NHST: don't reject null significance hypothesis that the effect is equal to zero 
TOST: reject null equivalence hypothesis

TOST Results 
                  t df p.value
t-test      0.02077 67   0.983
TOST Lower  3.31926 67 < 0.001
TOST Upper -3.27771 67 < 0.001

Effect Sizes 
              Estimate     SE              C.I. Conf. Level
Raw           0.003676 0.1770 [-0.2915, 0.2988]         0.9
Hedges's g(z) 0.002491 0.1213 [-0.1947, 0.1997]         0.9
Note: SMD confidence intervals are an approximation. See vignette("SMD_calcs").
t_TOST(mean_StudyTime ~ condsFile, data = study_time_FR, paired = TRUE,
       eqb = 0.4, eqbound_type = "SMD")
Warning: setting bound type to SMD produces biased results!

Paired t-test

The equivalence test was significant, t(67) = -2.5, p < 0.01
The null hypothesis test was non-significant, t(67) = 0.769, p = 0.44
NHST: don't reject null significance hypothesis that the effect is equal to zero 
TOST: reject null equivalence hypothesis

TOST Results 
                 t df p.value
t-test      0.7689 67   0.445
TOST Lower  4.0673 67 < 0.001
TOST Upper -2.5296 67   0.007

Effect Sizes 
              Estimate     SE              C.I. Conf. Level
Raw            0.52736 0.6859 [-0.6167, 1.6714]         0.9
Hedges's g(z)  0.09219 0.1215 [-0.1058, 0.2895]         0.9
Note: SMD confidence intervals are an approximation. See vignette("SMD_calcs").

Memory Usage plot 1

# Calculate means and standard errors
means <- tapply(study_time_FR$mean_MU, study_time_FR$condsFile, mean)

# Calculate standard deviations and sample sizes for each condition
sds <- tapply(study_time_FR$mean_MU, study_time_FR$condsFile, sd)
n_per_condition <- tapply(study_time_FR$mean_MU, study_time_FR$condsFile, length)

# Calculate standard errors
se <- sds / sqrt(n_per_condition)

# Define the x-axis levels (to match the ggplot2 ordering)
conds_levels <- c("sampling_delay", "maintenance_delay")
x_positions <- 1:length(conds_levels)

# Create an empty plot
plot(
  x_positions, means[conds_levels], 
  type = "n", xaxt = "n", ylim = c(-5, 10.0), xlim = c(0.5, 3.5),
  xlab = "", ylab = "Mean Memory Usage (items)", 
  main = "",
  cex.lab = 1.5,
  cex.axis = 1.5,
  cex.main = 1.1
)

participants <- unique(study_time_FR$participant)

for (p in participants) {
  this_participant <- study_time_FR[study_time_FR$participant == p, ]
  if (nrow(this_participant) == 3) {
    # Get the x positions for this participant’s conditions
    x_vals <- match(this_participant$condsFile, conds_levels)
    y_vals <- this_participant$mean_MU
    lines(x_vals, y_vals, col = adjustcolor("#009E73", alpha.f = 0.3), lwd = 1)
  }
}

# Add x-axis labels normally
axis(1, at = x_positions, labels = conds_levels, cex.axis = 1.2)

# Add points for each participant
for (i in 1:length(conds_levels)) {
  condition_data <- study_time_FR[study_time_FR$condsFile == conds_levels[i], ]
  points(rep(x_positions[i], nrow(condition_data)), condition_data$mean_MU, 
         pch = 1, col = "#0072B2")
}

# Add points for the means
points(x_positions, means[conds_levels], pch = 10, col = "black")

# Add a solid line connecting the means
lines(x_positions, means[conds_levels], col = "black", lwd = 2)

# Add horizontal segments at the means (optional, similar to ggplot2's stat_summary)
segments(
  x_positions - 0.1, means[conds_levels], 
  x_positions + 0.1, means[conds_levels],
  col = "black", lwd = 3.0
)

# Add mean labels for each condition
text(x_positions, means[conds_levels] + 2, 
     labels = round(means[conds_levels], 2), cex = 2.5, col = "black")

# Add error bars using arrows() with specified lower and upper bounds
# Function to compute standard error
se <- function(x) sd(x, na.rm = TRUE) / sqrt(sum(!is.na(x)))

# Get standard errors for each condition
ses <- tapply(study_time_FR$mean_MU, study_time_FR$condsFile, se)

# Get means again, just to be sure
means <- tapply(study_time_FR$mean_MU, study_time_FR$condsFile, mean)

# Define bounds for error bars
lower_bounds <- means[conds_levels] - 2*ses[conds_levels]
upper_bounds <- means[conds_levels] + 2*ses[conds_levels]

# Add vertical error bars using arrows()
for (i in 1:length(x_positions)) {
  arrows(
    x0 = x_positions[i], y0 = lower_bounds[i], 
    x1 = x_positions[i], y1 = upper_bounds[i], 
    length = 0.1, angle = 90, code = 3, col = "#D55E00", lwd = 3.5
  )
}

Memory Usage plot 2

# Summary stats
summary_mu <- study_time_FR %>%
  group_by(condsFile) %>%
  summarise(
    mean = mean(mean_MU),
    se = sd(mean_MU) / sqrt(n())
  )

# ggplot version
p_mu <- ggplot(study_time_FR, aes(x = condsFile, y = mean_MU)) +
  geom_jitter(width = 0.1, shape = 1, size = 2,
              color = "blue") +
  geom_point(data = summary_mu,
             aes(x = condsFile, y = mean),
             inherit.aes = FALSE, size = 3) +
  geom_errorbar(data = summary_mu,
                aes(x = condsFile, ymin = mean - 2*se, ymax = mean + 2*se),
                inherit.aes = FALSE, width = 0.15, linewidth = 1.2) +
  geom_segment(data = summary_mu,
               aes(x = as.numeric(condsFile) - 0.1,
                   xend = as.numeric(condsFile) + 0.1,
                   y = mean, yend = mean),
               inherit.aes = FALSE, linewidth = 1) +
  geom_text(data = summary_mu,
            aes(x = condsFile, y = mean + 2, label = round(mean, 2)),
            inherit.aes = FALSE, color = "tomato", size = 9) +
  coord_cartesian(ylim = c(0, 10)) +
  labs(x = "Condition", y = "MU (items remembered)", 
       title = "Mean Memory Usage",
       subtitle = "(First trips only,\n error bars are 2 standard errors)") +
  scale_x_discrete(labels = c(
    "sampling_delay" = "Sampling delay",
    "maintenance_delay" = "Maintenance delay"
  )) +
  theme_minimal(base_size = 20)

p_mu

Study time plot 1

# Calculate means
means <- tapply(study_time_FR$mean_StudyTime, study_time_FR$condsFile, mean)

# Define the x-axis levels (to match the ggplot2 ordering)
conds_levels <- c("sampling_delay", "maintenance_delay")
x_positions <- 1:length(conds_levels)

# Create an empty plot
plot(
  x_positions, means[conds_levels], 
  type = "n", xaxt = "n", ylim = c(0, 30.0), xlim = c(0.5, 3.5),
  xlab = "", ylab = "Mean Study Time (seconds)", 
  main = "",
  cex.lab = 1.5,
  cex.axis = 1.5,
  cex.main = 1.1
)

participants <- unique(study_time_FR$participant)

for (p in participants) {
  this_participant <- study_time_FR[study_time_FR$participant == p, ]
  if (nrow(this_participant) == 3) {
    # Get the x positions for this participant’s conditions
    x_vals <- match(this_participant$condsFile, conds_levels)
    y_vals <- this_participant$mean_StudyTime
    lines(x_vals, y_vals, col = adjustcolor("#009E73", alpha.f = 0.3), lwd = 1)
  }
}

# Add x-axis labels normally
axis(1, at = x_positions, labels = conds_levels, cex.axis = 1.2)

# Add points for each participant
for (i in 1:length(conds_levels)) {
  condition_data <- study_time_FR[study_time_FR$condsFile == conds_levels[i], ]
  points(rep(x_positions[i], nrow(condition_data)), condition_data$mean_StudyTime, 
         pch = 1, col = "#0072B2")
}

# Add points for the means
points(x_positions, means[conds_levels], pch = 10, col = "black")

# Add a solid line connecting the means
lines(x_positions, means[conds_levels], col = "black", lwd = 2)

# Add horizontal segments at the means (optional, similar to ggplot2's stat_summary)
segments(
  x_positions - 0.1, means[conds_levels], 
  x_positions + 0.1, means[conds_levels],
  col = "black", lwd = 3.0
)

# Add mean labels for each condition
text(x_positions, means[conds_levels] + 3, 
     labels = round(means[conds_levels], 2), cex = 2.5, col = "black")

# Add error bars using arrows() with specified lower and upper bounds
# Function to compute standard error
se <- function(x) sd(x, na.rm = TRUE) / sqrt(sum(!is.na(x)))

# Get standard errors for each condition
ses <- tapply(study_time_FR$mean_StudyTime, study_time_FR$condsFile, se)

# Get means again, just to be sure
means <- tapply(study_time_FR$mean_StudyTime, study_time_FR$condsFile, mean)

# Define bounds for error bars
lower_bounds <- means[conds_levels] - 2*ses[conds_levels]
upper_bounds <- means[conds_levels] + 2*ses[conds_levels]


# Add vertical error bars using arrows()
for (i in 1:length(x_positions)) {
  arrows(
    x0 = x_positions[i], y0 = lower_bounds[i], 
    x1 = x_positions[i], y1 = upper_bounds[i], 
    length = 0.1, angle = 90, code = 3, col = "#D55E00", lwd = 3.5
  )
}

Study time plot 2

# Summary stats
summary_df <- study_time_FR %>%
  group_by(condsFile) %>%
  summarise(
    mean = mean(mean_StudyTime),
    se = sd(mean_StudyTime) / sqrt(n())
  )

# Plot
p <- ggplot(study_time_FR, aes(x = condsFile, y = mean_StudyTime)) +
  geom_jitter(width = 0.1, shape = 1, size = 2,
              color = "blue") +
  geom_point(data = summary_df,
             aes(x = condsFile, y = mean),
             inherit.aes = FALSE,size = 3) +
  geom_errorbar(data = summary_df,
                aes(x = condsFile, ymin = mean - 2*se, ymax = mean + 2*se),
                inherit.aes = FALSE,
                width = 0.15, linewidth = 1.2) +
  geom_segment(data = summary_df,
               aes(x = as.numeric(condsFile) - 0.1,
                   xend = as.numeric(condsFile) + 0.1,
                   y = mean, yend = mean),
               inherit.aes = FALSE, linewidth = 1) +
  geom_text(data = summary_df,
            aes(x = condsFile, y = mean + 5, label = round(mean, 2)),
            inherit.aes = FALSE, color = "tomato", size = 9) +
  coord_cartesian(ylim = c(0, 40)) +
  labs(x = "Condition", y = "Mean Study Time, seconds",
       title = "Mean study time", subtitle = "(First trips only, error bars are 2 standard errors)") +
  scale_x_discrete(labels = c(
    "sampling_delay" = "Sampling delay",
    "maintenance_delay" = "Maintenance delay"
  )) +
  theme_minimal(base_size = 20)

p

Hypothesis 2

Hypothesis: When allowed to choose how many attempts to make, participants will tend to be overly conservative and therefore underperform. Given this, if participants are obliged to respond despite their risk aversion, memory usage (MU) will increase. We predict then that, across all conditions, MU(total) (as measured in Total-response trials) will be higher than MU(free) (as measured in Free-response trials). Further, we expect an interaction, with this difference being larger in the maintenance-delay condition and smaller in the sampling-delay condition.

Test: Multiple regression (lmer) TOSTER

All_conditions <- performance %>%
  group_by(participant, condsFile) %>%
  summarize(mean_MU = mean(meanMU, na.rm = TRUE),
            mean_StudyTime = mean(meanListTime, na.rm = TRUE), 
            .groups = 'drop')

All_conditions <- All_conditions %>%
  mutate(conditionType = ifelse(grepl("Closing", condsFile), "TotalResponse", "FreeResponse"))

All_conditions <- All_conditions %>%
  mutate(condsFileSimplified = ifelse(grepl("maintenance", condsFile), "maintenance", "sampling"))

library(lme4)
Loading required package: Matrix

Attaching package: 'Matrix'
The following objects are masked from 'package:tidyr':

    expand, pack, unpack
library(lmerTest)

Attaching package: 'lmerTest'
The following object is masked from 'package:lme4':

    lmer
The following object is masked from 'package:stats':

    step
library(negligible)

hypothesis2 <- lmer(mean_MU ~ conditionType + condsFileSimplified + 
                      condsFileSimplified*conditionType + (1 | participant),
                    All_conditions)

lower <- contest1D(hypothesis2, c(0, 1, 0, 0), confint=TRUE, rhs=-0.4) # get t value for test against lower bound
upper <- contest1D(hypothesis2, c(0, 1, 0, 0), confint=TRUE, rhs=0.4) # get t value for test against upper bound

print("Below is the lower bound:")
[1] "Below is the lower bound:"
lower$`Pr(>|t|)`/2  # test against lower bound
[1] 0.1012923
print("Below is the upper bound:")
[1] "Below is the upper bound:"
upper$`Pr(>|t|)`/2  # test against upper bound
[1] 0.109649

Free VS Total plot

# Calculate means and standard errors
means <- tapply(All_conditions$mean_MU, All_conditions$conditionType, mean)

# Calculate standard deviations and sample sizes for each condition
sds <- tapply(All_conditions$mean_MU, All_conditions$conditionType, sd)
n_per_condition <- tapply(All_conditions$mean_MU, All_conditions$conditionType, length)

# Calculate standard errors
se <- sds / sqrt(n_per_condition)

# Define the x-axis levels (to match the ggplot2 ordering)
conds_levels <- c("FreeResponse", "TotalResponse")
x_positions <- 1:length(conds_levels)

# Create an empty plot
plot(
  x_positions, means[conds_levels], 
  type = "n", xaxt = "n", ylim = c(-5, 10.0), xlim = c(0.5, 2.5),
  xlab = "", ylab = "Mean Memory Usage (items)", 
  main = "",
  cex.lab = 1.5,
  cex.axis = 1.5,
  cex.main = 1.5
)


participants <- unique(All_conditions$participant)

for (p in participants) {
  this_participant <- All_conditions[All_conditions$participant == p, ]
  if (nrow(this_participant) == 2) {
    # Get the x positions for this participant’s conditions
    x_vals <- match(this_participant$condType, conds_levels)
    y_vals <- this_participant$mean_MU
    lines(x_vals, y_vals, col = adjustcolor("#009E73", alpha.f = 0.3), lwd = 1)
  }
}

# Add x-axis labels normally
axis(1, at = x_positions, labels = conds_levels, cex.axis = 1.6)

# Add points for each participant
for (i in 1:length(conds_levels)) {
  condition_data <- All_conditions[All_conditions$conditionType == conds_levels[i], ]
  points(rep(x_positions[i], nrow(condition_data)), condition_data$mean_MU, 
         pch = 1, col = "#0072B2")
}

# Add points for the means
points(x_positions, means[conds_levels], pch = 10, col = "black")

# Add a solid line connecting the means
lines(x_positions, means[conds_levels], col = "black", lwd = 2)

# Add horizontal segments at the means (optional, similar to ggplot2's stat_summary)
segments(
  x_positions - 0.1, means[conds_levels], 
  x_positions + 0.1, means[conds_levels],
  col = "black", lwd = 3.0
)

# Add mean labels for each condition
text(x_positions, means[conds_levels] + 2, 
     labels = round(means[conds_levels], 2), cex = 2.5, col = "black")

# Add error bars using arrows() with specified lower and upper bounds
# Function to compute standard error
se <- function(x) sd(x, na.rm = TRUE) / sqrt(sum(!is.na(x)))

# Get standard errors for each condition
ses <- tapply(All_conditions$mean_MU, All_conditions$conditionType, se)

# Get means again, just to be sure
means <- tapply(All_conditions$mean_MU, All_conditions$conditionType, mean)

# Define bounds for error bars
lower_bounds <- means[conds_levels] - 2*ses[conds_levels]
upper_bounds <- means[conds_levels] + 2*ses[conds_levels]


# Add vertical error bars using arrows()
for (i in 1:length(x_positions)) {
  arrows(
    x0 = x_positions[i], y0 = lower_bounds[i], 
    x1 = x_positions[i], y1 = upper_bounds[i], 
    length = 0.1, angle = 90, code = 3, col = "#D55E00", lwd = 3.5
  )
}

Hypothesis 3

Hypothesis: From our work and work from other labs, we anticipate (alongside our main effects) that there to be considerable individual variation in MU. There are two factors relevant to memory usage that can underlie this, differences in working memory capacity (here, the relative ease with which a certain number of list items can be encoded and maintained in memory) and differences in effort (here, the time and cognitive effort one is willing to devote toward the encoding and maintenance of memory). If individual differences in MU are driven largely by differences in capacity, with participants exerting similar effort levels, we should see a strong relationship between study time and MU, but a relatively weak association between TEPR and MU. We hypothesize, instead, that individual differences in MU are driven largely by differences in effort, with participants coming to the task with similar memory capacity. We expect individual participants to differ in their disposition towards completing the task, such that they will tend toward either “loading up” internal memory during their first trip (heavy loaders) or balancing their memory usage out across multiple trips (light lifters). This predicts a strong relationship between both study time and TEPR with MU. However, since TEPR and study time are both driven by the same underlying variable - effort (i.e. greater effort manifests both as longer study time to ‘load up’ on more items and, consequentially, greater TEPR to maintain that larger load) - we expect that TEPR will not account for a substantial additional variance over and above that accounted for by study time. We hypothesize that most of this difference can be accounted for by differences in relative effort.

Test: Multiple regression (lmer) TOSTER

hypothesis3 <- lmer(mean_MU ~ mean_StudyTime + avg_pupil_change +
             (1 | participant), 
           pupil_performance)

lower <- contest1D(hypothesis3, c(0, 0, 1), confint=TRUE, rhs=-0.4) 
upper <- contest1D(hypothesis3, c(0, 0, 1), confint=TRUE, rhs=0.4)

print("Below is the lower bound:")
[1] "Below is the lower bound:"
lower$`Pr(>|t|)`/2  # test against lower bound
[1] 0.2117406
print("Below is the upper bound:")
[1] "Below is the upper bound:"
upper$`Pr(>|t|)`/2  # test against upper bound
[1] 0.3910864

Diagnostic check: Variance inflation (VIF) score for study time and pupil. They will be identical, but we should check it.

library(car)
Loading required package: carData

Attaching package: 'car'
The following object is masked from 'package:dplyr':

    recode
The following object is masked from 'package:purrr':

    some
library(performance)

plot(hypothesis3, which = 1, main = "Model Fit")

vif_h3 <- vif(hypothesis3)
vif_h3 
  mean_StudyTime avg_pupil_change 
        1.016744         1.016744 

Correlation check: TOSTER Kendall correlations. Only MU and Study time are significantly correlated. The slight negative correlation between pupil and study time suggest super long study times are participants “taking their time” to remember them all, which might be less effortful than trying to remember them all in shorter periods of time.

library(TOSTER)
  
z_cor_test(pupil_performance$mean_StudyTime[complete.cases(pupil_performance$mean_StudyTime, pupil_performance$avg_pupil_change)],
           pupil_performance$avg_pupil_change[complete.cases(pupil_performance$mean_StudyTime, pupil_performance$avg_pupil_change)],
           method = "kendall")

    Kendall's rank correlation tau

data:  pupil_performance$mean_StudyTime[complete.cases(pupil_performance$mean_StudyTime,  and pupil_performance$avg_pupil_change[complete.cases(pupil_performance$mean_StudyTime,     pupil_performance$avg_pupil_change)] and     pupil_performance$avg_pupil_change)]
z = -1.9839, N = 198, p-value = 0.04726
alternative hypothesis: true tau is not equal to 0
95 percent confidence interval:
 -0.185026854 -0.001137802
sample estimates:
        tau 
-0.09388299 
z_cor_test(pupil_performance$mean_MU[complete.cases(pupil_performance$mean_MU, pupil_performance$avg_pupil_change)],
           pupil_performance$avg_pupil_change[complete.cases(pupil_performance$mean_MU, pupil_performance$avg_pupil_change)],
           method = "kendall")

    Kendall's rank correlation tau

data:  pupil_performance$mean_MU[complete.cases(pupil_performance$mean_MU,  and pupil_performance$avg_pupil_change[complete.cases(pupil_performance$mean_MU,     pupil_performance$avg_pupil_change)] and     pupil_performance$avg_pupil_change)]
z = -0.94079, N = 198, p-value = 0.3468
alternative hypothesis: true tau is not equal to 0
95 percent confidence interval:
 -0.13681018  0.04833383
sample estimates:
        tau 
-0.04462131 
z_cor_test(pupil_performance$mean_MU[complete.cases(pupil_performance$mean_MU, pupil_performance$mean_StudyTime)],
           pupil_performance$mean_StudyTime[complete.cases(pupil_performance$mean_MU, pupil_performance$mean_StudyTime)],
           method = "kendall")

    Kendall's rank correlation tau

data:  pupil_performance$mean_MU[complete.cases(pupil_performance$mean_MU,  and pupil_performance$mean_StudyTime[complete.cases(pupil_performance$mean_MU,     pupil_performance$mean_StudyTime)] and     pupil_performance$mean_StudyTime)]
z = 10.452, N = 272, p-value < 0.00000000000000022
alternative hypothesis: true tau is not equal to 0
95 percent confidence interval:
 0.3300792 0.4630654
sample estimates:
      tau 
0.3986659 
library(ggplot2)

ggplot(pupil_performance, aes(x = mean_StudyTime, y = avg_pupil_change)) +
  geom_point(color = "blue", alpha = 0.6) +  # Scatter points
  geom_smooth(method = "lm", color = "red", se = FALSE) +  # Linear trend line
  labs(title = "Correlation between Study Time and Pupil Dilation",
       x = "Average Study Time",
       y = "Average Pupil Dilation") +
  theme_minimal()
`geom_smooth()` using formula = 'y ~ x'

ggplot(pupil_performance, aes(x = mean_MU, y = avg_pupil_change)) +
  geom_point(color = "blue", alpha = 0.6) +  # Scatter points
  geom_smooth(method = "lm", color = "red", se = FALSE) +  # Linear trend line
  labs(title = "Correlation between MU and Pupil Dilation",
       x = "Average MU",
       y = "Average Pupil Dilation") +
  theme_minimal()
`geom_smooth()` using formula = 'y ~ x'

ggplot(pupil_performance, aes(x = mean_MU, y = mean_StudyTime)) +
  geom_point(color = "blue", alpha = 0.6) +  # Scatter points
  geom_smooth(method = "lm", color = "red", se = FALSE) +  # Linear trend line
  labs(title = "Correlation between MU and Study time",
       x = "Average MU",
       y = "Average study time") +
  theme_minimal()
`geom_smooth()` using formula = 'y ~ x'

Pupil plot

average_trace <- ET %>%
  filter(!is.na(d_time)) %>%
  group_by(milliseconds) %>%
  summarize(
    mean_change = mean(change_from_baseline, na.rm = TRUE),
    se = sd(change_from_baseline, na.rm = TRUE) / sqrt(n()),
    .groups = "drop"
  )

ggplot(average_trace, aes(x = milliseconds, y = mean_change)) +
  geom_ribbon(aes(ymin = mean_change - 2*se, ymax = mean_change + 2*se), alpha = 0.2, fill = "gray50") +
  geom_line(size = 1, color = "steelblue") +  
  labs(title = "Averaged trace of the change-from-baseline \npupil size",
       subtitle = "Maintenance delay condition, gray fill is 2 standard errors",
       x = "Milliseconds",
       y = "Avg Change-from-baseline (mm)") +
  theme_minimal(base_size = 19) +
  coord_cartesian(ylim = c(-0.15, 0.4)) + 
  annotate("rect", xmin = 2000, xmax = 5000, ymin = -Inf, ymax = Inf,
           alpha = 0.1, fill = "red") + 
  annotate("text", x = 4000, y = 0.4, label = "Window for analysis", 
           color = "red", size = 4, fontface = "italic")


Hypothesis 4

Hypothesis: We have included a Mental Calculation task to validate our pupillometry pipeline. There are two conditions, easy and hard. Since performing mental arithmetic consistently results in pupil dilations that increase with the difficulty of the arithmetic task (Borys et al., 2017; Marquart & de Winter, 2015), we expect that we will find a larger pupil dilation for “hard” compared to “easy” math problems during the period that participants are performing the mental calculation. We expect the TEPR to be larger in the hard math problems.

Test: paired TOSTER t-test