Load data

## [1] "US"    "CN"    "demog"
## Joining, by = "subject_id"
## [1] 122
## [1] 101
## [1] 222
## [1] 221

Loaded demographic data from 256 participants. Loaded coded data from 221 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: 20 × 3
## # Groups:   years [10]
##    years country     n
##    <dbl> <chr>   <int>
##  1     3 CN         11
##  2     3 US          7
##  3     4 CN         13
##  4     4 US          4
##  5     5 CN         11
##  6     5 US          9
##  7     6 CN          7
##  8     6 US         19
##  9     7 CN         17
## 10     7 US         18
## 11     8 CN         11
## 12     8 US         15
## 13     9 CN         10
## 14     9 US         12
## 15    10 CN          7
## 16    10 US         22
## 17    11 CN          8
## 18    11 US          5
## 19    12 CN          5
## 20    12 US         10
#quick counts
youngUS <- d %>% filter(years<7,country=="US") %>% distinct(subject_id) # 39
midUS <- d %>% filter(years>=7 & years<10,country=="US") %>% distinct(subject_id) # 45 (was 43)
oldUS <- d %>% filter(years>=10,country=="US") %>% distinct(subject_id) # 37

youngCN <- d %>% filter(years<7,country=="CN") %>% distinct(subject_id) # 41 (was 42)
midCN <- d %>% filter(years>=7 & years<10,country=="CN") %>% distinct(subject_id) # 38
oldCN <- d %>% filter(years>=10,country=="CN") %>% distinct(subject_id) # 20

#US ppt lists
youngUS <- d %>% filter(years<7,country=="US")
youngUS = unique(youngUS$subject_id)

midUS <- d %>% filter(years>=7 & years<10,country=="US")
midUS = unique(midUS$subject_id)

oldUS <- d %>% filter(years>=10,country=="US")
oldUS = unique(oldUS$subject_id)

#CN ppt lists
youngCN <- d %>% filter(years<7,country=="CN")
youngCN = unique(youngCN$subject_id)

midCN <- d %>% filter(years>=7 & years<10,country=="CN")
midCN = unique(midCN$subject_id)

oldCN <- d %>% filter(years>=10,country=="CN")
oldCN = unique(oldCN$subject_id)

RMTS

d_rmts <- d %>% filter(task_type=="RMTS") 

#clean up resp coding
d_rmts[which(d_rmts$resp=="relational"),]$resp = "relation"
d_rmts[which(d_rmts$resp=="obejct"),]$resp = "object"
d_rmts[which(d_rmts$resp=="n/a"),]$resp = NA
d_rmts[which(d_rmts$resp=="NA"),]$resp = NA

#check resp cleaning
unique(d_rmts$resp)
## [1] "relation" "object"   NA
d_rmts <- d_rmts %>% 
  mutate(object_score = ifelse(resp=="object", 1, 
                             ifelse(resp=="relation", 0, NA)),
         across(c(subject_id, country), as.factor),
         trial_number = as.numeric(trial_number)) %>% 
    mutate(age_sc = scale(age))

#PREREG Ambiguous RMTS (logistic regression): choice ~ culture * age + (trial_num | subject). 
m_rmts <- glmer(object_score ~ country * age_sc + (trial_number | subject_id), 
                data = d_rmts,
                family = "binomial") #does not converge
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.0881329 (tol = 0.002, component 1)
m_rmts2 <- glmer(object_score ~ country * age_sc + (1 | subject_id), 
                data = d_rmts,
                family = "binomial") #only intercept

#Because of concerns that children may (exploratorily) change their response strategy on later trials (2-4), we will also analyze first trial responding separately (logistic regression: choice ~ culture * age). If this first trials analysis produces results that differ significantly from our regression with all trials, we will rely on the first trial results for interpretation.
m_rmts_first <- glm(object_score ~ country * age_sc,
                      data = d_rmts %>% filter(trial_number == 1),
                      family = "binomial") #only intercept

#is there a curvilinear relationship bw age and performance?
m_rmts_first_curve <- glm(object_score ~ country * poly(age_sc, 2),
                      data = d_rmts %>% filter(trial_number == 1),
                      family = "binomial") #only intercept


d_rmts %>% filter(!is.na(object_score)) %>%
  group_by(subject_id, country, age) %>%
  summarise(mean = mean(object_score)) %>%
  ggplot(aes(x=jitter(age,.1), y=mean, group=country, color=country)) + 
  geom_point(alpha=.5) + 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=jitter(object_score,.1), group=country, color=country)) + 
  geom_point(alpha=.5) + geom_smooth() + theme_classic()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

#mean perf looks similar across countries, but first response seems to show an object bias in the youngest US ppts

Free Description

d_fd <- d %>% filter(task_type=="FD")
d_fd[which(d_fd$resp=="NA"),]$resp = NA
d_fd[which(d_fd$resp=="N/A"),]$resp = NA
d_fd[which(d_fd$resp=="n/a"),]$resp = NA
d_fd[which(d_fd$resp=="Focal"),]$resp = "focal"

#check resp cleaning
unique(d_fd$resp)
## [1] "focal"      "background" NA
d_fd <- d_fd %>% 
  mutate(focal_score = ifelse(resp=="focal", 1, 
                             ifelse(resp=="background", 0, NA))) %>% 
  mutate(age_sc = scale(age))


