library(readxl)
## Warning: package 'readxl' was built under R version 4.4.2
pilota <- read_excel("C:\\Users\\Owner\\OneDrive\\Documents\\PilotA.xlsx")
brush_count <- sum(pilota$Distorted == 2 & pilota$Condition == "Brush")
arial_count <- sum(pilota$Distorted == 2 & pilota$Condition == "Arial")

brush_total <- sum(pilota$Condition == "Brush")
arial_total <- sum(pilota$Condition == "Arial")

p1 <- brush_count / brush_total
p2 <- arial_count / arial_total

p <- (brush_count + arial_count) / (brush_total + arial_total)

z <- (p1 - p2) / sqrt(p * (1 - p) * (1 / brush_total + 1 / arial_total))
z
## [1] -0.58554
p_value <- 2 * (1 - pnorm(abs(z)))
p_value
## [1] 0.5581846
# link to experiment (one for each condition):
# https://ucsd-psych201a.github.io/song2008/Trivia_Q1.html
# https://ucsd-psych201a.github.io/song2008/Trivia_Q2.html
# power analysis: The original effect size was not reported. We computed the previous study's achieved power to be 59%. We conducted a power analysis and determined that to achieve 80% power, we should have a sample size of 52.