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
library(ggplot2)
# #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 <- '/Users/ganmol/Downloads/DeLaFuenteEtAl_2014_RawData.xls'
d <- read_excel(data_path, sheet=3)
colnames(d) <- c('group', 'participant', 'subscale', 'item', 'agreement') #rename columns
d <- d |>
mutate(group=recode(group,"young Spaniard" = "Spaniard")) #rename group label to be easier to type
figure2_d <- d |>
group_by(group, subscale) |>
summarise(mean_agreement = mean(agreement),
length = n(),
stderr = sd(agreement)/sqrt(length))
figure2_d
## # A tibble: 4 × 5
## # Groups: group [2]
## group subscale mean_agreement length stderr
## <chr> <chr> <dbl> <int> <dbl>
## 1 Moroccan FUTURE 3.12 400 0.0698
## 2 Moroccan PAST 3.29 440 0.0698
## 3 Spaniard FUTURE 3.49 400 0.0600
## 4 Spaniard PAST 2.68 440 0.0578
Try to recreate Figure 2 (fig2.png, also included in the same folder as this Rmd file):
#ggplot(figure2_d, aes(x=group, y = mean_agreement, fill = subscale)) +
#geom_bar()
#I need some help here!
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
# anova1 <- aov(agreement ~ scale * group, data = d) |>
# summary()
#not sure how to do the mixed analysis here!
Moroccans showed greater agreement with past-focused statements than Spaniards did, t(78) = 4.04, p = .001,
# reproduce the above results here
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
Were you able to reproduce the results you attempted to reproduce? If not, what part(s) were you unable to reproduce?
No – I wasn’t able to get through this reproduction within the 3 hour time limit unfortunately. I got stuck on some of the more nuanced analyses and need some more help finalizing this.
How difficult was it to reproduce your results?
Quite difficult. I’m not sure why this one was so much harder than the other (A3)
What aspects made it difficult? What aspects made it easy?
As I said in the first response, this one had more nuanced analyses in it (mixed ANOVA) that I was unfamiliar with than did the other one. I also wasn’t sure if I did the data cleaning/processing correctly and that interfered with my ability to do the figure.