A Priming study
In a provocative paper, Bargh, Chen and Burrows (1996) sought to test whether or not priming people with trait concepts would trigger trait-consistent behavior. In one study, they primed participants with either neutral words (e.g.; bat, cookie, pen), or with words related to an elderly stereotype (e.g.; wise, stubborn, old). They then, unbeknownst to the participants, used a stopwatch to record how long it took the participants to walk down a hallway at the conclusion of an experiment. They predicted that participants primed with words related to the elderly would walk slower than those primed with neutral words.
In this WPA, you will analyze fake data corresponding to this study.
Dataset description
Our fake study has 3 primary independent variables:
prime: What kind of primes was the participant given?neutralmeans neutral primes,elderlymeans elderly primes.prime.duration: How long (in minutes) were primes displayed to participants? There were 4 conditions: 1, 5, 10 or 30.grandparents: Did the participant have a close relationship with their grandparents?yesmeans yes,nomeans no,nonemeans they never met their grandparents.
There was one primary dependent variable
walk: How long (in seconds) did participants take to walk down the hallway?
There were 4 additional variables:
id: The order in which participants completed the studyage: Participants’ agesex: Participants’ sexattention: Did the participant pass an attention check? 0 means they failed the attention check, 1 means they passed.
Load the data
- The text file containing the data is called
priming.txt. It is available at http://nathanieldphillips.com/wp-content/uploads/2016/10/priming.txt. Load the data into R by running the following:
priming <- read.table("http://nathanieldphillips.com/wp-content/uploads/2016/10/priming.txt")Here is how the data should look:
| a | b | c | d | e | f | g | h |
|---|---|---|---|---|---|---|---|
| 1 | m | 21 | 1 | asdf | 1 | no | 25.4 |
| 2 | m | 21 | 1 | asdf | 30 | no | 23.6 |
| 3 | f | 22 | 1 | asdf | 30 | none | 34.5 |
| 4 | m | 23 | 1 | elderly | 1 | yes | 40.4 |
| 5 | m | 23 | 1 | asdf | 10 | none | 25.0 |
| 6 | m | 22 | 1 | asdf | 10 | yes | 24.7 |
Understanding and cleaning the data
Get to know the data using
View(),summary(),head()andstr().Look at the names of the dataframe with
names(). Those aren’t very informative are they? Change the names to the correct values (make sure to use the naming scheme I describe in the dataset description).
Applying functions to columns
- What was the mean participant age?
4b. Create a new vector object called age.v that contains the age data. Calculate the mean age from this vector. Do you get the same result as you did in the previous question?
What was the median walking time?
How many females were there? How many males?
What percent of participants passed the attention check (Hint: To calculate a percentage from a 0, 1 variable, use
mean())Walking time is currently in seconds. Add a new column to the dataframe called
walk.mThat shows the walking time in minutes rather than seconds.
Indexing and subsettting dataframes
Try to split your answers to these problems into two steps
Step 1: Index or subset the original data and store as a new object with a new name.
Step 2: Calculate the appropriate summary statistic using the new, subsetted object you just created.
What were the sexes of the first 10 participants?
What was the data for the 50th participant?
What was the mean walking time for the elderly prime condition?
What was the mean walking time for the neutral prime condition?
What was the mean walking time for participants less than 23 years old?
What was the mean walking time for females with a close relationship with their grandparents?
What was the mean walking time for males over 21 years old without a close relationship with their grandparents?
Checkpoint! If you got this far you are doing great!
Creating new dataframe objects
Create a new dataframe called
priming.simplethat only contains the columnsid,prime, andwalkSome of the data don’t make any sense. For example, some walking times are negative, some prime values aren’t correct, and some prime.duration values weren’t part of the original study plan. Create a new dataframe called
priming.c(aka., priming clean) that only includes rows with valid values for each column – do this by looking for an few strange values in each column, and by looking at the original dataset description. Additionally, only include participants who passed the attention check. Here’s a skeleton of how your code should look
# Create priming.c, a subset of the original priming data
# (replace __ with the appropriate values)
priming.c <- subset(priming,
subset = sex %in% c(_____) &
age > ____ &
attention == ___ &
prime %in% c(___) &
prime.duration %in% c(___) &
grandparents %in% c(___) &
walk > ___ )How many participants gave valid data and passed the attention check? (Hint: Use the result from your previous answer!)
Of those participants who gave valid data and passed the attention check, what was the mean walking time of those given the elderly and neutral prime (calculate these separately).
Challenges
The following questions apply to your cleaned dataframe (priming.c)
Did the effect of priming condition on walking times differ between the first 50 and the last 50 participants. That is, what was the difference in the mean walking time between the two priming conditions for the first 50 participants? What about the last 50 participants? (Hint: Make sure to index the data using
id!)?Do you find evidence that a participant’s relationship with their grandparents affects how they responded to the primes?
Due to a computer error, the data from every participant with an even id number is invalid. Remove these data from your
priming.cdataframe.
Submit!
Save and email your wpa_X_LastFirst.R file to me at nathaniel.phillips@unibas.ch. Then, go to https://goo.gl/forms/8pKm39PMS29JoLjI2 to complete the WPA submission form.