Load data

## [1] "US"                            "CN"                           
## [3] "demog"                         "M&N FD generated CN"          
## [5] "M&N FD generated CN redundant" "M&N FD generated"             
## [7] "M&N FD generated redundant"
## Joining, by = "subject_id"
## [1] 122
## [1] 121
## [1] 242
## [1] 242
## Joining, by = "subject_id"

Loaded demographic data from 277 participants. Loaded coded data from 242 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         17
## 11     8 CN         11
## 12     8 US         15
## 13     9 CN         10
## 14     9 US         12
## 15    10 CN          9
## 16    10 US         23
## 17    11 CN         18
## 18    11 US          5
## 19    12 CN         14
## 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)

exclusions

subjectExcludes <- read_csv("data/01_processed_data/exclusion_table_linked.csv") %>%
  filter(!is.na(id))
## New names:
## Rows: 95 Columns: 4
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (4): subject, ex_reason, id, ...4
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...4`
#make sideBias list for RMTS exclusions
sideBias <- subjectExcludes %>% filter(ex_reason=="side_bias")

#how many language exclusions from CN sample?
langCN <- subjectExcludes %>% filter(ex_reason=="language" & startsWith(id, "M"))

#how many ppts in CN sample?
totalCN <- d %>% filter(country=="CN")
CNppts = unique(totalCN$subject_id)

#if more than 20% of total CN sample would be excluded for language, drop CN lang exclusions (otherwise retain)
if(nrow(langCN) / length(CNppts) > .2) {
  idx = with(subjectExcludes, which(ex_reason=="language" & startsWith(id, "M")))
  subjectExcludes = subjectExcludes[-idx,]
}

#remove the side bias exclusion rows so subjectExcludes contains only ppts who should be FULLY excluded for demog reasons
subjectExcludes <- subjectExcludes %>% filter(ex_reason!="side_bias")

length(unique(d$subject_id)) #221
## [1] 242
d <- d %>% filter(!is.element(subject_id, subjectExcludes$id))

length(unique(d$subject_id)) #205
## [1] 225
#make language category that distinguishes between CN ppts who are/are not bilingual in English
d <- d %>% mutate(language=ifelse(is.element(subject_id, langCN$id), "CN_ENG", country))

d %>% group_by(subject_id, language) %>%
  summarise(n=n()) %>%
  group_by(language) %>%
  summarise(n=n())
## `summarise()` has grouped output by 'subject_id'. You can override using the
## `.groups` argument.
## # A tibble: 3 × 2
##   language     n
##   <chr>    <int>
## 1 CN          74
## 2 CN_ENG      43
## 3 US         108

RMTS

#results summary: 
### all 4 trials: no effect of country, both near chance in youngest children, then move to ~75% performance between 60 and 100m, then track back to chance for the oldest kids, matching adult performance
### first trial: performance looks a little different by country, still no effect in main regression but fit is polynomial for US and not for CN. Eng bilinguals in CN are qualitatively very similar to US and unlike CN monolinguals

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") #singular
## boundary (singular) fit: see help('isSingular')
m_rmts2 <- glmer(object_score ~ country * age_sc + (1 | subject_id), 
                data = d_rmts,
                family = "binomial") #only intercept
summary(m_rmts2)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: object_score ~ country * age_sc + (1 | subject_id)
##    Data: d_rmts
## 
##      AIC      BIC   logLik deviance df.resid 
##      848      872     -419      838      891 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.6315 -0.1853 -0.1641  0.2621  1.8114 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev.
##  subject_id (Intercept) 16.21    4.027   
## Number of obs: 896, groups:  subject_id, 225
## 
## Fixed effects:
##                  Estimate Std. Error z value Pr(>|z|)   
## (Intercept)       -1.3365     0.4955  -2.697  0.00699 **
## countryUS         -0.4340     0.6825  -0.636  0.52479   
## age_sc             0.5806     0.4168   1.393  0.16360   
## countryUS:age_sc  -0.2190     0.6760  -0.324  0.74597   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cntrUS age_sc
## countryUS   -0.606              
## age_sc       0.017 -0.060       
## cntryUS:g_s -0.018  0.097 -0.613
#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

summary(m_rmts_first)
## 
## Call:
## glm(formula = object_score ~ country * age_sc, family = "binomial", 
##     data = d_rmts %>% filter(trial_number == 1))
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.0799  -0.9159  -0.8570   1.3955   1.6884  
## 
## Coefficients:
##                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -0.69701    0.19674  -3.543 0.000396 ***
## countryUS         0.03907    0.28373   0.138 0.890490    
## age_sc            0.11769    0.18081   0.651 0.515118    
## countryUS:age_sc  0.14923    0.29414   0.507 0.611903    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 287.8  on 224  degrees of freedom
## Residual deviance: 286.0  on 221  degrees of freedom
## AIC: 294
## 
## Number of Fisher Scoring iterations: 4
#post hoc exploratory, theoretically motivated
#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
summary(m_rmts_first_curve)
## 
## Call:
## glm(formula = object_score ~ country * poly(age_sc, 2), family = "binomial", 
##     data = d_rmts %>% filter(trial_number == 1))
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5009  -0.8728  -0.7558   1.3147   1.6845  
## 
## Coefficients:
##                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                 -0.7771     0.2071  -3.752 0.000175 ***
## countryUS                    0.2100     0.2963   0.709 0.478435    
## poly(age_sc, 2)1             1.6516     2.6280   0.628 0.529692    
## poly(age_sc, 2)2             4.8059     2.8024   1.715 0.086358 .  
## countryUS:poly(age_sc, 2)1   2.2983     4.2906   0.536 0.592200    
## countryUS:poly(age_sc, 2)2   2.9625     4.4486   0.666 0.505459    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 287.80  on 224  degrees of freedom
## Residual deviance: 277.87  on 219  degrees of freedom
## AIC: 289.87
## 
## Number of Fisher Scoring iterations: 4
#is there a curvilinear relationship bw age and performance in US? YES
m_rmts_first_curve <- glm(object_score ~ poly(age_sc, 2),
                      data = d_rmts %>% filter(trial_number == 1) %>% filter(country == "US"),
                      family = "binomial") #poly(age_sc, 2)2
summary(m_rmts_first_curve)
## 
## Call:
## glm(formula = object_score ~ poly(age_sc, 2), family = "binomial", 
##     data = d_rmts %>% filter(trial_number == 1) %>% filter(country == 
##         "US"))
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5009  -0.8369  -0.7532   1.2736   1.6845  
## 
## Coefficients:
##                  Estimate Std. Error z value Pr(>|z|)   
## (Intercept)       -0.6803     0.2101  -3.238   0.0012 **
## poly(age_sc, 2)1   2.3793     2.0908   1.138   0.2551   
## poly(age_sc, 2)2   4.7734     2.1230   2.248   0.0245 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 138.83  on 107  degrees of freedom
## Residual deviance: 132.33  on 105  degrees of freedom
## AIC: 138.33
## 
## Number of Fisher Scoring iterations: 4
#is there a curvilinear relationship bw age and performance in CN? NO
m_rmts_first_curve <- glm(object_score ~ poly(age_sc, 2),
                      data = d_rmts %>% filter(trial_number == 1) %>% filter(country == "CN"),
                      family = "binomial") #only intercept
summary(m_rmts_first_curve)
## 
## Call:
## glm(formula = object_score ~ poly(age_sc, 2), family = "binomial", 
##     data = d_rmts %>% filter(trial_number == 1) %>% filter(country == 
##         "CN"))
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.2166  -0.9080  -0.7663   1.3566   1.6748  
## 
## Coefficients:
##                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)       -0.7128     0.2001  -3.562 0.000368 ***
## poly(age_sc, 2)1   1.3153     2.0683   0.636 0.524829    
## poly(age_sc, 2)2   3.6608     2.1347   1.715 0.086358 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 148.94  on 116  degrees of freedom
## Residual deviance: 145.55  on 114  degrees of freedom
## AIC: 151.55
## 
## Number of Fisher Scoring iterations: 4
# main plot
d_rmts %>% filter(!is.na(object_score)) %>%
  group_by(subject_id, country, age) %>%
  summarise(mean = mean(object_score)) %>%
  mutate(Country = country,
         prop_relation = 1-mean) %>% #flips y axis
  ggplot(aes(x=jitter(age,.1), y=prop_relation, group=Country, color=Country)) + 
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  xlab("Age in months") + ylab("Proportion choosing relational match") 
## `summarise()` has grouped output by 'subject_id', 'country'. You can override
## using the `.groups` argument.
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

ggsave("RMTS_all_trials.pdf", width=6, height=3)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
# main plot, CN bilinguals split out 
d_rmts %>% filter(!is.na(object_score)) %>%
  group_by(subject_id, language, age) %>%
  summarise(mean = mean(object_score)) %>% 
  mutate(prop_relation = 1-mean) %>% #flips y axis
  ggplot(aes(x=jitter(age,.1), y=prop_relation, group=language, color=language)) + 
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  xlab("Age in months") + ylab("Proportion choosing relational match") 
## `summarise()` has grouped output by 'subject_id', 'language'. You can override
## using the `.groups` argument.
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

#first trial
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((1-object_score),.1), group=country, color=country)) + #flips y axis
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  xlab("Age in months") + ylab("Relational matching on first trial") 
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

#first trial, CN bilinguals split out 
d_rmts1 %>% filter(!is.na(object_score)) %>%
  group_by(subject_id, language, age) %>%
  ggplot(aes(x=age, y=jitter((1-object_score),.1), group=language, color=language)) + #flips y axis
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  xlab("Age in months") + ylab("Relational matching on first trial") 
## `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, first mention

