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.
Methods summary:
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.
Target outcomes:
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).
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/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
Step 2: Load data
# Just Experiment 2
data_path <- 'data/DeLaFuenteEtAl_2014_RawData.xls'
d <- read_excel(data_path, sheet=3)
Step 3: Tidy data
d_proc <- d %>% select(-c(item)) %>% mutate(rating = `Agreement (0=complete disagreement; 5=complete agreement)`) %>% select(-c(`Agreement (0=complete disagreement; 5=complete agreement)`))
Step 4: Run analysis
Pre-processing
# alter ids of spanish group to allow for mixed anova
d_proc <- d_proc %>% mutate(participant = case_when(
.$group == "Moroccan" ~ .$participant,
.$group == "young Spaniard" ~ .$participant + 100
))
# one possibility for results not reproducing for me is that the 25th participant in both the Moroccan and Spanish groups does not have past ratings. these may have been encoded as ratings for the 40th participant (based on order in the dataframes provided). Below, I will attempt to make a dataframe with this potential error fixed and examine whether that allows reproduction of the results:
new_participant_col <- c()
for (i in 1:length(d_proc$participant)){
if (i >= 501 && i <= 521){
new_participant_col[i] = 25
}
else if (i >= 1341 && i <= 1361){
new_participant_col[i] = 125
}
else{
new_participant_col[i] = d_proc$participant[i]
}
}
attempted_fix_dataset <- d_proc
attempted_fix_dataset$participant = new_participant_col
# processing dataset for barplot
d_proc_barplot <- d_proc %>% group_by(group, subscale) %>% summarise(mean_rating = mean(rating),
se_rating = sd(rating) / sqrt(40))
Descriptive statistics
Try to recreate Figure 2 (fig2.png, also included in the same folder
as this Rmd file):
ggplot(data = d_proc_barplot, aes(x = group, y = mean_rating, fill = as.factor(subscale))) +
geom_bar(stat = "identity", position = position_dodge()) + xlab("Group")+ ylab("Rating") + labs(fill="Future / Past Focused Statement") + geom_errorbar(aes(ymin=mean_rating-se_rating, ymax=mean_rating+se_rating), width=.2,
position=position_dodge(.9))

Inferential statistics
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).
Main ANOVA
# reproduce the above results here
summary(aov_ez("participant", "rating", data=d_proc, between = "group", within = "subscale"))
##
## Univariate Type III Repeated-Measures ANOVA Assuming Sphericity
##
## Sum Sq num Df Error SS den Df F value Pr(>F)
## (Intercept) 1543.46 1 15.250 76 7692.0904 < 2.2e-16 ***
## group 0.44 1 15.250 76 2.1920 0.14287
## subscale 3.97 1 37.777 76 7.9793 0.00604 **
## group:subscale 9.12 1 37.777 76 18.3456 5.328e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Attempt to reproduce the mixed anova with the corrected dataset
summary(aov_ez("participant", "rating", data=attempted_fix_dataset, between = "group", within = "subscale"))
##
## Univariate Type III Repeated-Measures ANOVA Assuming Sphericity
##
## Sum Sq num Df Error SS den Df F value Pr(>F)
## (Intercept) 1584.47 1 16.222 78 7618.3743 < 2.2e-16 ***
## group 0.59 1 16.222 78 2.8295 0.096546 .
## subscale 4.24 1 39.941 78 8.2821 0.005163 **
## group:subscale 9.88 1 39.941 78 19.2867 3.498e-05 ***
## ---
## 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,
Past-focused t test
# reproduce the above results here
morrocan_group_past = (d_proc %>% filter(group == "Moroccan" & subscale == "PAST") %>% group_by(participant) %>% summarize(mean_rating = mean(rating)))$mean_rating
spanish_group_past = (d_proc %>% filter(group == "young Spaniard" & subscale == "PAST") %>% group_by(participant) %>% summarize(mean_rating = mean(rating)))$mean_rating
# set var.equal=TRUE to get student t-test rather than welch, which appears to be what was used in the experiment
t.test(morrocan_group_past, spanish_group_past, var.equal=TRUE)
##
## Two Sample t-test
##
## data: morrocan_group_past and spanish_group_past
## t = 3.8562, df = 76, p-value = 0.0002394
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.2851528 0.8943343
## sample estimates:
## mean of x mean of y
## 3.280886 2.691142
Attempt to reproduce past-focused t-test with corrected dataset
# reproduce the above results here
morrocan_group_past = (attempted_fix_dataset %>% filter(group == "Moroccan" & subscale == "PAST") %>% group_by(participant) %>% summarize(mean_rating = mean(rating)))$mean_rating
spanish_group_past = (attempted_fix_dataset %>% filter(group == "young Spaniard" & subscale == "PAST") %>% group_by(participant) %>% summarize(mean_rating = mean(rating)))$mean_rating
# set var.equal=TRUE to get student t-test rather than welch, which appears to be what was used in the experiment
t.test(morrocan_group_past, spanish_group_past, var.equal=TRUE)
##
## Two Sample t-test
##
## data: morrocan_group_past and spanish_group_past
## t = 4.0034, df = 78, p-value = 0.0001413
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.3107666 0.9255970
## sample estimates:
## mean of x mean of y
## 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)
Future-focused t test
# reproduce the above results here
morrocan_group_past = (d_proc %>% filter(group == "Moroccan" & subscale == "FUTURE") %>% group_by(participant) %>% summarize(mean_rating = mean(rating)))$mean_rating
spanish_group_past = (d_proc %>% filter(group == "young Spaniard" & subscale == "FUTURE") %>% group_by(participant) %>% summarize(mean_rating = mean(rating)))$mean_rating
# set var.equal=TRUE to get student t-test rather than welch, which appears to be what was used in the experiment
t.test(morrocan_group_past, spanish_group_past, var.equal=TRUE)
##
## Two Sample t-test
##
## data: morrocan_group_past and spanish_group_past
## t = -3.2098, df = 78, p-value = 0.001929
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.5758588 -0.1349746
## sample estimates:
## mean of x mean of y
## 3.138333 3.493750
Attempt to reproduce future-focused t-test with corrected
dataset
# reproduce the above results here
morrocan_group_past = (attempted_fix_dataset %>% filter(group == "Moroccan" & subscale == "FUTURE") %>% group_by(participant) %>% summarize(mean_rating = mean(rating)))$mean_rating
spanish_group_past = (attempted_fix_dataset %>% filter(group == "young Spaniard" & subscale == "FUTURE") %>% group_by(participant) %>% summarize(mean_rating = mean(rating)))$mean_rating
# set var.equal=TRUE to get student t-test rather than welch, which appears to be what was used in the experiment
t.test(morrocan_group_past, spanish_group_past, var.equal=TRUE)
##
## Two Sample t-test
##
## data: morrocan_group_past and spanish_group_past
## t = -3.4063, df = 78, p-value = 0.001044
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.5951147 -0.1560758
## sample estimates:
## mean of x mean of y
## 3.121905 3.497500
Step 5: Reflection
Were you able to reproduce the results you attempted to reproduce? If
not, what part(s) were you unable to reproduce?
With the dataset as provided, I was not able to reproduce any of the
results exactly. While significance was shown in the same direction as
claimed in the paper, the t- and F-statistics as well as degrees of
freedom were off. However, the degrees of freedom being wrong led me to
suspect the participant column in the dataset contains mistakes, and
examining the dataset led me to believe that the in both the Moroccan
and Spanish groups, many of participant 25’s ratings have been
attributed to participant 40. After attempting to fix this, results are
still not exactly accurate, but t- and F-statistics are much closer to
those reported and degrees of freedom are accurate (though p-values are
mostly lower than those reported). Even after spending significant time
on the assignment, I am not sure why the results from the corrected
dataset don’t match.
How difficult was it to reproduce your results?
Reproducing the results was quite difficult, and as noted above, the
results I have obtained are still not exactly accurate to those reported
in the paper.
What aspects made it difficult? What aspects made it easy?
The aspects that made it difficult were the (probable) mistake in the
original dataset and the lack of specification regarding the t-tests
(only the degrees of freedom would indicate one has to average ratings
within participant and subscale before running the test). The easy
aspects were the relative simplicity of the analyses.