# 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-2. 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 = "Pilot_1_Kassel.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] 60
# 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
## 1 2 3 <NA>
## 43 11 2 4
##
## $Q181
## x
## 1 1. 3 5 7 Ersten test test2
## 4 46 3 2 1 1 1 1 1
##
## $Q182
## x
## 18 19 20 21 22 23 25 26 29 30 31 32 36 99 100
## 7 15 11 3 2 5 2 3 1 2 1 1 1 1 1
## <NA>
## 4
# Descriptive statistics for each scenario
lapply(pilot1[,c("scenario1_Q3", "scenario2_Q15", "scenario3_Q26", "scenario5_Q37",
"scenario7_Q48", "scenario8_Q59", "scenario10_Q81", "scenario11_Q92",
"scenario12_Q103", "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 54 5.44 1.8 2 9 7 0.25
##
## $scenario2_Q15
## vars n mean sd min max range se
## X1 1 54 5.71 2.09 1 9 8 0.28
##
## $scenario3_Q26
## vars n mean sd min max range se
## X1 1 54 3.55 1.94 1 9 8 0.26
##
## $scenario5_Q37
## vars n mean sd min max range se
## X1 1 54 5.79 2.1 1 9 8 0.29
##
## $scenario7_Q48
## vars n mean sd min max range se
## X1 1 54 5.66 1.67 1 9 8 0.23
##
## $scenario8_Q59
## vars n mean sd min max range se
## X1 1 53 8.32 1.19 4.5 9 4.5 0.16
##
## $scenario10_Q81
## vars n mean sd min max range se
## X1 1 54 5.69 1.95 2 9 7 0.27
##
## $scenario11_Q92
## vars n mean sd min max range se
## X1 1 54 5.97 2.25 1 9 8 0.31
##
## $scenario12_Q103
## vars n mean sd min max range se
## X1 1 53 5.64 2.12 1 9 8 0.29
##
## $scenario15_Q114
## vars n mean sd min max range se
## X1 1 54 3.98 1.6 1 7.5 6.5 0.22
##
## $scenario16_Q228
## vars n mean sd min max range se
## X1 1 54 6.13 2.06 1.5 9 7.5 0.28
##
## $scenario17_Q125
## vars n mean sd min max range se
## X1 1 54 6.53 1.94 1 9 8 0.26
##
## $scenario18_Q136
## vars n mean sd min max range se
## X1 1 54 3.67 1.99 1 8.5 7.5 0.27
##
## $scenario19_Q147
## vars n mean sd min max range se
## X1 1 54 4.69 1.81 1 8.5 7.5 0.25
##
## $scenario20_Q158
## vars n mean sd min max range se
## X1 1 54 5.19 2.27 1 9 8 0.31
##
## $scenario21_Q169
## vars n mean sd min max range se
## X1 1 54 6.88 1.54 3.5 9 5.5 0.21
# One-sample t-test for each scenario with population parameter mu set at 5.
lapply(pilot1[,c("scenario1_Q3", "scenario2_Q15", "scenario3_Q26", "scenario5_Q37",
"scenario7_Q48", "scenario8_Q59", "scenario10_Q81", "scenario11_Q92",
"scenario12_Q103", "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 = 1.7751, df = 53, p-value = 0.08163
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.943446 5.926924
## sample estimates:
## mean of x
## 5.435185
##
##
## $scenario2_Q15
##
## One Sample t-test
##
## data: x
## t = 2.5106, df = 53, p-value = 0.01514
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.143376 6.282550
## sample estimates:
## mean of x
## 5.712963
##
##
## $scenario3_Q26
##
## One Sample t-test
##
## data: x
## t = -5.5042, df = 53, p-value = 1.1e-06
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.016561 4.076031
## sample estimates:
## mean of x
## 3.546296
##
##
## $scenario5_Q37
##
## One Sample t-test
##
## data: x
## t = 2.7478, df = 53, p-value = 0.008183
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.212536 6.361538
## sample estimates:
## mean of x
## 5.787037
##
##
## $scenario7_Q48
##
## One Sample t-test
##
## data: x
## t = 2.8869, df = 53, p-value = 0.005619
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.200660 6.114154
## sample estimates:
## mean of x
## 5.657407
##
##
## $scenario8_Q59
##
## One Sample t-test
##
## data: x
## t = 20.397, df = 52, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 7.994067 8.647443
## sample estimates:
## mean of x
## 8.320755
##
##
## $scenario10_Q81
##
## One Sample t-test
##
## data: x
## t = 2.6126, df = 53, p-value = 0.01167
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.161305 6.227584
## sample estimates:
## mean of x
## 5.694444
##
##
## $scenario11_Q92
##
## One Sample t-test
##
## data: x
## t = 3.1818, df = 53, p-value = 0.002448
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.359355 6.585089
## sample estimates:
## mean of x
## 5.972222
##
##
## $scenario12_Q103
##
## One Sample t-test
##
## data: x
## t = 2.2078, df = 52, p-value = 0.03169
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.058442 6.224577
## sample estimates:
## mean of x
## 5.641509
##
##
## $scenario15_Q114
##
## One Sample t-test
##
## data: x
## t = -4.6813, df = 53, p-value = 2.017e-05
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.545085 4.417878
## sample estimates:
## mean of x
## 3.981481
##
##
## $scenario16_Q228
##
## One Sample t-test
##
## data: x
## t = 4.037, df = 53, p-value = 0.0001752
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.568382 6.690878
## sample estimates:
## mean of x
## 6.12963
##
##
## $scenario17_Q125
##
## One Sample t-test
##
## data: x
## t = 5.7836, df = 53, p-value = 3.993e-07
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.997945 7.057611
## sample estimates:
## mean of x
## 6.527778
##
##
## $scenario18_Q136
##
## One Sample t-test
##
## data: x
## t = -4.9164, df = 53, p-value = 8.906e-06
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.122706 4.210627
## sample estimates:
## mean of x
## 3.666667
##
##
## $scenario19_Q147
##
## One Sample t-test
##
## data: x
## t = -1.2762, df = 53, p-value = 0.2074
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.190418 5.179952
## sample estimates:
## mean of x
## 4.685185
##
##
## $scenario20_Q158
##
## One Sample t-test
##
## data: x
## t = 0.62934, df = 53, p-value = 0.5318
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.574735 5.814154
## sample estimates:
## mean of x
## 5.194444
##
##
## $scenario21_Q169
##
## One Sample t-test
##
## data: x
## t = 8.9416, df = 53, p-value = 3.617e-12
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 6.458000 7.301259
## sample estimates:
## mean of x
## 6.87963
# 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", "scenario5_Q37",
"scenario7_Q48", "scenario8_Q59", "scenario10_Q81", "scenario11_Q92",
"scenario12_Q103", "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 : 1.22068 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario2_Q15
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.3239669 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario3_Q26
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 7.140756e-05 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario5_Q37
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.1949711 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario7_Q48
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.1423443 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario8_Q59
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 7.417371e-24 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario10_Q81
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.2615895 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario11_Q92
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.07033742 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario12_Q103
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.5843179 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario15_Q114
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.001014664 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario16_Q228
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 0.007041568 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario17_Q125
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 2.805943e-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.0004837366 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario19_Q147
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 2.370377 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario20_Q158
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 4.104842 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS
##
##
## $scenario21_Q169
## Bayes factor analysis
## --------------
## [1] Null, mu=5 : 5.039913e-10 ±0%
##
## Against denominator:
## Alternative, r = 0.5, mu =/= 5
## ---
## Bayes factor type: BFoneSample, JZS