For this exercise, please try to reproduce the results from Experiment 6 of the associated paper (Shah, Shafir, & Mullainathan, 2015). The PDF of the paper is included in the same folder as this Rmd file.
The authors were interested in the effect of scarcity on people’s consistency of valuation judgments. In this study, participants played a game of Family Feud and were given either 75 s (budget - “poor” condition) or 250 s (budget - “rich” condition) to complete the game. After playing the game, participants were either primed to think about a small account of time necessary to play one round of the game (account -“small” condition) or a large account (their overall time budget to play the entire game, account - “large” condition.) Participants rated how costly it would feel to lose 10s of time to play the game. The researchers were primarily interested in an interaction between the between-subjects factors of scarcity and account, hypothesizing that those in the budget - “poor” condition would be more consistent in their valuation of the 10s regardless of account in comparison with those in the budget - “rich” condition. The authors tested this hypothesis with a 2x2 between-subjects ANOVA.
Below is the specific result you will attempt to reproduce (quoted directly from the results section of Experiment 6):
“One participant was excluded because of a computer malfunction during the game. Time-rich participants rated the loss as more expensive when they thought about a small account (M = 8.31, 95% CI = [7.78, 8.84]) than when they thought about a large account (M = 6.50, 95% CI = [5.42, 7.58]), whereas time-poor participants’ evaluations did not differ between the small-account condition (M = 8.33, 95% CI = [7.14, 9.52]) and the large account condition (M = 8.83, 95% CI = [7.97, 9.69]). A 2 (scarcity condition) × 2 (account condition) analysis of variance revealed a significant interaction, F(1, 69) = 5.16, p < .05, ηp2 = .07.” (Shah, Shafir & Mullainathan, 2015) ——
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(afex) #anova functions
# library(langcog) #95 percent confidence intervals
# Just Experiment 6
data <- read_excel("data/study 6-accessible-feud.xlsx")
The data are already tidy as provided by the authors.
One participant was excluded because of a computer malfunction during the game (Shah, Shafir, & Mullainathan, 2015, p. 408)
Note: The original paper does not identify the participant that was excluded, but it was later revealed through communication with the authors that it was participant #16. The exclusion is performed below.
# Participant #16 should be dropped from analysis
excluded <- "16"
d <- data %>%
filter(!Subject %in% excluded) #participant exclusions
Time-rich participants rated the loss as more expensive when they thought about a small account (M = 8.31, 95% CI = [7.78, 8.84]) than when they thought about a large account (M = 6.50, 95% CI = [5.42, 7.58]), whereas time-poor participants’ evaluations did not differ between the small-account condition (M = 8.33, 95% CI = [7.14, 9.52]) and the large- account condition (M = 8.83, 95% CI = [7.97, 9.69]). (Shah, Shafir, & Mullainathan, 2015, p. 408)
library(dplyr)
excluded <- 16
d <- data %>%
filter(!Subject %in% excluded) %>%
mutate(
scarcity = ifelse(Slack == 0, "poor", "rich"),
account = ifelse(Large == 0, "small", "large")
)
print(colnames(d))
## [1] "Subject" "Cond" "Slack" "Large" "tmest" "expense"
## [7] "error" "...8" "...9" "...10" "...11" "...12"
## [13] "...13" "...14" "scarcity" "account"
d_summary <- d %>%
group_by(scarcity, account) %>%
summarise(
M = mean(expense, na.rm = TRUE),
SD = sd(expense, na.rm = TRUE),
n = n(),
SE = SD / sqrt(n),
CI_low = M - qt(0.975, n - 1) * SE,
CI_high = M + qt(0.975, n - 1) * SE,
.groups = "drop"
)
knitr::kable(d_summary, digits = 2)
| scarcity | account | M | SD | n | SE | CI_low | CI_high |
|---|---|---|---|---|---|---|---|
| poor | large | 8.83 | 1.86 | 18 | 0.44 | 7.91 | 9.76 |
| poor | small | 8.33 | 2.78 | 21 | 0.61 | 7.07 | 9.60 |
| rich | large | 6.50 | 2.33 | 18 | 0.55 | 5.34 | 7.66 |
| rich | small | 8.31 | 1.08 | 16 | 0.27 | 7.74 | 8.89 |
A 2 (scarcity condition) × 2 (account condition) analysis of variance revealed a significant interaction, F(1, 69) = 5.16, p < .05, ηp2 = .07.
anova_result <- aov(expense ~ scarcity * account, data = d)
summary(anova_result)
## Df Sum Sq Mean Sq F value Pr(>F)
## scarcity 1 26.6 26.646 5.690 0.0198 *
## account 1 6.1 6.078 1.298 0.2585
## scarcity:account 1 24.2 24.172 5.162 0.0262 *
## Residuals 69 323.1 4.683
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova_table <- summary(anova_result)[[1]]
SS_effect <- anova_table["scarcity:account", "Sum Sq"]
SS_resid <- anova_table["Residuals", "Sum Sq"]
eta_p2 <- SS_effect / (SS_effect + SS_resid)
eta_p2
## [1] 0.06960553
Were you able to reproduce the results you attempted to reproduce? If not, what part(s) were you unable to reproduce?
Yes, I was able to reproduce the descriptive and inferential statistics from this aricle.
How difficult was it to reproduce your results?
Honestly, the code was complex and confusing in order to parse through the excel sheet. I had to utilize dypler in order to create means based on each label, and then find the exact data needed to generate the anova table in the excel.
What aspects made it difficult? What aspects made it easy?
I personally found it very difficult to read and interpret the “study 6-accessible-feud” excel sheet. There were multiple pages with extremely similar looking data, as well as an entire page conveniently named “sheet 2.” This made it practically impossible to tell what data the page contained, as well as how it differed from the previous pages. Also, the lables are in differing orders on each page, with some organized by condition, some by subject, and others by time used. As a whole though, the reproduction was possible and that is a testament to the authors abiding by open source guidlines and publishing their data.