For this exercise, please try to reproduce the results from Study 1 of the associated paper (Joel, Teper, & MacDonald, 2014). The PDF of the paper is included in the same folder as this Rmd file.

Methods summary:

In study 1, 150 introductory psychology students were randomly assigned to a “real” or a “hypothetical” condition. In the real condition, participants believed that they would have a real opportuniy to connect with potential romantic partners. In the hypothetical condition, participants simply imagined that they are on a date. All participants were required to select their favorite profile and answer whether they were willing to exchange contact information.


Target outcomes:

Below is the specific result you will attempt to reproduce (quoted directly from the results section of Study 1):

We next tested our primary hypothesis that participants would be more reluctant to reject the unattractive date when they believed the situation to be real rather than hypothetical. Only 10 of the 61 participants in the hypothetical condition chose to exchange contact information with the unattractive potential date (16%). In contrast, 26 of the 71 participants in the real condition chose to exchange contact information (37%). A chi-square test of independence indicated that participants were significantly less likely to reject the unattractive potential date in the real condition compared with the hypothetical condition, X^2(1, N = 132) = 6.77, p = .009.


Step 1: Load packages

library(tidyverse) # for data munging
library(knitr) # for kable table formating
library(haven) # import and export 'SPSS', 'Stata' and 'SAS' Files
library(readxl) # import excel files

# #optional packages:
# library(broom)
# library(labelled)# converts SPSS's labelled to R's factor 

Step 2: Load data

# Just Study 1
d <- read_sav('data/Empathy Gap Study 1 data.sav')

d
## # A tibble: 132 × 125
##       ID attachment1 attachment2 attachment3 attachment4 attachment5 attachment6
##    <dbl>       <dbl>       <dbl>       <dbl>       <dbl>       <dbl>       <dbl>
##  1    53           3           4           5           3           2           3
##  2    93           5           1           3           4           2           2
##  3    83           3           6           3           6           5           4
##  4    27           2           6           5           2           5           5
##  5     6           3           6           3           5           5           5
##  6   116           4           7           5           6           6           6
##  7    24           6           5           6           3           2           2
##  8   127           6           2           6           5           4           5
##  9    32           5           5           5           4           4           2
## 10    73           4           6           3           6           3           4
## # ℹ 122 more rows
## # ℹ 118 more variables: attachment7 <dbl>, attachment8 <dbl>,
## #   attachment9 <dbl>, attachment10 <dbl>, attachment11 <dbl>,
## #   attachment12 <dbl>, attachment13 <dbl>, attachment14 <dbl>,
## #   attachment15 <dbl>, attachment16 <dbl>, attachment17 <dbl>,
## #   attachment18 <dbl>, attachment19 <dbl>, attachment20 <dbl>,
## #   attachment21 <dbl>, attachment22 <dbl>, attachment23 <dbl>, …

Step 3: Tidy data

clean_data = d%>%
  select(ID, condition, exchangeinfo)

clean_data
## # A tibble: 132 × 3
##       ID condition        exchangeinfo
##    <dbl> <dbl+lbl>        <dbl+lbl>   
##  1    53 1 [real]         1 [yes]     
##  2    93 1 [real]         2 [no]      
##  3    83 1 [real]         2 [no]      
##  4    27 0 [hypothetical] 2 [no]      
##  5     6 0 [hypothetical] 1 [yes]     
##  6   116 0 [hypothetical] 1 [yes]     
##  7    24 0 [hypothetical] 2 [no]      
##  8   127 0 [hypothetical] 2 [no]      
##  9    32 1 [real]         1 [yes]     
## 10    73 1 [real]         2 [no]      
## # ℹ 122 more rows

Step 4: Run analysis

Descriptive statistics

Only 10 of the 61 participants in the hypothetical condition chose to exchange contact information with the unattractive potential date (16%). In contrast, 26 of the 71 participants in the real condition chose to exchange contact information (37%).

love_data <- clean_data %>%
  mutate(exchangeinfo = if_else(exchangeinfo == 1, "yes", "no")) %>%
  group_by(condition) %>%
  summarise(
    exchanges = sum(exchangeinfo == "yes", na.rm = TRUE), 
    total = n(),
    exchange_percent = (exchanges / total) * 100)

love_data$condition <- factor(love_data$condition, levels = c(0, 1), labels = c("Hypothetical", "Real"))

love_data
## # A tibble: 2 × 4
##   condition    exchanges total exchange_percent
##   <fct>            <int> <int>            <dbl>
## 1 Hypothetical        10    61             16.4
## 2 Real                26    71             36.6

Inferential statistics

A chi-square test of independence indicated that participants were significantly less likely to reject the unattractive potential date in the real condition compared with the hypothetical condition, X^2(1, N = 132) = 6.77, p = .009.

Hint: if you are using the function chisq.test(), make sure to set the continuity correction to false (“correct = FALSE”) since sample size is greater than 20.

clean_data$condition <- factor(clean_data$condition, levels = c(0, 1), labels = c("Hypothetical", "Real"))
clean_data$exchangeinfo <- factor(clean_data$exchangeinfo, levels = c(1, 2), labels = c("Yes", "No"))
cross_tab <- table(clean_data$condition, clean_data$exchangeinfo)

chi_square <- chisq.test(cross_tab, correct = FALSE) 
cross_tab
##               
##                Yes No
##   Hypothetical  10 51
##   Real          26 45
chi_square
## 
##  Pearson's Chi-squared test
## 
## data:  cross_tab
## X-squared = 6.7674, df = 1, p-value = 0.009284

Step 5: Reflection

Were you able to reproduce the results you attempted to reproduce? If not, what part(s) were you unable to reproduce?

I was able to reproduce the same results from Study 1 by Joel, Teper, & MacDonald 2014).

How difficult was it to reproduce your results?

At first it was a little tricky figuring out how to make the cross tab work for the chisq.test(). I worked with Eunjung and we figured out how to make the table instead of directly calling “chisq.test(clean_data$ condition, clean_data$ exchangeinfo, correct = FALSE).”

What aspects made it difficult? What aspects made it easy?

Personally, looking at all of the data on R was difficult because the “exchangeinfo” column was so deep in the dataset and I was manually flipping through each page to look at the columns needed when tidying the data. The easy part was understanding the experiment. It was pretty self explanatory in terms of what the researchers were testing.