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.
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.
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.
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
# Just Study 1
d <- read_sav('data/Empathy Gap Study 1 data.sav')
tidy_d <- d %>%
select(ID, condition, exchangeinfo) %>%
mutate(
condition = if_else(condition == 0, "hypothetical", "real"),
exchange_info = if_else(exchangeinfo == 1, "yes", "no")
) %>%
select(-exchangeinfo)
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%).
# reproduce the above results here
descriptive_stats <- tidy_d %>%
group_by(condition, exchange_info) %>%
summarize(
n = n()
)
hypothetical_all <- tidy_d %>%
group_by(condition) %>%
summarize(
n = n()
) %>%
filter(condition == "hypothetical") %>%
select(n) %>%
pull()
hypothetical_exchanged_info <- descriptive_stats %>%
filter(condition == "hypothetical", exchange_info == "yes") %>%
select(n) %>%
pull()
percentage_hypothetical_exchanged <- hypothetical_exchanged_info / hypothetical_all
real_all <- tidy_d %>%
group_by(condition) %>%
summarize(
n = n()
) %>%
filter(condition == "real") %>%
select(n) %>%
pull()
real_exchanged_info <- descriptive_stats %>%
filter(condition == "real", exchange_info == "yes") %>%
select(n) %>%
pull()
percentage_real_exchanged <- real_exchanged_info / real_all
hypothetical_all
## [1] 61
hypothetical_exchanged_info
## [1] 10
percentage_hypothetical_exchanged
## [1] 0.1639344
real_all
## [1] 71
real_exchanged_info
## [1] 26
percentage_real_exchanged
## [1] 0.3661972
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.
# reproduce the above results here
descriptive_stats %>%
ungroup() %>%
pivot_wider(
names_from = exchange_info,
values_from = n
) %>% select(-condition) %>%
chisq.test(
correct = FALSE
)
##
## Pearson's Chi-squared test
##
## data: .
## X-squared = 6.7674, df = 1, p-value = 0.009284
Were you able to reproduce the results you attempted to reproduce? If not, what part(s) were you unable to reproduce?
ANSWER HERE:Yes
How difficult was it to reproduce your results?
ANSWER HERE: Not too bad.
What aspects made it difficult? What aspects made it easy?
ANSWER HERE: The difficult part is to figure out which rows in the data provided is relevant. The naming of the file is not helpful. I initially thought it was the wrong file. In addition, the values in the cell was not very straightforward. I need to try and figure out which value corresponds to which level and group-assignment. The aspects that made it easy was that other than these shortcomings the data was relatively tidy for the analysis I need to reproduce.