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-OSF-corrected_EHedit.xls'
d <- read_excel(data_path, sheet=3)
d <- d |>
rename(agreement = `Agreement (0=complete disagreement; 5=complete agreement)`) |>
select(group, participant, subscale, agreement) |>
mutate(
group = case_when(
group == "young Spaniard" ~ "Spaniard",
TRUE ~ group
),
participant = paste0(group, participant)
)
Try to recreate Figure 2 (fig2.png, also included in the same folder as this Rmd file):
d |>
group_by(group, subscale) |>
summarise(
agreement_mean = mean(agreement),
agreement_se = sd(agreement) / sqrt(n())
) |>
ggplot(aes(x = group, y = agreement_mean, fill = subscale)) +
geom_bar(stat = "identity", position = "dodge") +
geom_errorbar(
aes(
ymin = agreement_mean - agreement_se,
ymax = agreement_mean + agreement_se
),
width = .2, position = position_dodge(.9)
) +
coord_cartesian(ylim = c(2, 4)) +
ylab("Rating") +
theme_classic()
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
model <- d |>
group_by(group, subscale, participant) |>
summarise(agreement_mean = mean(agreement)) |>
aov_4(agreement_mean ~ group + (subscale|participant), data = _)
anova(model, es = "pes")
## Anova Table (Type 3 tests)
##
## Response: agreement_mean
## num Df den Df MSE F pes Pr(>F)
## group 1 78 0.20950 2.8811 0.035622 0.093611 .
## subscale 1 78 0.51265 8.0980 0.094055 0.005659 **
## group:subscale 1 78 0.51265 19.1445 0.197073 3.713e-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,
# reproduce the above results here
ds <- d |>
group_by(group, subscale, participant) |>
summarise(agreement_mean = mean(agreement)) |>
filter(subscale == "PAST") |>
group_split()
t.test(ds[[1]]$agreement_mean, ds[[2]]$agreement_mean)
##
## Welch Two Sample t-test
##
## data: ds[[1]]$agreement_mean and ds[[2]]$agreement_mean
## t = 4.0034, df = 76.872, p-value = 0.0001428
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.3106955 0.9256681
## 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)
# reproduce the above results here
ds <- d |>
group_by(group, subscale, participant) |>
summarise(agreement_mean = mean(agreement)) |>
filter(subscale == "FUTURE") |>
group_split()
t.test(ds[[1]]$agreement_mean, ds[[2]]$agreement_mean)
##
## Welch Two Sample t-test
##
## data: ds[[1]]$agreement_mean and ds[[2]]$agreement_mean
## t = -3.3637, df = 73.02, p-value = 0.001228
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.5932088 -0.1517912
## sample estimates:
## mean of x mean of y
## 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?
Kinda? The original dataset gave some pretty wrong results, but the ‘data/DeLaFuenteEtAl_2014_RawData-OSF-corrected_EHedit.xls’ dataset was more accurate. It still wasn’t 100%, and it is a couple hundredths off for the specific statistical values.
How difficult was it to reproduce your results?
Fairly. I had issues with the between subject comparisons since all participants were labeled 1-40. I had to relabel them with Spaniard or Moroccan prepended to make it work.
What aspects made it difficult? What aspects made it easy?
Bad labeling and missing data in the original dataset made it a bit more difficult. The tests themselves were fine though (ignoring the slight errors).