Before starting this exercise, you should have completed all the Absolute Beginners’, Part 1 worksheets. If not, take a look at those exercises before continuing. Each section below also indicates which of the earlier worksheets are relevant.
Relevant worksheet: Intro to RStudio
You’ll need to complete the Psych:EL excerise to get the CSV files containing your data, and data for your group. Open an RStudio project for this analysis, within that create a script file for this analysis, and upload the CSV files to the project.
Relevant worksheet: Exploring data
Load the tidyverse package, and load your data.
library(tidyverse) brex <- read_csv("brexit.csv")
Note: Everyone’s CSV file has a different name. For example, yours might be called
Wills.csv. In the example above, you’ll need to replace
Wills.csv with the name of your personal CSV file.
Look at the data by clicking on it in the Environment tab in RStudio. Each row is one person’s rating for one question. Here’s what each of the columns in the data set contain:
|UnRowID||Unique Row ID: you can ignore this.|
|SRN||Your Student Reference Number|
|cond||How would you vote in a Brexit referendum?||“leave”, “remain”|
|type||Which questionnaire is this a response for?||“auth” = Authoritarian Personality Scale, “dom” = Social Dominance Orientation questionnaire|
|qu||This number uniquely identifies the question that was asked||1 - 21|
|rating||The rating given in response to this question||1 - 7, higher numbers = more authoritarian / higher social dominance orientation|
Relevant worksheets: Group Differences
How highly did you score on each of the two questionnaires (Authoritarian Personality Scale, Social Dominance Orientation questionniare)?
To look at this, you have to calculate your average (mean) rating for each questionnaire. To do this, use the
summarise commands you learned in the Group Differences worksheet.
brex %>% group_by(type) %>% summarise(mean(rating))
# A tibble: 2 x 2 type `mean(rating)` <chr> <dbl> 1 auth 3.95 2 dom 3.25
As before, you can safely ignore the “ungrouping” message that you receive.
NOTE: Your output should look similar to that shown above, but the numbers will be different.
Relevant worksheet: Exploring data
Load the tidyverse package, and load the data.
library(tidyverse) brex.all <- read_csv("brexit-all.csv")
Look at the data by clicking on it in the Environment tab in RStudio. You’ll see it has the same columns as the the other data file, it just has a lot more rows (because it contains a lot of participants).
Relevant worksheet: Evidence
How good is the evidence that this is a real result, and not just some kind of fluke we can put down to chance? The best way to answer this question is to calculate a Bayes Factor, as was covered in the Evidence worksheet. In this case, the data frame is
auth.sum, with the column
rating containing the questionnaire scores, and the column
cond containing information about the condition (i.e. whether each person voted leave or remain):
library(BayesFactor, quietly = TRUE) ttestBF(formula = rating ~ cond, data = data.frame(auth.sum))
Bayes factor analysis --------------  Alt., r=0.707 : 14.07864 ±0% Against denominator: Null, mu1-mu2 = 0 --- Bayes factor type: BFindepSample, JZS
In this example, The Bayes Factor is about 14, meaning it’s about 14 times as likely that there is a difference, than there isn’t.
Enter your exact Bayes Factor into PsycEL. (The Bayes Factor for your data will likely be a bit different to the one above).