# Loading required package, setting working directory, and reading the data file.
require(psych)
## Loading required package: psych
require(BayesFactor)
## Loading required package: BayesFactor
## Loading required package: coda
## Loading required package: Matrix
## ************
## Welcome to BayesFactor 0.9.12-4. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
##
## Type BFManual() to open the manual.
## ************
setwd("/Users/ivanropovik/OneDrive/MANUSCRIPTS/2016 Many Labs 5/Pilot 1/Analyses/")
pilot1 <- read.csv(file = "Data_brazil_pilot1_2.csv", header = TRUE, sep = ";")
# Computing means of the two scale items for each scenario
# If one of the two target items is missing,
# the score of the other item is used as the estimate for the given scenario
pilot1$scenario1_Q3 <- rowMeans(pilot1[,c("Q9", "Q12")], na.rm = TRUE)
pilot1$scenario2_Q15 <- rowMeans(pilot1[,c("Q20", "Q23")], na.rm = TRUE)
pilot1$scenario3_Q26 <- rowMeans(pilot1[,c("Q31", "Q34")], na.rm = TRUE)
pilot1$scenario4_Q239 <- rowMeans(pilot1[,c("Q244", "Q247")], na.rm = TRUE)
pilot1$scenario5_Q37 <- rowMeans(pilot1[,c("Q42", "Q45")], na.rm = TRUE)
pilot1$scenario6_Q250 <- rowMeans(pilot1[,c("Q255", "Q258")], na.rm = TRUE)
pilot1$scenario7_Q48 <- rowMeans(pilot1[,c("Q53", "Q56")], na.rm = TRUE)
pilot1$scenario8_Q59 <- rowMeans(pilot1[,c("Q64", "Q67")], na.rm = TRUE)
pilot1$scenario9_Q261 <- rowMeans(pilot1[,c("Q266", "Q269")], na.rm = TRUE)
pilot1$scenario10_Q81 <- rowMeans(pilot1[,c("Q86", "Q89")], na.rm = TRUE)
pilot1$scenario11_Q92 <- rowMeans(pilot1[,c("Q97", "Q100")], na.rm = TRUE)
pilot1$scenario12_Q103 <- rowMeans(pilot1[,c("Q108", "Q111")], na.rm = TRUE)
pilot1$scenario13_Q272 <- rowMeans(pilot1[,c("Q277", "Q280")], na.rm = TRUE)
pilot1$scenario14_Q283 <- rowMeans(pilot1[,c("Q288", "Q291")], na.rm = TRUE)
pilot1$scenario15_Q114 <- rowMeans(pilot1[,c("Q119", "Q122")], na.rm = TRUE)
pilot1$scenario16_Q228 <- rowMeans(pilot1[,c("Q233", "Q236")], na.rm = TRUE)
pilot1$scenario17_Q125 <- rowMeans(pilot1[,c("Q130", "Q133")], na.rm = TRUE)
pilot1$scenario18_Q136 <- rowMeans(pilot1[,c("Q141", "Q144")], na.rm = TRUE)
pilot1$scenario19_Q147 <- rowMeans(pilot1[,c("Q152", "Q155")], na.rm = TRUE)
pilot1$scenario20_Q158 <- rowMeans(pilot1[,c("Q163", "Q166")], na.rm = TRUE)
pilot1$scenario21_Q169 <- rowMeans(pilot1[,c("Q174", "Q177")], na.rm = TRUE)
# Sample size
nrow(pilot1)
## [1] 70
# Frequencies for demographic variables
# Q180 = Gender
# Q181 = Year of study
# Q182 = Age
lapply(pilot1[,c("Q180", "Q181", "Q182")],
function(x){table(x, useNA = "ifany")})
## $Q180
## x
## 18 19 20 21 22 23 24 28 32 33 36 <NA>
## 2 16 22 11 7 3 2 2 1 1 1 2
##
## $Q181
## x
## 1 2 22 <NA>
## 10 56 2 2
##
## $Q182
## x
## 2 3 4 5 <NA>
## 12 29 14 12 3
# Descriptive statistics for each scenario
lapply(pilot1[,c("scenario1_Q3", "scenario2_Q15", "scenario3_Q26", "scenario4_Q239", "scenario5_Q37",
"scenario6_Q250", "scenario7_Q48", "scenario8_Q59", "scenario9_Q261",
"scenario10_Q81", "scenario11_Q92", "scenario12_Q103", "scenario13_Q272",
"scenario14_Q283", "scenario15_Q114", "scenario16_Q228", "scenario17_Q125",
"scenario18_Q136", "scenario19_Q147", "scenario20_Q158", "scenario21_Q169")],
function(x){describe(x, na.rm = TRUE, fast = TRUE)})
## $scenario1_Q3
## vars n mean sd min max range se
## X1 1 70 5.91 1.39 1.5 9 7.5 0.17
##
## $scenario2_Q15
## vars n mean sd min max range se
## X1 1 70 6.24 1.55 2.5 9 6.5 0.19
##
## $scenario3_Q26
## vars n mean sd min max range se
## X1 1 70 4.29 2.02 1 9 8 0.24
##
## $scenario4_Q239
## vars n mean sd min max range se
## X1 1 69 5.94 2.05 1.5 9 7.5 0.25
##
## $scenario5_Q37
## vars n mean sd min max range se
## X1 1 69 5.32 1.82 1 9 8 0.22
##
## $scenario6_Q250
## vars n mean sd min max range se
## X1 1 70 5.63 1.58 2 9 7 0.19
##
## $scenario7_Q48
## vars n mean sd min max range se
## X1 1 70 5.89 1.45 3 9 6 0.17
##
## $scenario8_Q59
## vars n mean sd min max range se
## X1 1 70 7.67 1.08 5 9 4 0.13
##
## $scenario9_Q261
## vars n mean sd min max range se
## X1 1 70 5.67 1.66 2 9 7 0.2
##
## $scenario10_Q81
## vars n mean sd min max range se
## X1 1 69 4.16 1.83 1 8.5 7.5 0.22
##
## $scenario11_Q92
## vars n mean sd min max range se
## X1 1 69 5.08 1.64 1 9 8 0.2
##
## $scenario12_Q103
## vars n mean sd min max range se
## X1 1 69 5.7 1.7 1.5 9 7.5 0.21
##
## $scenario13_Q272
## vars n mean sd min max range se
## X1 1 70 6.23 1.4 2.5 9 6.5 0.17
##
## $scenario14_Q283
## vars n mean sd min max range se
## X1 1 70 6.91 1.32 2 9 7 0.16
##
## $scenario15_Q114
## vars n mean sd min max range se
## X1 1 70 4.82 1.62 1 9 8 0.19
##
## $scenario16_Q228
## vars n mean sd min max range se
## X1 1 70 6.61 1.55 3 9 6 0.18
##
## $scenario17_Q125
## vars n mean sd min max range se
## X1 1 70 5.99 1.48 1.5 9 7.5 0.18
##
## $scenario18_Q136
## vars n mean sd min max range se
## X1 1 70 4.3 1.92 1 9 8 0.23
##
## $scenario19_Q147
## vars n mean sd min max range se
## X1 1 70 3.9 1.72 1 8.5 7.5 0.21
##
## $scenario20_Q158
## vars n mean sd min max range se
## X1 1 70 5.59 1.93 1 9 8 0.23
##
## $scenario21_Q169
## vars n mean sd min max range se
## X1 1 70 7.24 1.29 3.5 9 5.5 0.15
# One-sample t-test for each scenario with population parameter mu set at 5.
lapply(pilot1[,c("scenario1_Q3", "scenario2_Q15", "scenario3_Q26", "scenario4_Q239", "scenario5_Q37",
"scenario6_Q250", "scenario7_Q48", "scenario8_Q59", "scenario9_Q261",
"scenario10_Q81", "scenario11_Q92", "scenario12_Q103", "scenario13_Q272",
"scenario14_Q283", "scenario15_Q114", "scenario16_Q228", "scenario17_Q125",
"scenario18_Q136", "scenario19_Q147", "scenario20_Q158", "scenario21_Q169")],
function(x){t.test(x, data = pilot1, mu = 5, na.rm = TRUE)})
## $scenario1_Q3
##
## One Sample t-test
##
## data: x
## t = 5.4433, df = 69, p-value = 7.515e-07
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.574677 6.239609
## sample estimates:
## mean of x
## 5.907143
##
##
## $scenario2_Q15
##
## One Sample t-test
##
## data: x
## t = 6.6966, df = 69, p-value = 4.697e-09
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.872606 6.613109
## sample estimates:
## mean of x
## 6.242857
##
##
## $scenario3_Q26
##
## One Sample t-test
##
## data: x
## t = -2.9546, df = 69, p-value = 0.004279
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.803431 4.767997
## sample estimates:
## mean of x
## 4.285714
##
##
## $scenario4_Q239
##
## One Sample t-test
##
## data: x
## t = 3.8138, df = 68, p-value = 0.0002975
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.449136 6.434922
## sample estimates:
## mean of x
## 5.942029
##
##
## $scenario5_Q37
##
## One Sample t-test
##
## data: x
## t = 1.4577, df = 68, p-value = 0.1495
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.882365 5.755316
## sample estimates:
## mean of x
## 5.318841
##
##
## $scenario6_Q250
##
## One Sample t-test
##
## data: x
## t = 3.3373, df = 69, p-value = 0.001366
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.252829 6.004314
## sample estimates:
## mean of x
## 5.628571
##
##
## $scenario7_Q48
##
## One Sample t-test
##
## data: x
## t = 5.1541, df = 69, p-value = 2.314e-06
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.547267 6.238447
## sample estimates:
## mean of x
## 5.892857
##
##
## $scenario8_Q59
##
## One Sample t-test
##
## data: x
## t = 20.7, df = 69, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 7.413974 7.928883
## sample estimates:
## mean of x
## 7.671429
##
##
## $scenario9_Q261
##
## One Sample t-test
##
## data: x
## t = 3.3903, df = 69, p-value = 0.001158
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.276338 6.066519
## sample estimates:
## mean of x
## 5.671429
##
##
## $scenario10_Q81
##
## One Sample t-test
##
## data: x
## t = -3.8195, df = 68, p-value = 0.0002919
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.720269 4.598572
## sample estimates:
## mean of x
## 4.15942
##
##
## $scenario11_Q92
##
## One Sample t-test
##
## data: x
## t = 0.40382, df = 68, p-value = 0.6876
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.685827 5.473594
## sample estimates:
## mean of x
## 5.07971
##
##
## $scenario12_Q103
##
## One Sample t-test
##
## data: x
## t = 3.4246, df = 68, p-value = 0.001048
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.293332 6.112465
## sample estimates:
## mean of x
## 5.702899
##
##
## $scenario13_Q272
##
## One Sample t-test
##
## data: x
## t = 7.3529, df = 69, p-value = 3.038e-10
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.895244 6.561899
## sample estimates:
## mean of x
## 6.228571
##
##
## $scenario14_Q283
##
## One Sample t-test
##
## data: x
## t = 12.092, df = 69, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 6.592504 7.221782
## sample estimates:
## mean of x
## 6.907143
##
##
## $scenario15_Q114
##
## One Sample t-test
##
## data: x
## t = -0.92369, df = 69, p-value = 0.3589
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.435757 5.207100
## sample estimates:
## mean of x
## 4.821429
##
##
## $scenario16_Q228
##
## One Sample t-test
##
## data: x
## t = 8.7317, df = 69, p-value = 9.195e-13
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 6.245468 6.983104
## sample estimates:
## mean of x
## 6.614286
##
##
## $scenario17_Q125
##
## One Sample t-test
##
## data: x
## t = 5.5568, df = 69, p-value = 4.805e-07
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.631832 6.339597
## sample estimates:
## mean of x
## 5.985714
##
##
## $scenario18_Q136
##
## One Sample t-test
##
## data: x
## t = -3.0483, df = 69, p-value = 0.003261
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.841888 4.758112
## sample estimates:
## mean of x
## 4.3
##
##
## $scenario19_Q147
##
## One Sample t-test
##
## data: x
## t = -5.3355, df = 69, p-value = 1.146e-06
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.488706 4.311294
## sample estimates:
## mean of x
## 3.9
##
##
## $scenario20_Q158
##
## One Sample t-test
##
## data: x
## t = 2.5343, df = 69, p-value = 0.01354
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.124657 6.046772
## sample estimates:
## mean of x
## 5.585714
##
##
## $scenario21_Q169
##
## One Sample t-test
##
## data: x
## t = 14.53, df = 69, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 6.928744 7.542684
## sample estimates:
## mean of x
## 7.235714
# Bayes factor in favour of the null (BF01) for each scenario
# with population parameter mu set at 5 and prior width of 0.5.
lapply(pilot1[,c("scenario1_Q3", "scenario2_Q15", "scenario3_Q26", "scenario4_Q239", "scenario5_Q37",
"scenario6_Q250", "scenario7_Q48", "scenario8_Q59", "scenario9_Q261",
"scenario10_Q81", "scenario11_Q92", "scenario12_Q103", "scenario13_Q272",
"scenario14_Q283", "scenario15_Q114", "scenario16_Q228", "scenario17_Q125",
"scenario18_Q136", "scenario19_Q147", "scenario20_Q158", "scenario21_Q169")],
function(x){1/ttestBF(x[!is.na(x)], mu = 5, rscale = 0.5, na.rm = TRUE)})
## t is large; approximation invoked.
## $scenario1_Q3
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 5.070787e-05 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario2_Q15
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 4.417531e-07 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario3_Q26
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.1207713 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario4_Q239
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.01171135 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario5_Q37
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 2.085149 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario6_Q250
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.04500169 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario7_Q48
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.0001432635 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario8_Q59
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 1.228777e-28 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario9_Q261
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.03897268 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario10_Q81
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.011514 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario11_Q92
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 5.083222 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario12_Q103
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.03557272 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario13_Q272
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 3.322467e-08 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario14_Q283
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 2.443848e-16 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario15_Q114
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 3.728901 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario16_Q228
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 1.321426e-10 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario17_Q125
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 3.350119e-05 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario18_Q136
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.09567057 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario19_Q147
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 7.491049e-05 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario20_Q158
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.3191535 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario21_Q169
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 3.378734e-20 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS