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(dplyr)
# #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)
d
## # A tibble: 1,680 × 5
## group participant subscale item Agreement (0=complet…¹
## <chr> <dbl> <chr> <chr> <dbl>
## 1 Moroccan 1 PAST 1. Para mí son muy impo… 4
## 2 Moroccan 1 PAST 2. Los jóvenes deben co… 4
## 3 Moroccan 1 PAST 3. Creo que las persona… 5
## 4 Moroccan 1 PAST 4. La juventud de hoy e… 2
## 5 Moroccan 1 PAST 5. Los ancianos saben m… 4
## 6 Moroccan 1 PAST 6. El modo correcto de … 3
## 7 Moroccan 1 PAST 7. Me cuesta aceptar lo… 4
## 8 Moroccan 1 PAST 8. La forma de divertir… 2
## 9 Moroccan 1 PAST 9. La forma de vivir tr… 2
## 10 Moroccan 1 PAST 10. Considero que los a… 3
## # ℹ 1,670 more rows
## # ℹ abbreviated name:
## # ¹`Agreement (0=complete disagreement; 5=complete agreement)`
# made it a little less awkward
clean_data <- d%>%
rename("Agreement" = "Agreement (0=complete disagreement; 5=complete agreement)") %>%
select(-item)
clean_data$group <-
replace(clean_data$group, clean_data$group == "young Spaniard", "Spaniard")
clean_data
## # A tibble: 1,680 × 4
## group participant subscale Agreement
## <chr> <dbl> <chr> <dbl>
## 1 Moroccan 1 PAST 4
## 2 Moroccan 1 PAST 4
## 3 Moroccan 1 PAST 5
## 4 Moroccan 1 PAST 2
## 5 Moroccan 1 PAST 4
## 6 Moroccan 1 PAST 3
## 7 Moroccan 1 PAST 4
## 8 Moroccan 1 PAST 2
## 9 Moroccan 1 PAST 2
## 10 Moroccan 1 PAST 3
## # ℹ 1,670 more rows
rating_avg <- clean_data %>%
group_by(group,subscale)%>%
summarise(rating_avg = mean(Agreement))
rating_avg
## # A tibble: 4 × 3
## # Groups: group [2]
## group subscale rating_avg
## <chr> <chr> <dbl>
## 1 Moroccan FUTURE 3.12
## 2 Moroccan PAST 3.29
## 3 Spaniard FUTURE 3.49
## 4 Spaniard PAST 2.68
Try to recreate Figure 2 (fig2.png, also included in the same folder as this Rmd file):
ggplot(data = rating_avg, aes(x = group, y = rating_avg, fill = subscale)) +
geom_col(position = "dodge", width = 0.5) +
labs(y = "Rating")
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).
# anova <- aov("Agreement" ~ group, data = rating_avg)
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?
I was unable to reproduce the ANOVA test and the other parts of inferential statistics. I tried looking at how to format the aov() function, but was unable to figure it out within the time constraint. Trouble-shooting online didn’t really help, and it wasn’t clear which parameters to pass in.
How difficult was it to reproduce your results?
For all of the graphing/tidying the data, I mostly looked online to learn how to rename, replace, and add color. I couldn’t solve the color issue for the ggplot because I wasn’t sure where to add the color = “gray” or maybe fill = “gray.” I had no idea how to do the ANOVA test and the others.
What aspects made it difficult? What aspects made it easy?
The difficult part was understanding what values/columns/etc I needed to access in order to pass in the aov() function, or if I was supposed to even use that test. I also wasn’t sure if this was a one-way or two-way test. I’m assuming two-way because we have Spaniards and Moroccans but I’m not sure.