1.Research Question Does reward magnitude influence reaction time and decision accuracy?

  1. Primary Analysis: Independent T-Test
#Primary Analysis: Independent T-Test
#(Reaction Time)
df <- read.csv("/Users/sake/Downloads/ddm_all_data_experiment_1.csv")
colnames(df)
##  [1] "participant"         "staircase_threshold" "dem_age"            
##  [4] "dem_gen"             "bias_source"         "bias_direction"     
##  [7] "trial_number"        "reference_length"    "target_length"      
## [10] "line_type"           "answer"              "rt"                 
## [13] "accuracy"
t.test(rt ~ bias_source, data = df, 
alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  rt by bias_source
## t = -0.92795, df = 29997, p-value = 0.3534
## alternative hypothesis: true difference in means between group mullerlyer and group payoff is not equal to 0
## 95 percent confidence interval:
##  -0.04138641  0.01479042
## sample estimates:
## mean in group mullerlyer     mean in group payoff 
##                 1.067494                 1.080792
#Visualization
ggplot(df, aes(x = bias_source, y = rt,
fill = bias_source)) +
 geom_boxplot() +
 labs(title = "Reaction Time by Reward
Level", y =  "Reaction Time (ms)")

3. Secondary Analysis: Chi-Square Test To ensure the Decision Accuracy variable is utilized, we test if accuracy is independent of reward level.

# Create a contingency table 
 table_data <- table(df$bias_source,
df$accuracy)

# Run Chi-Square
chisq.test(table_data)
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  table_data
## X-squared = 33.629, df = 1, p-value = 6.67e-09
# Visualization
ggplot(df, aes(x = bias_source, fill =
accuracy)) +
   geom_bar(position = "fill") +
   labs(title = "Decision Accuracy 
        Proportion by Reward Level", y =
  "Proportion")