For this exercise, please try to reproduce the results from Experiment 2 of the associated paper (de la Fuente, Santiago, Roman, Dumitrache, & Casasanto, 2014). The PDF of the paper is included in the same folder as this Rmd file.
Researchers tested the question of whether temporal focus differs between Moroccan and Spanish cultures, hypothesizing that Moroccans are more past-focused, whereas Spaniards are more future-focused. Two groups of participants (\(N = 40\) Moroccan and \(N=40\) Spanish) completed a temporal-focus questionnaire that contained questions about past-focused (“PAST”) and future-focused (“FUTURE”) topics. In response to each question, participants provided a rating on a 5-point Likert scale on which lower scores indicated less agreement and higher scores indicated greater agreement. The authors then performed a mixed-design ANOVA with agreement score as the dependent variable, group (Moroccan or Spanish, between-subjects) as the fixed-effects factor, and temporal focus (past or future, within-subjects) as the random effects factor. In addition, the authors performed unpaired two-sample t-tests to determine whether there was a significant difference between the two groups in agreement scores for PAST questions, and whether there was a significant difference in scores for FUTURE questions.
Below is the specific result you will attempt to reproduce (quoted directly from the results section of Experiment 2):
According to a mixed analysis of variance (ANOVA) with group (Spanish vs. Moroccan) as a between-subjects factor and temporal focus (past vs. future) as a within-subjectS factor, temporal focus differed significantly between Spaniards and Moroccans, as indicated by a significant interaction of temporal focus and group, F(1, 78) = 19.12, p = .001, ηp2 = .20 (Fig. 2). Moroccans showed greater agreement with past-focused statements than Spaniards did, t(78) = 4.04, p = .001, and Spaniards showed greater agreement with future-focused statements than Moroccans did, t(78) = −3.32, p = .001. (de la Fuente et al., 2014, p. 1685).
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/functions:
# library(afex) # anova functions
# library(ez) # anova functions 2
# library(scales) # for plotting
std.err <- function(x) sd(x)/sqrt(length(x)) # standard error
# Just Experiment 2
data_path <- 'data/DeLaFuenteEtAl_2014_RawData.xls'
d <- read_excel(data_path, sheet=3)
df <- d
# Rename agreement column
old_name <- "Agreement (0=complete disagreement; 5=complete agreement)"
colnames(df)[colnames(df) == old_name] <- 'agreement'
# Change 'young spaniard to Spaniard'
df$group <- replace(df$group, df$group == "young Spaniard", "Spaniard")
df$participant <- factor(df$participant)
Try to recreate Figure 2 (fig2.png, also included in the same folder as this Rmd file):
data_table <- df |>
group_by(group, subscale) |>
summarize(avg = mean(agreement), se=std.err(agreement))
plt <- barplot(
avg~subscale+group,data_table,
beside=TRUE,
ylim=c(2,4),
xpd=FALSE,
ylab="Rating",
xlab="",
col=c("#DEDFE0", "#818385"),
legend.text=c("Future-Focused Statements", "Past-Focused Statements"),
args.legend = list(x="topright")
)
arrows(
x0=plt,
y0=data_table$avg + data_table$se,
y1=data_table$avg - data_table$se,
angle=90,
code=0,
length=0.1
)
According to a mixed analysis of variance (ANOVA) with group (Spanish vs. Moroccan) as a between-subjects factor and temporal focus (past vs. future) as a within-subjects factor, temporal focus differed significantly between Spaniards and Moroccans, as indicated by a significant interaction of temporal focus and group, F(1, 78) = 19.12, p = .001, ηp2 = .20 (Fig. 2).
# reproduce the above results here
summary(
aov(agreement ~ group*subscale + Error(participant/subscale), data=df)
)
##
## Error: participant
## Df Sum Sq Mean Sq F value Pr(>F)
## subscale 1 1.92 1.917 0.787 0.38
## Residuals 38 92.54 2.435
##
## Error: participant:subscale
## Df Sum Sq Mean Sq F value Pr(>F)
## subscale 1 42.31 42.31 6.652 0.0139 *
## Residuals 38 241.69 6.36
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Error: Within
## Df Sum Sq Mean Sq F value Pr(>F)
## group 1 9.0 9.01 5.532 0.0188 *
## group:subscale 1 102.8 102.82 63.161 3.56e-15 ***
## Residuals 1599 2603.0 1.63
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Moroccans showed greater agreement with past-focused statements than Spaniards did, t(78) = 4.04, p = .001,
# reproduce the above results here
t.test(agreement~group, data=df[df$subscale=="PAST",])
##
## Welch Two Sample t-test
##
## data: agreement by group
## t = 6.8228, df = 848.31, p-value = 1.698e-11
## alternative hypothesis: true difference in means between group Moroccan and group Spaniard is not equal to 0
## 95 percent confidence interval:
## 0.4403454 0.7960182
## sample estimates:
## mean in group Moroccan mean in group Spaniard
## 3.293182 2.675000
and Spaniards showed greater agreement with future-focused statements than Moroccans did, t(78) = −3.32, p = .001.(de la Fuente et al., 2014, p. 1685)
# reproduce the above results here
t.test(agreement~group, data=df[df$subscale=="FUTURE",])
##
## Welch Two Sample t-test
##
## data: agreement by group
## t = -4.0469, df = 780.2, p-value = 5.708e-05
## alternative hypothesis: true difference in means between group Moroccan and group Spaniard is not equal to 0
## 95 percent confidence interval:
## -0.5531879 -0.1918121
## sample estimates:
## mean in group Moroccan mean in group Spaniard
## 3.1200 3.4925
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 results, but I was not able to reproduce the specific values for the tests. The t values were not consistent with the paper’s results, nor was the p value within the ANOVA.
How difficult was it to reproduce your results?
It was pretty difficult to reproduce the results this time around.
What aspects made it difficult? What aspects made it easy?
Not understanding why they decided to use the variant of ANOVA made this difficult as well as there not being a parsable (and understandable) online reference on how to do ANOVA with between- and within-components. I feel like the data was already tidy, so making the plot was generally easy!