#results summary: effect of country, US more focal, but both groups are quite biased toward focal. In language split plot, mono CN participants start veering toward the adult pattern at about 120 months

#clean up main FD data
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") #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") #effect of country, US more focal mentions
summary(m_fd2)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: focal_score ~ country * age_sc + (1 | subject_id) + (1 | trial_number)
##    Data: d_fd
## 
##      AIC      BIC   logLik deviance df.resid 
##   1243.9   1275.9   -616.0   1231.9     1508 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5718  0.1955  0.2621  0.3914  1.5745 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  subject_id   (Intercept) 2.0209   1.4216  
##  trial_number (Intercept) 0.1378   0.3712  
## Number of obs: 1514, groups:  subject_id, 224; trial_number, 14
## 
## Fixed effects:
##                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)       2.05246    0.23281   8.816   <2e-16 ***
## countryUS         0.55064    0.26767   2.057   0.0397 *  
## age_sc           -0.24992    0.16634  -1.502   0.1330    
## countryUS:age_sc  0.02112    0.28004   0.075   0.9399    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cntrUS age_sc
## countryUS   -0.457              
## age_sc      -0.077  0.062       
## cntryUS:g_s  0.029 -0.080 -0.592
# main plot:
d_fd %>% filter(!is.na(focal_score)) %>%
  group_by(subject_id, country, age) %>%
  summarise(mean_focal = mean(focal_score)) %>%
  mutate(Country = country) %>%
  ggplot(aes(x=age, y=mean_focal, group=Country, color=Country)) + 
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  ylim(0,1) + xlab("Age in months") + ylab("Proportion first mention focal")
## `summarise()` has grouped output by 'subject_id', 'country'. You can override
## using the `.groups` argument.
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing missing values (`geom_smooth()`).

