## This script analyzes results of a test in which choice was given between two identical 30 pulse target signals. # By running this script, you will be able to make figures used in Figure S2 and perform statistical analysis associated with this figure. # Read packages library("dplyr") library("ggplot2") library("binom") ## Read data for 30 vs 30 target signal data_30vs30 <- read.csv("FigureS1_IdenticalChoiceTest.csv",header = T, check.names=F) # full data # Analyzing preference for the two identical signals data_30vs30_choice <- data_30vs30 %>% filter(Response != 0) summary_30vs30_choice_alternative1 <- data_30vs30_choice %>% summarise(Choice = sum(Choice), N =n()) %>% mutate (Stimulus = "Alternative1") summary_30vs30_choice_alternative2 <- data_30vs30_choice %>% summarise(Choice = n() - sum(Choice), N =n()) %>% mutate (Stimulus = "Alternative2") summary_30vs30_choice <- rbind(summary_30vs30_choice_alternative1,summary_30vs30_choice_alternative2) binomial_30vs30_choice <- binom.exact(summary_30vs30_choice$Choice, summary_30vs30_choice$N) %>% mutate(Stimulus = summary_30vs30_choice$Stimulus) binomial_30vs30_choice$mean <- binomial_30vs30_choice$mean *100 # Convert proportions to percentage choosing binomial_30vs30_choice$lower <- binomial_30vs30_choice$lower *100 # Convert proportions to percentage choosing binomial_30vs30_choice$upper <- binomial_30vs30_choice$upper *100 # Convert proportions to percentage choosing ## Plot for Fig S1 ggplot(binomial_30vs30_choice, aes(x = Stimulus, y = mean, fill= Stimulus)) + geom_bar(stat="identity", width=.5) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.15) + theme_classic() + ylab("Choice of each alternative (%)") + scale_fill_manual(values=c("#999999", "#999999")) + ylim (0,100) + theme(axis.title.x=element_blank(),axis.title.y=element_text(size=20), axis.text.x=element_text(size=18),axis.text.y=element_text(size=18),legend.position="none",panel.spacing.x=unit(1, "lines")) ## Statistical analysis for identical choice experiment #Binomial tests to analyze if proportions of subjects choosing one alternative over other are different than chance (0.5) binom.test(12, 20, p =0.5, alternative = "two.sided")