# Study 1
data_s1 = read_csv("study1.csv")

p_choice = length(which(data_s1$s_1_1 == "Movie P"))
q_choice = length(which(data_s1$s_1_1 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_1_1:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s1$s_1_2 == "Movie P"))
q_choice = length(which(data_s1$s_1_2 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_1_2:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))


# Study 2
data_s2 = read_csv("study2.csv")

p_choice = length(which(data_s2$s_2 == "Movie P"))
q_choice = length(which(data_s2$s_2 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_2:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))


# Study 3
data_s3 = read_csv("study3.csv")

p_choice = length(which(data_s3$s_3_1 == "Movie P"))
q_choice = length(which(data_s3$s_3_1 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_3_1:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s3$s_3_2 == "Movie P"))
q_choice = length(which(data_s3$s_3_2 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_3_2:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))


# Study 4
data_s4 = read_csv("study4.csv")

p_choice = length(which(data_s4$s_4_1 == "Movie P"))
q_choice = length(which(data_s4$s_4_1 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_4_1:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s4$s_4_2 == "Movie P"))
q_choice = length(which(data_s4$s_4_2 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_4_2:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))


# Study 5
data_s5 = read_csv("study5.csv")

p_choice = length(which(data_s5$s_5 == "Movie P"))
q_choice = length(which(data_s5$s_5 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_5:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))


# Study 6
data_s6a = read_csv("study6a.csv")
data_s6b = read_csv("study6b.csv")

p_choice = length(which(data_s6a$s_6_1 == "Movie P"))
q_choice = length(which(data_s6a$s_6_1 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_1:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6b$s_6_2 == "Movie P"))
q_choice = length(which(data_s6b$s_6_2 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_2:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_3 == "Movie P"))
q_choice = length(which(data_s6a$s_6_3 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_3:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_4 == "Movie P"))
q_choice = length(which(data_s6a$s_6_4 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_4:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_5 == "Movie P"))
q_choice = length(which(data_s6a$s_6_5 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_5:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6b$s_6_6 == "Movie P"))
q_choice = length(which(data_s6b$s_6_6 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_6:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_7 == "Movie P"))
q_choice = length(which(data_s6a$s_6_7 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_7:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_8 == "Movie P"))
q_choice = length(which(data_s6a$s_6_8 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_8:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_9 == "Movie P"))
q_choice = length(which(data_s6a$s_6_9 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_9:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6b$s_6_10 == "Movie P"))
q_choice = length(which(data_s6b$s_6_10 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_10:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_11 == "Movie P"))
q_choice = length(which(data_s6a$s_6_11 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_11:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_12 == "Movie P"))
q_choice = length(which(data_s6a$s_6_12 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_12:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_13 == "Movie P"))
q_choice = length(which(data_s6a$s_6_13 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_13:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6b$s_6_14 == "Movie P"))
q_choice = length(which(data_s6b$s_6_14 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_14:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_15 == "Movie P"))
q_choice = length(which(data_s6a$s_6_15 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_15:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))

p_choice = length(which(data_s6a$s_6_16 == "Movie P"))
q_choice = length(which(data_s6a$s_6_16 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_6_16:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))


# Study 7
data_s7 = read_csv("study7.csv")

p_choice = length(which(data_s7$s_7 == "Lottery P"))
q_choice = length(which(data_s7$s_7 == "Lottery Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_7:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))


# Study 8
data_s8 = read_csv("study8.csv")

p_choice = length(which(data_s8$s_8 == "Movie P"))
q_choice = length(which(data_s8$s_8 == "Movie Q"))
p_value = binom.test(p_choice,p_choice+q_choice)$p.value
print("Study_8:")
print(paste("#P: ", p_choice))
print(paste("#Q: ", q_choice))
print(paste("P-value: ", round(p_value, 4)))


# Study 9
data_s9 = read_csv("study9.csv")

mean_p = mean(data_s9$choice_p)
sd_p = sd(data_s9$choice_p)
mean_q = mean(data_s9$choice_q)
sd_q = sd(data_s9$choice_q)
print("Study_9:")
print(paste("Choice P: ", "Mean =", round(mean_p,2), "SD =", round(sd_p,2)))
print(paste("Choice Q: ", "Mean =", round(mean_q,2), "SD =", round(sd_q,2)))