ggsave("FD_firstMention.pdf", width=6, height=3)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing missing values (`geom_smooth()`).
# split out Eng bilinguals from CN
d_fd %>% filter(!is.na(focal_score)) %>%
  group_by(subject_id, language, age) %>%
  summarise(mean_focal = mean(focal_score)) %>%
  ggplot(aes(x=age, y=mean_focal, group=language, color=language)) + 
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  ylim(0,1) + xlab("Age in months") + ylab("Proportion first mention focal")
## `summarise()` has grouped output by 'subject_id', 'language'. You can override
## using the `.groups` argument.
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 7 rows containing missing values (`geom_smooth()`).

Free Description, full description

#results summary: 

#clean up M&N FD data
fd[which(is.element(fd$focal_count, c("NA","na","n/a"))),] = NA
fd[which(is.element(fd$objects_count, c("NA","na","n/a"))),] = NA
fd[which(is.element(fd$background_count, c("NA","na","n/a"))),] = NA

#check resp cleaning
unique(fd$focal_count)
##  [1] "1" "3" "0" "2" "6" "5" "4" "9" "8" NA
unique(fd$objects_count)
## [1] "0" "1" "2" "3" "5" "6" NA  "4"
unique(fd$background_count)
##  [1] "0"  "1"  "2"  "4"  "3"  "5"  "6"  "7"  "8"  "10" "9"  "12" "14" "11" NA  
## [16] "17" "15" "13"
fd <- fd %>% 
  mutate(focal_count = as.numeric(focal_count),
         objects_count = as.numeric(objects_count),
         background_count = as.numeric(background_count),
         non_focal = objects_count + background_count,
         age_sc = scale(age)) %>% 
  filter(response_type!="first_mention") #remove first mention coding since we looked at that above


