## [1] "US" "CN" "demog"
## Joining, by = "subject_id"
Loaded demographic data from 199 participants. Loaded coded data from 86 participants.
Age breakdown:
d %>% group_by(subject_id, years, country) %>%
summarise(n=n()) %>%
group_by(years, country) %>%
summarise(n=n())
## `summarise()` has grouped output by 'subject_id', 'years'. You can override
## using the `.groups` argument.
## `summarise()` has grouped output by 'years'. You can override using the
## `.groups` argument.
## # A tibble: 14 × 3
## # Groups: years [7]
## years country n
## <dbl> <chr> <int>
## 1 3 CN 3
## 2 3 US 3
## 3 4 CN 5
## 4 4 US 2
## 5 5 CN 9
## 6 5 US 7
## 7 6 CN 1
## 8 6 US 9
## 9 7 CN 9
## 10 7 US 12
## 11 8 CN 4
## 12 8 US 8
## 13 9 CN 5
## 14 9 US 9
d_rmts <- d %>% filter(task_type=="RMTS")
d_rmts[which(d_rmts$resp=="relational"),]$resp = "relation"
d_rmts[which(d_rmts$resp=="object/relation"),]$resp = NA
d_rmts[which(d_rmts$resp=="NA"),]$resp = NA
d_rmts <- d_rmts %>%
mutate(object_score = ifelse(resp=="object", 1,
ifelse(resp=="relation", 0, NA)))
d_rmts %>% filter(!is.na(object_score)) %>%
group_by(subject_id, country, age) %>%
summarise(mean = mean(object_score)) %>%
ggplot(aes(x=age, y=mean, group=country, color=country)) +
geom_point() + geom_smooth() + theme_classic()
## `summarise()` has grouped output by 'subject_id', 'country'. You can override
## using the `.groups` argument.
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
d_rmts1 <- d_rmts %>% filter(trial_number==1)
d_rmts1 %>% filter(!is.na(object_score)) %>%
group_by(subject_id, country, age) %>%
ggplot(aes(x=age, y=object_score, group=country, color=country)) +
geom_point() + geom_smooth() + theme_classic()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
d_fd <- d %>% filter(task_type=="FD")
d_fd[which(d_fd$resp=="NA"),]$resp = NA
d_fd <- d_fd %>%
mutate(focal_score = ifelse(resp=="focal", 1,
ifelse(resp=="background", 0, NA)))
d_fd %>% filter(!is.na(focal_score)) %>%
group_by(subject_id, country, age) %>%
summarise(mean_focal = mean(focal_score)) %>%
ggplot(aes(x=age, y=mean_focal, group=country, color=country)) +
geom_point() + geom_smooth() + theme_classic()
## `summarise()` has grouped output by 'subject_id', 'country'. You can override
## using the `.groups` argument.
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
d_ca <- d %>% filter(task_type=="CA")
d_ca[which(d_ca$resp=="background"),]$resp = NA
d_ca[which(d_ca$resp=="0"),]$resp = NA
d_ca[which(d_ca$resp=="NA"),]$resp = NA
d_ca <- d_ca %>% # filter(!is.na(resp)) %>%
mutate(n_person = str_count(d_ca$resp, "person"),
n_situation = str_count(d_ca$resp, "situation"),
n_scared = str_count(d_ca$resp, "scared")) %>%
mutate(person_focus = n_person - n_situation,
person_scared = n_person + n_scared - n_situation)
p1 <- d_ca %>% ggplot(aes(x = age, y = person_focus, group = country, color = country)) +
geom_point() + geom_smooth() + theme_classic()
p2 <- d_ca %>% ggplot(aes(x = age, y = person_scared, group = country, color = country)) +
geom_point() + geom_smooth() + theme_classic()
ggarrange(p1, p2, common.legend = T)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 15 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 15 rows containing missing values (`geom_point()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 15 rows containing non-finite values (`stat_smooth()`).
## Removed 15 rows containing missing values (`geom_point()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 15 rows containing non-finite values (`stat_smooth()`).
## Removed 15 rows containing missing values (`geom_point()`).
d_up <- d %>% filter(task_type=="UP")
d_up[which(d_up$resp=="non_unique"),]$resp = "non-unique"
d_up[which(d_up$resp=="unique/non_unique"),]$resp = NA
d_up[which(d_up$resp=="NA"),]$resp = NA
d_up <- d_up %>%
mutate(unique = ifelse(resp=="unique", 1,
ifelse(resp=="non-unique", 0, NA)))
d_up %>% filter(!is.na(unique)) %>%
group_by(subject_id, country, age) %>%
ggplot(aes(x=age, y=unique, group=country, color=country)) +
geom_point() + geom_smooth() + theme_classic()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'