## Setup ###################################################################################################
# To run at the command line, replace this with a function that calls setwd()
# to the local directory where you have the data and R files.
setwd_PROCOAST_pluralistic_ignorance_1()
dF <- read.table("arneData.tsv",
header = TRUE,
sep = "\t",
stringsAsFactors = FALSE)
# We just need permutation_sign_test()
source("analysisFunctions.R")
# Sample size (there is no missing data)
nrow(dF)
## [1] 28
# Percent support
percentSupport <- sum(dF$support>=4) / length(dF$support) * 100
percentSupport
## [1] 82.14286
# Perceived support (percent)
dF$perceivedSupportPercent <- dF$perceivedNormSupport * 10
mean(dF$perceivedSupportPercent)
## [1] 51.07143
# Calculating the EPI difference score
dF$diff <- percentSupport - dF$perceivedSupportPercent
# The EPI difference score is significantly different to zero
permutation_sign_test(dF$diff)
## Permutation Sign Test
## =====================
##
## Observed mean: 31.0714
## Alternative hypothesis: two.sided
## Number of permutations: 99999
## Number of observations: 28
## P-value: 0
## Significance: ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# There is a correlation between support and perceived support
cor.test(dF$support, dF$perceivedNormSupport)
##
## Pearson's product-moment correlation
##
## data: dF$support and dF$perceivedNormSupport
## t = 2.2746, df = 26, p-value = 0.03141
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.04047101 0.67750019
## sample estimates:
## cor
## 0.4073967