#PREREG: (b, Poisson regression) description_num ~ description_type * culture * age + (description_type | subject) + (culture | scene)
#description_num = per-trial count of descriptions referring to the focal object vs. anything else

fd_sum <- fd %>%
  filter(!is.element(response_type,c("location", "relation_to_moveable", "relation_to_inert", "time"))) %>%
  group_by(subject_id, trial_number, country, age_sc, age) %>%
  summarise(focal = sum(focal_count),
            non_focal = sum(non_focal)) %>%
  pivot_longer(cols = c("focal","non_focal"), names_to = "desc_type", values_to = "desc_num")
## `summarise()` has grouped output by 'subject_id', 'trial_number', 'country',
## 'age_sc'. You can override using the `.groups` argument.
m_fdb <- glmer(desc_num ~ desc_type * country * age_sc + (desc_type | subject_id) + (country | trial_number),
              data = fd_sum,
              family = "poisson") #fix convergence issues
## boundary (singular) fit: see help('isSingular')
summary(m_fdb)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: poisson  ( log )
## Formula: desc_num ~ desc_type * country * age_sc + (desc_type | subject_id) +  
##     (country | trial_number)
##    Data: fd_sum
## 
##      AIC      BIC   logLik deviance df.resid 
##  10420.5  10503.3  -5196.3  10392.5     2712 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.4210 -0.5775 -0.1581  0.3868  5.7463 
## 
## Random effects:
##  Groups       Name               Variance Std.Dev. Corr 
##  subject_id   (Intercept)        0.142566 0.37758       
##               desc_typenon_focal 0.270399 0.52000  -0.11
##  trial_number (Intercept)        0.002379 0.04877       
##               countryUS          0.001868 0.04323  1.00 
## Number of obs: 2726, groups:  subject_id, 197; trial_number, 13
## 
## Fixed effects:
##                                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                          0.63247    0.04869  12.989  < 2e-16 ***
## desc_typenon_focal                   0.62858    0.06112  10.285  < 2e-16 ***
## countryUS                            0.04072    0.06979   0.583  0.55961    
## age_sc                               0.31126    0.04965   6.269 3.63e-10 ***
## desc_typenon_focal:countryUS        -0.24340    0.09209  -2.643  0.00822 ** 
## desc_typenon_focal:age_sc            0.14600    0.06738   2.167  0.03027 *  
## countryUS:age_sc                     0.15224    0.06813   2.234  0.02546 *  
## desc_typenon_focal:countryUS:age_sc -0.01351    0.09277  -0.146  0.88425    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) dsc_t_ cntrUS age_sc ds__:US ds__:_ cnUS:_
## dsc_typnn_f -0.329                                           
## countryUS   -0.533  0.221                                    
## age_sc      -0.201  0.113  0.138                             
## dsc_typ_:US  0.210 -0.648 -0.325 -0.072                      
## dsc_typn_:_  0.105 -0.231 -0.071 -0.343  0.142               
## cntryUS:g_s  0.150 -0.081 -0.114 -0.727  0.088   0.248       
## dsc_t_:US:_ -0.076  0.161  0.086  0.247 -0.123  -0.720 -0.333
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# main plot:
fd_sum %>% filter(!is.na(desc_num)) %>%
  mutate(Country = country) %>%
  ggplot(aes(x=age, y=desc_num, group=desc_type, color=desc_type)) + 
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  facet_wrap(. ~ Country) +
  xlab("Age in months") + ylab("Number of descriptions")
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

