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.

Methods summary:

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.


Target outcomes:

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) ——

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
library(effectsize)

# #optional packages:
# library(afex) #anova functions
# library(langcog) #95 percent confidence intervals

Step 2: Load data

# Just Experiment 6
data <- read_excel("data/study 6-accessible-feud.xlsx")

Step 3: Tidy data

The data are already tidy as provided by the authors.

Step 4: Run analysis

Pre-processing

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

Descriptive statistics (replicated)

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)

Slack: 0-poor, 1-rich, Large: 0-small, 1-large

# reproduce the above results here
d_summary <- d%>%
  group_by(Slack,Large)%>%
  select(expense)%>%
  summarise(mean_expense = round(mean(expense),2),
            n_group = max(row_number()),
            lower_ci = round(mean(expense)-1.96*sd(expense)/sqrt(n_group),2),
            upper_ci = round(mean(expense)+1.96*sd(expense)/sqrt(n_group),2))

d_summary
## # A tibble: 4 × 6
## # Groups:   Slack [2]
##   Slack Large mean_expense n_group lower_ci upper_ci
##   <dbl> <dbl>        <dbl>   <int>    <dbl>    <dbl>
## 1     0     0         8.33      21     7.14     9.52
## 2     0     1         8.83      18     7.98     9.69
## 3     1     0         8.31      16     7.78     8.84
## 4     1     1         6.5       18     5.42     7.58

Inferential statistics (replicated)

A 2 (scarcity condition) × 2 (account condition) analysis of variance revealed a significant interaction, F(1, 69) = 5.16, p < .05, ηp2 = .07.

# reproduce the above results here
anova1 <- aov(expense ~ Slack * Large,data = d)
summary(anova1)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Slack        1   26.6  26.646   5.690 0.0198 *
## Large        1    6.1   6.078   1.298 0.2585  
## Slack:Large  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
effectsize::eta_squared(anova1, partial = TRUE)
## # Effect Size for ANOVA (Type I)
## 
## Parameter   | Eta2 (partial) |       95% CI
## -------------------------------------------
## Slack       |           0.08 | [0.01, 1.00]
## Large       |           0.02 | [0.00, 1.00]
## Slack:Large |           0.07 | [0.00, 1.00]
## 
## - One-sided CIs: upper bound fixed at (1).
ggplot(d_summary,aes(x = as.factor(Slack), y = mean_expense, group = as.factor(Large), fill = as.factor(Large)))+
  geom_col(position = position_dodge2(preserve = "single", padding = 0.1))+
  geom_errorbar(aes(ymin=lower_ci, ymax=upper_ci), width=.2,position=position_dodge(.9))+
  labs(title = "How expensive or costly it is to lose 10 seconds",
       subtitle = "Error bar = 95% CI",
       x = "Scarcity",
       y = "Expensive (1-10)")

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 all numbers that were reported: the mean and 95% CI, the inferential statistics, as well as the effect size.

How difficult was it to reproduce your results?

I would rate 2 out of a 10-point scale. Everything is super clear, and I got the same results right away.

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

The main aspect of difficulty is that the original paper did not identify which participant was excluded, and from original data, it was not intuitively coded. If I were the author, I would have created a Boolean variable called “exclude”, or set this participant’s outcome variable value as -99.

Another thing is that I would personally have used .csv file, rather than .xlsx.

What made the reproduction easy was that the data was already in long format, and that the variable names made sense.