# Loading required package, setting working directory, and reading the data file.
library(psych)
## Warning: package 'psych' was built under R version 3.2.5
setwd("/Users/ivanropovik/OneDrive/MANUSCRIPTS/2016 Many Labs 5/Pilot 1")
pilot1 <- read.csv(file = "Pilot 1 raw data.csv", header = TRUE, sep = ";")
# Computing means of the two scale items for each scenario
pilot1$scenario1 <- rowSums(pilot1[,c("Sce1_scale_5", "Sce1_scale_8")], na.rm = TRUE)/2
pilot1$scenario2 <- rowSums(pilot1[,c("Sce2_scale_5", "Sce2_scale_8")], na.rm = TRUE)/2
pilot1$scenario3 <- rowSums(pilot1[,c("Sce3_scale_5", "Sce3_scale_8")], na.rm = TRUE)/2
pilot1$scenario4 <- rowSums(pilot1[,c("Sce4_scale_5", "Sce4_scale_8")], na.rm = TRUE)/2
pilot1$scenario5 <- rowSums(pilot1[,c("Sce5_scale_5", "Sce5_scale_8")], na.rm = TRUE)/2
pilot1$scenario6 <- rowSums(pilot1[,c("Sce6_scale_5", "Sce6_scale_8")], na.rm = TRUE)/2
pilot1$scenario7 <- rowSums(pilot1[,c("Sce7_scale_5", "Sce7_scale_8")], na.rm = TRUE)/2
pilot1$scenario8 <- rowSums(pilot1[,c("Sce8_scale_5", "Sce8_scale_8")], na.rm = TRUE)/2
pilot1$scenario9 <- rowSums(pilot1[,c("Sce9_scale_5", "Sce9_scale_8")], na.rm = TRUE)/2
pilot1$scenario10 <- rowSums(pilot1[,c("Sce10_scale_5", "Sce10_scale_8")], na.rm = TRUE)/2
pilot1$scenario11 <- rowSums(pilot1[,c("Sce11_scale_5", "Sce11_scale_8")], na.rm = TRUE)/2
pilot1$scenario12 <- rowSums(pilot1[,c("Sce12_scale_5", "Sce12_scale_8")], na.rm = TRUE)/2
pilot1$scenario13 <- rowSums(pilot1[,c("Sce13_scale_5", "Sce13_scale_8")], na.rm = TRUE)/2
pilot1$scenario14 <- rowSums(pilot1[,c("Sce14_scale_5", "Sce14_scale_8")], na.rm = TRUE)/2
pilot1$scenario15 <- rowSums(pilot1[,c("Sce15_scale_5", "Sce15_scale_8")], na.rm = TRUE)/2
pilot1$scenario16 <- rowSums(pilot1[,c("Sce16_scale_5", "Sce16_scale_8")], na.rm = TRUE)/2
pilot1$scenario17 <- rowSums(pilot1[,c("Sce17_scale_5", "Sce17_scale_8")], na.rm = TRUE)/2
pilot1$scenario18 <- rowSums(pilot1[,c("Sce18_scale_5", "Sce18_scale_8")], na.rm = TRUE)/2
pilot1$scenario19 <- rowSums(pilot1[,c("Sce19_scale_5", "Sce19_scale_8")], na.rm = TRUE)/2
pilot1$scenario20 <- rowSums(pilot1[,c("Sce20_scale_5", "Sce20_scale_8")], na.rm = TRUE)/2
pilot1$scenario21 <- rowSums(pilot1[,c("Sce21_scale_5", "Sce21_scale_8")], na.rm = TRUE)/2
# Sample size
nrow(pilot1)
## [1] 54
# Frequencies for demographic variables
lapply(pilot1[,c("Female", "Year_of_study", "Age")],
function(x){table(x, useNA = "ifany")})
## $Female
## x
## 0 1 <NA>
## 24 29 1
##
## $Year_of_study
## x
## 1 2 3 <NA>
## 48 2 3 1
##
## $Age
## x
## 18 19 20 21 22 <NA>
## 5 28 13 5 2 1
# Descriptive statistics for each scenario
lapply(pilot1[,c("scenario1","scenario2","scenario3","scenario4","scenario5","scenario6","scenario7",
"scenario8","scenario9","scenario10","scenario11","scenario12","scenario13","scenario14",
"scenario15","scenario16","scenario17","scenario18","scenario19","scenario20","scenario21")],
function(x){describe(x, na.rm = TRUE, fast = TRUE)})
## $scenario1
## vars n mean sd min max range se
## X1 1 54 4.49 1.29 2 7.5 5.5 0.18
##
## $scenario2
## vars n mean sd min max range se
## X1 1 54 6.53 1.49 3 9 6 0.2
##
## $scenario3
## vars n mean sd min max range se
## X1 1 54 3.9 1.58 1.5 7.5 6 0.22
##
## $scenario4
## vars n mean sd min max range se
## X1 1 54 5.05 1.73 1 9 8 0.24
##
## $scenario5
## vars n mean sd min max range se
## X1 1 54 5.45 1.42 2.5 8.5 6 0.19
##
## $scenario6
## vars n mean sd min max range se
## X1 1 54 6.24 1.52 1.5 9 7.5 0.21
##
## $scenario7
## vars n mean sd min max range se
## X1 1 54 5.02 1.35 1.5 8 6.5 0.18
##
## $scenario8
## vars n mean sd min max range se
## X1 1 54 7.48 1.5 2.5 9 6.5 0.2
##
## $scenario9
## vars n mean sd min max range se
## X1 1 54 5.92 1.43 2.5 9 6.5 0.2
##
## $scenario10
## vars n mean sd min max range se
## X1 1 54 5.28 1.58 2 9 7 0.22
##
## $scenario11
## vars n mean sd min max range se
## X1 1 54 5.94 1.46 2.5 9 6.5 0.2
##
## $scenario12
## vars n mean sd min max range se
## X1 1 54 5.1 1.46 1.5 9 7.5 0.2
##
## $scenario13
## vars n mean sd min max range se
## X1 1 54 4.85 1.25 2 8 6 0.17
##
## $scenario14
## vars n mean sd min max range se
## X1 1 54 6.19 1.3 2.5 9 6.5 0.18
##
## $scenario15
## vars n mean sd min max range se
## X1 1 54 4.52 1.41 1.5 7.5 6 0.19
##
## $scenario16
## vars n mean sd min max range se
## X1 1 54 6.02 1.49 2 9 7 0.2
##
## $scenario17
## vars n mean sd min max range se
## X1 1 54 5.95 1.32 3.5 8 4.5 0.18
##
## $scenario18
## vars n mean sd min max range se
## X1 1 54 4 2.07 1 9 8 0.28
##
## $scenario19
## vars n mean sd min max range se
## X1 1 54 3.81 1.74 1 8 7 0.24
##
## $scenario20
## vars n mean sd min max range se
## X1 1 54 3.8 1.13 1 7 6 0.15
##
## $scenario21
## vars n mean sd min max range se
## X1 1 54 5.84 1.61 2 9 7 0.22
# One-sample t-test for each scenario with population parameter mu set at 5.
lapply(pilot1[,c("scenario1","scenario2","scenario3","scenario4","scenario5","scenario6","scenario7",
"scenario8","scenario9","scenario10","scenario11","scenario12","scenario13","scenario14",
"scenario15","scenario16","scenario17","scenario18","scenario19","scenario20","scenario21")],
function(x){t.test(x, data = pilot1, mu = 5, na.rm = TRUE)})
## $scenario1
##
## One Sample t-test
##
## data: x
## t = -2.9085, df = 53, p-value = 0.005296
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.139542 4.841940
## sample estimates:
## mean of x
## 4.490741
##
##
## $scenario2
##
## One Sample t-test
##
## data: x
## t = 7.5175, df = 53, p-value = 6.635e-10
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 6.120149 6.935407
## sample estimates:
## mean of x
## 6.527778
##
##
## $scenario3
##
## One Sample t-test
##
## data: x
## t = -5.1173, df = 53, p-value = 4.389e-06
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.466271 4.330025
## sample estimates:
## mean of x
## 3.898148
##
##
## $scenario4
##
## One Sample t-test
##
## data: x
## t = 0.19664, df = 53, p-value = 0.8449
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.574081 5.518511
## sample estimates:
## mean of x
## 5.046296
##
##
## $scenario5
##
## One Sample t-test
##
## data: x
## t = 2.3505, df = 53, p-value = 0.0225
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.066545 5.840863
## sample estimates:
## mean of x
## 5.453704
##
##
## $scenario6
##
## One Sample t-test
##
## data: x
## t = 6.0004, df = 53, p-value = 1.808e-07
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.825998 6.655484
## sample estimates:
## mean of x
## 6.240741
##
##
## $scenario7
##
## One Sample t-test
##
## data: x
## t = 0.1006, df = 53, p-value = 0.9202
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.649298 5.387739
## sample estimates:
## mean of x
## 5.018519
##
##
## $scenario8
##
## One Sample t-test
##
## data: x
## t = 12.12, df = 53, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 7.070807 7.892156
## sample estimates:
## mean of x
## 7.481481
##
##
## $scenario9
##
## One Sample t-test
##
## data: x
## t = 4.6998, df = 53, p-value = 1.892e-05
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.525461 6.307872
## sample estimates:
## mean of x
## 5.916667
##
##
## $scenario10
##
## One Sample t-test
##
## data: x
## t = 1.2894, df = 53, p-value = 0.2029
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.845667 5.709888
## sample estimates:
## mean of x
## 5.277778
##
##
## $scenario11
##
## One Sample t-test
##
## data: x
## t = 4.7566, df = 53, p-value = 1.555e-05
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.546191 6.342698
## sample estimates:
## mean of x
## 5.944444
##
##
## $scenario12
##
## One Sample t-test
##
## data: x
## t = 0.51215, df = 53, p-value = 0.6107
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.702970 5.500734
## sample estimates:
## mean of x
## 5.101852
##
##
## $scenario13
##
## One Sample t-test
##
## data: x
## t = -0.87356, df = 53, p-value = 0.3863
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.511694 5.192009
## sample estimates:
## mean of x
## 4.851852
##
##
## $scenario14
##
## One Sample t-test
##
## data: x
## t = 6.7279, df = 53, p-value = 1.236e-08
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.838351 6.550538
## sample estimates:
## mean of x
## 6.194444
##
##
## $scenario15
##
## One Sample t-test
##
## data: x
## t = -2.514, df = 53, p-value = 0.01501
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 4.134371 4.902666
## sample estimates:
## mean of x
## 4.518519
##
##
## $scenario16
##
## One Sample t-test
##
## data: x
## t = 5.0271, df = 53, p-value = 6.036e-06
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.612145 6.424892
## sample estimates:
## mean of x
## 6.018519
##
##
## $scenario17
##
## One Sample t-test
##
## data: x
## t = 5.3011, df = 53, p-value = 2.281e-06
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.592854 6.314554
## sample estimates:
## mean of x
## 5.953704
##
##
## $scenario18
##
## One Sample t-test
##
## data: x
## t = -3.5547, df = 53, p-value = 0.0008055
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.435745 4.564255
## sample estimates:
## mean of x
## 4
##
##
## $scenario19
##
## One Sample t-test
##
## data: x
## t = -5.0563, df = 53, p-value = 5.444e-06
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.331745 4.279366
## sample estimates:
## mean of x
## 3.805556
##
##
## $scenario20
##
## One Sample t-test
##
## data: x
## t = -7.8229, df = 53, p-value = 2.148e-10
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 3.487675 4.104917
## sample estimates:
## mean of x
## 3.796296
##
##
## $scenario21
##
## One Sample t-test
##
## data: x
## t = 3.8524, df = 53, p-value = 0.0003175
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
## 5.403898 6.281287
## sample estimates:
## mean of x
## 5.842593