# split out Eng bilinguals from CN?

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) #22jan24 cleaning needed
##  [1] "scared, situation"                                                 
##  [2] "person"                                                            
##  [3] "scared"                                                            
##  [4] "situation"                                                         
##  [5] NA                                                                  
##  [6] "person, person"                                                    
##  [7] "situation, person"                                                 
##  [8] "person, situation"                                                 
##  [9] "scared, personal"                                                  
## [10] "situation, person, person, person"                                 
## [11] "situation, situation"                                              
## [12] "person, situation, situation, situation"                           
## [13] "person, situation, person"                                         
## [14] "situation, scared"                                                 
## [15] "person, person, situation, person"                                 
## [16] "situation, person, situation"                                      
## [17] "situation,situation"                                               
## [18] "person/situation/scared (comma separated for multiple)"            
## [19] "person,person,situation"                                           
## [20] "situation,person"                                                  
## [21] "person,situation"                                                  
## [22] "person,person"                                                     
## [23] "situation,situation,person"                                        
## [24] "person,situation,situation,situation,situation,situation,situation"
## [25] "person,situation,situation"                                        
## [26] "situation,situation,situation,situation,situation"                 
## [27] "scared,situation"                                                  
## [28] "situation,person,situation"                                        
## [29] "situation,situation,situation"                                     
## [30] "person, person, person, situation, situation, person"              
## [31] "situation, person, situation, situation"                           
## [32] "person, person, person, person, person"                            
## [33] "situation, situation, situation"                                   
## [34] "person, person situation, situation, situation, person"            
## [35] "person, person, person, person"                                    
## [36] "situation, person, person"                                         
## [37] "person, person, person"                                            
## [38] "situation, situation, situation, situation, situation, situation"  
## [39] "situation, situation, situation, situation"                        
## [40] "person, person, 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,
         person_prop = n_person/(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") #effect of country and age
summary(m_ca3)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: poisson  ( log )
## Formula: n_situation ~ country * age_sc + (1 | subject_id)
##    Data: d_ca
## 
##      AIC      BIC   logLik deviance df.resid 
##    903.8    924.2   -446.9    893.8      432 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.0251 -0.6756  0.1223  0.4664  3.3358 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev.
##  subject_id (Intercept) 0.1933   0.4397  
## Number of obs: 437, groups:  subject_id, 221
## 
## Fixed effects:
##                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -0.33066    0.09579  -3.452 0.000557 ***
## countryUS        -0.31667    0.13369  -2.369 0.017854 *  
## age_sc            0.17698    0.08097   2.186 0.028825 *  
## countryUS:age_sc -0.09847    0.13864  -0.710 0.477568    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cntrUS age_sc
## countryUS   -0.607              
## age_sc      -0.182  0.130       
## cntryUS:g_s  0.113 -0.110 -0.584
#not in the prereg but seems like a useful complement (adult literature suggests similar person bias in US/CN but worth checking anyway)
m_ca_person <- glmer(n_person ~ country * age_sc + (1 | subject_id) + (country | trial_number),
              data = d_ca,
              family = "poisson") #singular fit
## boundary (singular) fit: see help('isSingular')
m_ca_person2 <- glmer(n_person ~ country * age_sc + (1 | subject_id) + (1 | trial_number),
              data = d_ca,
              family = "poisson") #singular fit
## boundary (singular) fit: see help('isSingular')
m_ca_person3 <- glmer(n_person ~ country * age_sc + (1 | subject_id),
              data = d_ca,
              family = "poisson") 
summary(m_ca_person3) #just intercept and age (more person atts with age)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: poisson  ( log )
## Formula: n_person ~ country * age_sc + (1 | subject_id)
##    Data: d_ca
## 
##      AIC      BIC   logLik deviance df.resid 
##    808.2    828.6   -399.1    798.2      432 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -0.8622 -0.5827 -0.4808  0.4985  2.1479 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev.
##  subject_id (Intercept) 0.4739   0.6884  
## Number of obs: 437, groups:  subject_id, 221
## 
## Fixed effects:
##                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -0.91833    0.13519  -6.793  1.1e-11 ***
## countryUS         0.10308    0.16807   0.613   0.5397    
## age_sc            0.22541    0.11260   2.002   0.0453 *  
## countryUS:age_sc -0.09682    0.17668  -0.548   0.5837    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cntrUS age_sc
## countryUS   -0.658              
## age_sc      -0.158  0.147       
## cntryUS:g_s  0.098 -0.131 -0.638
#main plot:
p1 <- d_ca %>% mutate(Country = country) %>%
  ggplot(aes(x = age, y = jitter(person_prop), group = Country, color = Country)) +
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  xlab("Age in months") + ylab("Proportion person attributions") + 
  theme(legend.position = "right")
  #theme(legend.position = c(0.8, 0.2)) # more control (x,y = [0,1])
ggsave("CausalAtt.pdf", width=6, height=3)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 13 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 13 rows containing missing values (`geom_point()`).
#check how scared coding is working (person_scared = n_person + n_scared - n_situation)
p2 <- d_ca %>% mutate(Country = country) %>%
  ggplot(aes(x = age, y = jitter(person_scared), group = Country, color = Country)) +
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  xlab("Age (months)") + ylab("Person scared")

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

#plot 2: instead plot n_person and n_situation
p1 <- d_ca %>% ggplot(aes(x = age, y = jitter(n_person), group = country, color = country)) +
  geom_point(alpha=.5) + geom_smooth() + theme_classic() +
  xlab("Age (months)") + ylab("N Person")

p2 <- d_ca %>% ggplot(aes(x = age, y = jitter(n_situation), group = country, color = country)) +
  geom_point(alpha=.5) + geom_smooth() + theme_classic() + 
  xlab("Age (months)") + ylab("N situation")

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

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

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

ggarrange(pl1, pl2, common.legend = T)

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 (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!)
summary(m_up)
## 
## Call:
## glm(formula = unique ~ country * age_sc, family = "binomial", 
##     data = d_up)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.8538  -1.2759   0.7292   0.8779   1.1997  
## 
## Coefficients:
##                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)       1.16270    0.22000   5.285 1.26e-07 ***
## countryUS        -0.71856    0.29730  -2.417   0.0156 *  
## age_sc           -0.20426    0.20411  -1.001   0.3170    
## countryUS:age_sc -0.09727    0.30605  -0.318   0.7506    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 277.50  on 222  degrees of freedom
## Residual deviance: 268.77  on 219  degrees of freedom
##   (2 observations deleted due to missingness)
## AIC: 276.77
## 
## Number of Fisher Scoring iterations: 4
#main plot:
d_up %>% filter(!is.na(unique)) %>%
  mutate(Country = country) %>%
  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() +
  ylim(0,1) + xlab("Age in months") + ylab("Preference for unique option") +
  scale_y_continuous(limits = c(0,1.2), breaks= seq(0,1.2,.25))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 35 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 38 rows containing missing values (`geom_point()`).

ggsave("Uniqueness.pdf", width=6, height=3)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 24 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 36 rows containing missing values (`geom_point()`).
d_up %>% filter(!is.na(unique)) %>%
  group_by(subject_id, language, age) %>%
  ggplot(aes(x=age, y=jitter(unique,.2), group=language, color=language)) + 
  geom_point(alpha=.5) + geom_smooth() + theme_classic()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

## Relationships between tasks From PREREG: 2. How do cross-cultural differences relate across these tasks? In particular, do the social tasks (2-3) pattern together, showing more similar responses within than across domains? 3. More specifically, do cross-cultural differences in visual attention (1) or reasoning about social relations (2-3) correlate with or mediate [country/age effect on] performance in relational reasoning (4)?

#TLDR: nothing
#merge cleaned datasets back together
d_all <- d_up %>% select(subject_id, country, age_sc, age, years, unique) %>%
  left_join(d_rmts %>% arrange(subject_id, trial_number) %>%
              group_by(subject_id) %>% 
              summarise(object_score = mean(object_score))) %>% # object_score1 = slice_head(object_score, n=1), 
  left_join(d_fd %>% group_by(subject_id) %>% 
              summarise(focal_score = mean(focal_score))) %>% 
  left_join(d_ca %>% group_by(subject_id) %>% 
              summarise(person_prop = mean(person_prop))) %>%
  left_join(d_rmts %>% filter(trial_number==1) %>% 
              rename(object_first = object_score) %>% select(subject_id, object_first))
## Joining, by = "subject_id"
## Joining, by = "subject_id"
## Joining, by = "subject_id"
## Joining, by = "subject_id"
#do social tasks (UP & CA) pattern together? nah
cor.test(d_all$unique, d_all$person_prop, na.rm=T) #no correlation
## 
##  Pearson's product-moment correlation
## 
## data:  d_all$unique and d_all$person_prop
## t = -1.3717, df = 213, p-value = 0.1716
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2245660  0.0407397
## sample estimates:
##         cor 
## -0.09357406
social <- lm(person_prop ~ country * age_sc * unique,
            data = d_all)
summary(social) #country effect only; no effect of UP in predicting CA
## 
## Call:
## lm(formula = person_prop ~ country * age_sc * unique, data = d_all)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.56268 -0.39473 -0.06316  0.44120  0.71883 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)   
## (Intercept)              0.29834    0.09284   3.213  0.00152 **
## countryUS                0.26080    0.11495   2.269  0.02430 * 
## age_sc                   0.06927    0.07648   0.906  0.36608   
## unique                   0.06746    0.10408   0.648  0.51764   
## countryUS:age_sc        -0.06659    0.10763  -0.619  0.53680   
## countryUS:unique        -0.21267    0.13584  -1.566  0.11896   
## age_sc:unique           -0.10134    0.08975  -1.129  0.26018   
## countryUS:age_sc:unique  0.11064    0.13274   0.834  0.40551   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4337 on 207 degrees of freedom
##   (10 observations deleted due to missingness)
## Multiple R-squared:  0.03761,    Adjusted R-squared:  0.005065 
## F-statistic: 1.156 on 7 and 207 DF,  p-value: 0.3299
social2 <- glm(unique ~ country * age_sc * person_prop,
            data = d_all,
            family = "binomial")
summary(social2) #trending interactions: country*person_prop(CA), age*person_prop(CA)
## 
## Call:
## glm(formula = unique ~ country * age_sc * person_prop, family = "binomial", 
##     data = d_all)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2524  -1.2165   0.7147   0.8679   1.3980  
## 
## Coefficients:
##                              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                    1.1487     0.3038   3.781 0.000156 ***
## countryUS                     -0.3839     0.4305  -0.892 0.372593    
## age_sc                        -0.1049     0.2780  -0.377 0.705929    
## person_prop                    0.6871     0.6937   0.990 0.321943    
## countryUS:age_sc              -0.1525     0.4169  -0.366 0.714608    
## countryUS:person_prop         -1.4112     0.8294  -1.701 0.088871 .  
## age_sc:person_prop            -1.1735     0.7076  -1.659 0.097215 .  
## countryUS:age_sc:person_prop   1.0342     0.8841   1.170 0.242104    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266.77  on 214  degrees of freedom
## Residual deviance: 248.21  on 207  degrees of freedom
##   (10 observations deleted due to missingness)
## AIC: 264.21
## 
## Number of Fisher Scoring iterations: 5
d_all %>% ggplot(aes(x=age, y=person_prop, group=as.factor(country), color=as.factor(country))) + 
  facet_wrap(. ~ unique) +
  geom_point() #nothing clear
## Warning: Removed 9 rows containing missing values (`geom_point()`).

# how does RR relate to other tasks? not

#corrs
cor.test(d_all$object_score, d_all$unique, na.rm=T) #no correlation
## 
##  Pearson's product-moment correlation
## 
## data:  d_all$object_score and d_all$unique
## t = -0.96725, df = 218, p-value = 0.3345
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.19594775  0.06748432
## sample estimates:
##         cor 
## -0.06537062
cor.test(d_all$object_score, d_all$person_prop, na.rm=T) #no correlation
## 
##  Pearson's product-moment correlation
## 
## data:  d_all$object_score and d_all$person_prop
## t = -0.17865, df = 211, p-value = 0.8584
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1464873  0.1223361
## sample estimates:
##         cor 
## -0.01229777
cor.test(d_all$object_score, d_all$focal_score, na.rm=T) #trending correlation
## 
##  Pearson's product-moment correlation
## 
## data:  d_all$object_score and d_all$focal_score
## t = -0.56144, df = 185, p-value = 0.5752
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1836489  0.1028595
## sample estimates:
##         cor 
## -0.04124249
RR_pens <- lm(object_score ~ country * age_sc * unique, 
            data = d_all)
summary(RR_pens) #trending 3-way countryUS:age_sc:unique
## 
## Call:
## lm(formula = object_score ~ country * age_sc * unique, data = d_all)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.5747 -0.3626 -0.1132  0.4237  0.7162 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)    
## (Intercept)              0.46742    0.08251   5.665 4.75e-08 ***
## countryUS               -0.05766    0.10624  -0.543   0.5879    
## age_sc                  -0.02016    0.06351  -0.317   0.7512    
## unique                  -0.06601    0.09413  -0.701   0.4839    
## countryUS:age_sc         0.13262    0.09752   1.360   0.1753    
## countryUS:unique         0.01263    0.12695   0.100   0.9208    
## age_sc:unique            0.09626    0.07761   1.240   0.2162    
## countryUS:age_sc:unique -0.22288    0.12273  -1.816   0.0708 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4225 on 212 degrees of freedom
##   (5 observations deleted due to missingness)
## Multiple R-squared:  0.03106,    Adjusted R-squared:  -0.0009347 
## F-statistic: 0.9708 on 7 and 212 DF,  p-value: 0.4535
RR_attrib <- lm(object_score ~ country * age_sc * person_prop, 
            data = d_all)
summary(RR_attrib) #intercept only
## 
## Call:
## lm(formula = object_score ~ country * age_sc * person_prop, data = d_all)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.5208 -0.4190 -0.1236  0.4825  0.7288 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                   0.37241    0.05504   6.767 1.35e-10 ***
## countryUS                     0.06070    0.08176   0.742    0.459    
## age_sc                        0.07120    0.04957   1.436    0.152    
## person_prop                   0.08811    0.10069   0.875    0.383    
## countryUS:age_sc             -0.07090    0.07840  -0.904    0.367    
## countryUS:person_prop        -0.18073    0.13738  -1.316    0.190    
## age_sc:person_prop           -0.02953    0.10238  -0.288    0.773    
## countryUS:age_sc:person_prop  0.15219    0.14832   1.026    0.306    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4269 on 205 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.03109,    Adjusted R-squared:  -0.001991 
## F-statistic: 0.9398 on 7 and 205 DF,  p-value: 0.4768
RR_fish <- lm(object_score ~ country * age_sc * focal_score, 
            data = d_all)
summary(RR_fish) #nada
## 
## Call:
## lm(formula = object_score ~ country * age_sc * focal_score, data = d_all)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.6703 -0.3764 -0.1254  0.4344  0.7389 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)                   0.31257    0.18796   1.663   0.0981 .
## countryUS                     0.17192    0.27298   0.630   0.5296  
## age_sc                        0.15257    0.17626   0.866   0.3879  
## focal_score                   0.08798    0.21916   0.401   0.6886  
## countryUS:age_sc              0.25772    0.28531   0.903   0.3676  
## countryUS:focal_score        -0.19954    0.31397  -0.636   0.5259  
## age_sc:focal_score           -0.05441    0.20781  -0.262   0.7938  
## countryUS:age_sc:focal_score -0.36573    0.32671  -1.119   0.2645  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4329 on 179 degrees of freedom
##   (38 observations deleted due to missingness)
## Multiple R-squared:  0.05212,    Adjusted R-squared:  0.01506 
## F-statistic: 1.406 on 7 and 179 DF,  p-value: 0.2053
#pens plot
d_all %>% ggplot(aes(x=age, y=object_score, group=as.factor(country), color=as.factor(country))) + 
  facet_wrap(. ~ unique) +
  geom_point() #nothing clear
## Warning: Removed 3 rows containing missing values (`geom_point()`).

#mediation: no country/age effects on RMTS, so no relationship to be mediated