#PREREG: (a, logistic regression) first_mention ~ culture * age + (1 | subject) + (culture | scene)
#(b, Poisson regression) description_num ~ description_type * culture * age + (description_type | subject) + (culture | scene)
m_fd1 <- glmer(focal_score ~ country * age_sc + (1 | subject_id) + (country | trial_number),
              data = d_fd,
              family = "binomial") #is singular
## boundary (singular) fit: see help('isSingular')
m_fd2 <- glmer(focal_score ~ country * age_sc + (1 | subject_id) + (1 | trial_number),
              data = d_fd,
              family = "binomial") #only intercept sig


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(alpha=.5) + 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'

Causal Attribution

d_ca <- d %>% filter(task_type=="CA") 

d_ca[which(d_ca$resp=="0"),]$resp = "scared"
d_ca[which(d_ca$resp=="personal"),]$resp = "person"
d_ca[which(d_ca$resp=="NA"),]$resp = NA
d_ca[which(d_ca$resp=="n/a"),]$resp = NA

#check resp cleaning 
unique(d_ca$resp)
##  [1] "scared, situation"                                                 
##  [2] "person"                                                            
##  [3] "scared"                                                            
##  [4] "situation"                                                         
##  [5] NA                                                                  
##  [6] "situation, person"                                                 
##  [7] "person, situation"                                                 
##  [8] "scared,person"                                                     
##  [9] "scared,situation"                                                  
## [10] "situation, scared"                                                 
## [11] "person, scared"                                                    
## [12] "scared, person"                                                    
## [13] "situation, situation"                                              
## [14] "person, situation, situation, situation"                           
## [15] "person, situation, person"                                         
## [16] "person, person, person, situation, person"                         
## [17] "situation, person, situation"                                      
## [18] "situation,situation"                                               
## [19] "person,situation"                                                  
## [20] "person,person,situation,situation"                                 
## [21] "person,situation,situation"                                        
## [22] "person,person,situation,person,situation"                          
## [23] "person,person,situation"                                           
## [24] "situation,person"                                                  
## [25] "person,person"                                                     
## [26] "situation,situation,person"                                        
## [27] "person,situation,situation,situation,situation,situation,situation"
## [28] "situation,situation,situation,situation,situation"                 
## [29] "situation,person,situation"                                        
## [30] "situation,situation,situation"
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) %>%
  mutate(age_sc = scale(age))

d_ca$trial_number = as.numeric(d_ca$trial_number)

#PREREG (Poisson regression): situation_attrib_num ~ culture * age + (1 | subject) + (culture | trial)
m_ca <- glmer(n_situation ~ country * age_sc + (1 | subject_id) + (country | trial_number),
              data = d_ca,
              family = "poisson") #singular fit
## boundary (singular) fit: see help('isSingular')
m_ca2 <- glmer(n_situation ~ country * age_sc + (1 | subject_id) + (1 | trial_number),
              data = d_ca,
              family = "poisson") #singular fit
## boundary (singular) fit: see help('isSingular')
m_ca3 <- glmer(n_situation ~ country * age_sc + (1 | subject_id),
              data = d_ca,
              family = "poisson") #intercept, trending effect of country

p1 <- d_ca %>% ggplot(aes(x = age, y = jitter(person_focus), group = country, color = country)) +
  geom_point(alpha=.5) + geom_smooth() + theme_classic()

p2 <- d_ca %>% ggplot(aes(x = age, y = jitter(person_scared), group = country, color = country)) +
  geom_point(alpha=.5) + geom_smooth() + theme_classic()

ggarrange(p1, p2, common.legend = T)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 17 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 17 rows containing missing values (`geom_point()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 17 rows containing non-finite values (`stat_smooth()`).
## Removed 17 rows containing missing values (`geom_point()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 17 rows containing non-finite values (`stat_smooth()`).
## Removed 17 rows containing missing values (`geom_point()`).

Uniqueness Preference

d_up <- d %>% filter(task_type=="UP") 

d_up[which(d_up$resp=="non_unique"),]$resp = "non-unique"
d_up[which(d_up$resp=="n/a"),]$resp = NA
d_up[which(d_up$resp=="NA"),]$resp = NA

#check resp cleaning
unique(d_up$resp)
## [1] "unique"     "non-unique" NA
d_up <- d_up %>% 
  mutate(unique = ifelse(resp=="unique", 1, 
                             ifelse(resp=="non-unique", 0, NA))) %>% 
  mutate(age_sc = scale(age))

#PREREG (logistic regression): choice ~ culture * age
m_up <- glm(unique ~ country * age_sc,
            data = d_up,
            family = "binomial") #sig effects of country and country*age (but in opposite direction, seems likely to be pragmatic helpfulness on the part of CN ppts--interesting result, but not the task we'd intended to run!)

d_up %>% filter(!is.na(unique)) %>%
  group_by(subject_id, country, age) %>%
  ggplot(aes(x=age, y=jitter(unique,.2), group=country, color=country)) + 
  geom_point(alpha=.5) + geom_smooth() + theme_classic()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'