pkbb_ABBA_analysis

rm(list = ls())

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
source("process_pairs.R")
source("process_ABBA.R")

load data

exp2_adult <- read_csv("data/adults/adult_stimuli_type.csv")
Rows: 44775 Columns: 12
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (8): prolific_id, trial_type, block_type, background_stimulus, deviant_s...
dbl (4): total_rt, block_number, trial_number, total_trial_number

ℹ 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.
# log LT
exp2_adult$total_rt_log <- log(exp2_adult$total_rt)

# create bg_image, dv_image (contain all four info: pose, identity id, number, animacy)
exp2_adult <- exp2_adult %>%
  mutate(
    bg_image = paste(background_type, str_extract(background_stimulus, "\\d+"), sep = "_"),
    dv_image = paste(deviant_type, str_extract(deviant_stimulus, "\\d+"), sep = "_")
  ) %>%
  mutate(dv_image = ifelse(violation_type == "background", bg_image, dv_image))
# calculate dishab
exp2_test_only <- exp2_adult %>% filter(trial_number == total_trial_number) %>% mutate(my_trial_type = "test")
exp2_lastfam_only <- exp2_adult %>% filter(trial_number == total_trial_number - 1) %>% mutate(my_trial_type = "lastfam")

exp2_core <- pivot_wider(bind_rows(exp2_test_only, exp2_lastfam_only),
                         id_cols = c(prolific_id, block_number, violation_type, total_trial_number, bg_image, dv_image),
                         names_from = my_trial_type,
                         values_from = total_rt_log) %>%
  mutate(dishab = test - lastfam)

unique pairs

## unique combinations of stimuli pairs in test trials
exp2_unique_stimuli_pairs <- exp2_test_only %>%
  group_by(bg_image, dv_image, violation_type) %>%
  summarise(count = n(), .groups = "drop") %>%
  mutate(pairID = row_number())
### number of unique combinations of deviant trials used in study:
nrow(filter(exp2_unique_stimuli_pairs, violation_type != "background")) # 2674 (in theory there are 128*2+128*2+128*15+128*2=2688 unique pairs)
[1] 2674
### number of background trials used in study
nrow(filter(exp2_unique_stimuli_pairs, violation_type == "background")) # 128  (in theory 128)
[1] 128

pose

exp2_pairs_pose <- process_pairs(filter(exp2_unique_stimuli_pairs, violation_type == "pose")) # withinpairID: 1: left to right, 2: right to left

number

exp2_pairs_number <- process_pairs(filter(exp2_unique_stimuli_pairs, violation_type == "number")) # withinpairID: 1: pair to single, 2: single to pair

identity

## no ignored types
exp2_pairs_identity <- process_pairs(filter(exp2_unique_stimuli_pairs, violation_type == "identity"))
check_single_within_PoP(exp2_pairs_identity) # 440
[1] 440
## combing across pose
exp2_pairs_identity_nopose <- process_pairs(filter(exp2_unique_stimuli_pairs, violation_type == "identity"), ignore_violation_types = c("pose"))
check_single_within_PoP(exp2_pairs_identity_nopose) # 116
[1] 116
## combing across pose and number
exp2_pairs_identity_nopose_nonumber <- process_pairs(filter(exp2_unique_stimuli_pairs, violation_type == "identity"), ignore_violation_types = c("pose", "number"))
check_single_within_PoP(exp2_pairs_identity_nopose_nonumber) # 6
[1] 6

animacy

## no ignored types
exp2_pairs_animacy <- process_pairs(filter(exp2_unique_stimuli_pairs, violation_type == "animacy"))
check_single_within_PoP(exp2_pairs_animacy) # 484
[1] 484
## combing across pose
exp2_pairs_animacy_nopose <- process_pairs(filter(exp2_unique_stimuli_pairs, violation_type == "animacy"), ignore_violation_types = c("pose"))
check_single_within_PoP(exp2_pairs_animacy_nopose) # 126
[1] 126
## combing across identity
exp2_pairs_animacy_noidentity <- process_pairs(filter(exp2_unique_stimuli_pairs, violation_type == "animacy"), ignore_violation_types = c("identity"))
check_single_within_PoP(exp2_pairs_animacy_noidentity) # 0, but there are only 4 pair_of_pair_IDs. 
[1] 0
## combining across pose and number
exp2_pairs_animacy_nopose_nonumber <- process_pairs(filter(exp2_unique_stimuli_pairs, violation_type == "animacy"), ignore_violation_types = c("pose", "number"))
check_single_within_PoP(exp2_pairs_animacy_nopose_nonumber) # 9
[1] 9

ABBA: pose

ABBA_pose <- exp2_core %>% filter(violation_type == "pose") %>%
  left_join(exp2_pairs_pose, by = c("violation_type", "bg_image", "dv_image"))
# data quality check
ABBA_pose[which(is.na(ABBA_pose$dishab)),]
# A tibble: 7 × 11
  prolific_id   block_number violation_type total_trial_number bg_image dv_image
  <chr>                <dbl> <chr>                       <dbl> <chr>    <chr>   
1 600959b17473…            3 pose                            2 inanima… inanima…
2 6025d40ede4e…            3 pose                            4 inanima… inanima…
3 63d9cfec2060…            7 pose                            6 inanima… inanima…
4 6526ba4ac53a…           16 pose                            2 animate… animate…
5 657767d604c0…            9 pose                            2 inanima… inanima…
6 657a7e142c5f…            5 pose                            6 inanima… inanima…
7 659aaea375ee…            7 pose                            2 inanima… inanima…
# ℹ 5 more variables: test <dbl>, lastfam <dbl>, dishab <dbl>,
#   pair_of_pair_ID <int>, within_PoP_ID <int>
# e.g.
exp2_adult %>% filter(prolific_id == "600959b17473895801425313", block_number == 3)
# A tibble: 1 × 15
  prolific_id    trial_type total_rt block_type block_number background_stimulus
  <chr>          <chr>         <dbl> <chr>             <dbl> <chr>              
1 600959b174738… deviant       13567 deviant_b…            3 media/padded_stims…
# ℹ 9 more variables: deviant_stimulus <chr>, background_type <chr>,
#   deviant_type <chr>, violation_type <chr>, trial_number <dbl>,
#   total_trial_number <dbl>, total_rt_log <dbl>, bg_image <chr>,
#   dv_image <chr>
exp2_adult %>% filter(prolific_id == "6025d40ede4e061f3c7ca877", block_number == 3)
# A tibble: 3 × 15
  prolific_id    trial_type total_rt block_type block_number background_stimulus
  <chr>          <chr>         <dbl> <chr>             <dbl> <chr>              
1 6025d40ede4e0… background    14334 deviant_b…            3 media/padded_stims…
2 6025d40ede4e0… background     1539 deviant_b…            3 media/padded_stims…
3 6025d40ede4e0… background     2364 deviant_b…            3 media/padded_stims…
# ℹ 9 more variables: deviant_stimulus <chr>, background_type <chr>,
#   deviant_type <chr>, violation_type <chr>, trial_number <dbl>,
#   total_trial_number <dbl>, total_rt_log <dbl>, bg_image <chr>,
#   dv_image <chr>
process_ABBA(ABBA_pose, exp2_pairs_pose)
Warning: Removed 7 rows containing non-finite outside the scale range
(`stat_boxplot()`).
Warning: Removed 7 rows containing missing values or values outside the scale range
(`geom_point()`).
Warning: Removed 7 rows containing non-finite outside the scale range
(`stat_boxplot()`).
Warning: Removed 7 rows containing missing values or values outside the scale range
(`geom_point()`).

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number + block_number + within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2436.5

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-4.8670 -0.4447  0.0321  0.5054  6.0991 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.006312 0.07945 
 Residual                0.207064 0.45504 
Number of obs: 1864, groups:  prolific_id, 468

Fixed effects:
                     Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)        -4.500e-01  4.658e-02  1.852e+03  -9.662   <2e-16 ***
total_trial_number  1.027e-01  6.485e-03  1.858e+03  15.840   <2e-16 ***
block_number       -2.783e-03  1.520e-03  1.431e+03  -1.830   0.0674 .  
within_PoP_ID       2.221e-04  2.133e-02  1.831e+03   0.010   0.9917    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n
ttl_trl_nmb -0.560              
block_numbr -0.402  0.000       
withn_PP_ID -0.685  0.009 -0.010

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number * block_number + within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2442.8

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-4.9197 -0.4422  0.0202  0.5038  6.0444 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.006358 0.07973 
 Residual                0.206471 0.45439 
Number of obs: 1864, groups:  prolific_id, 468

Fixed effects:
                                  Estimate Std. Error         df t value
(Intercept)                     -3.391e-01  6.538e-02  1.856e+03  -5.187
total_trial_number               7.483e-02  1.324e-02  1.859e+03   5.652
block_number                    -1.174e-02  4.010e-03  1.850e+03  -2.929
within_PoP_ID                    3.128e-04  2.131e-02  1.830e+03   0.015
total_trial_number:block_number  2.250e-03  9.318e-04  1.859e+03   2.414
                                Pr(>|t|)    
(Intercept)                     2.37e-07 ***
total_trial_number              1.83e-08 ***
block_number                     0.00345 ** 
within_PoP_ID                    0.98829    
total_trial_number:block_number  0.01586 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n w_PP_I
ttl_trl_nmb -0.808                     
block_numbr -0.759  0.807              
withn_PP_ID -0.486  0.003 -0.005       
ttl_trl_n:_  0.703 -0.872 -0.926  0.002

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number * block_number * within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2467.7

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-4.8860 -0.4348  0.0244  0.5039  6.0385 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.006432 0.0802  
 Residual                0.206463 0.4544  
Number of obs: 1864, groups:  prolific_id, 468

Fixed effects:
                                                Estimate Std. Error         df
(Intercept)                                   -1.916e-01  1.799e-01  1.852e+03
total_trial_number                             2.649e-02  4.158e-02  1.853e+03
block_number                                  -1.684e-02  1.271e-02  1.856e+03
within_PoP_ID                                 -9.889e-02  1.142e-01  1.853e+03
total_trial_number:block_number                4.431e-03  2.940e-03  1.856e+03
total_trial_number:within_PoP_ID               3.259e-02  2.646e-02  1.854e+03
block_number:within_PoP_ID                     3.453e-03  8.037e-03  1.856e+03
total_trial_number:block_number:within_PoP_ID -1.477e-03  1.864e-03  1.856e+03
                                              t value Pr(>|t|)
(Intercept)                                    -1.065    0.287
total_trial_number                              0.637    0.524
block_number                                   -1.325    0.185
within_PoP_ID                                  -0.866    0.387
total_trial_number:block_number                 1.507    0.132
total_trial_number:within_PoP_ID                1.232    0.218
block_number:within_PoP_ID                      0.430    0.667
total_trial_number:block_number:within_PoP_ID  -0.792    0.428

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n w_PP_I tt__:_ t__:_P b_:_PP
ttl_trl_nmb -0.923                                          
block_numbr -0.872  0.806                                   
withn_PP_ID -0.948  0.876  0.826                            
ttl_trl_n:_  0.805 -0.871 -0.925 -0.763                     
tt__:_PP_ID  0.874 -0.948 -0.762 -0.923  0.825              
blc_:_PP_ID  0.829 -0.767 -0.949 -0.873  0.878  0.806       
t__:_:_PP_I -0.764  0.828  0.876  0.805 -0.948 -0.873 -0.924
refitting model(s) with ML (instead of REML)

Data: dataset
Models:
model1: dishab ~ total_trial_number + block_number + within_PoP_ID + (1 | prolific_id)
model2: dishab ~ total_trial_number * block_number + within_PoP_ID + (1 | prolific_id)
model3: dishab ~ total_trial_number * block_number * within_PoP_ID + (1 | prolific_id)
       npar    AIC    BIC  logLik deviance  Chisq Df Pr(>Chisq)  
model1    6 2416.1 2449.3 -1202.1   2404.1                       
model2    7 2412.3 2451.0 -1199.2   2398.3 5.8350  1    0.01571 *
model3   10 2415.8 2471.1 -1197.9   2395.8 2.4856  3    0.47790  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

ABBA: number

ABBA_number <- exp2_core %>% filter(violation_type == "number") %>%
  left_join(exp2_pairs_number, by = c("violation_type", "bg_image", "dv_image"))

ABBA_number[which(is.na(ABBA_number$dishab)),]
# A tibble: 14 × 11
   prolific_id  block_number violation_type total_trial_number bg_image dv_image
   <chr>               <dbl> <chr>                       <dbl> <chr>    <chr>   
 1 57a1e03b8ec…            6 number                          2 inanima… inanima…
 2 60511bc8689…           10 number                          2 inanima… inanima…
 3 60d20236448…            8 number                          4 inanima… inanima…
 4 60f18127a0b…            6 number                          2 inanima… inanima…
 5 6164692cd6e…            5 number                          2 inanima… inanima…
 6 62eed9e3e4c…           12 number                          4 inanima… inanima…
 7 63d7a79e260…            9 number                          4 inanima… inanima…
 8 650ba232969…            3 number                          2 inanima… inanima…
 9 659c0682d10…            2 number                          6 inanima… inanima…
10 659c0682d10…           14 number                          2 animate… animate…
11 5b9aa47491b…            3 number                          4 inanima… inanima…
12 5e743544be8…           17 number                          4 animate… animate…
13 606cddc3cc6…           22 number                          4 animate… animate…
14 659aaea375e…            5 number                          4 inanima… inanima…
# ℹ 5 more variables: test <dbl>, lastfam <dbl>, dishab <dbl>,
#   pair_of_pair_ID <int>, within_PoP_ID <int>
# e.g.
exp2_adult %>% filter(prolific_id == "57a1e03b8eccbc0001f39c13", block_number == 6)
# A tibble: 1 × 15
  prolific_id    trial_type total_rt block_type block_number background_stimulus
  <chr>          <chr>         <dbl> <chr>             <dbl> <chr>              
1 57a1e03b8eccb… deviant         786 deviant_b…            6 media/padded_stims…
# ℹ 9 more variables: deviant_stimulus <chr>, background_type <chr>,
#   deviant_type <chr>, violation_type <chr>, trial_number <dbl>,
#   total_trial_number <dbl>, total_rt_log <dbl>, bg_image <chr>,
#   dv_image <chr>
process_ABBA(ABBA_number, exp2_pairs_number)
Warning: Removed 14 rows containing non-finite outside the scale range
(`stat_boxplot()`).
Warning: Removed 14 rows containing missing values or values outside the scale range
(`geom_point()`).
Warning: Removed 14 rows containing non-finite outside the scale range
(`stat_boxplot()`).
Warning: Removed 14 rows containing missing values or values outside the scale range
(`geom_point()`).
boundary (singular) fit: see help('isSingular')

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number + block_number + within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2151.2

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-6.6642 -0.4552  0.0210  0.5095  5.7176 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.0000   0.0000  
 Residual                0.1835   0.4283  
Number of obs: 1858, groups:  prolific_id, 468

Fixed effects:
                     Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)        -5.700e-01  4.351e-02  1.854e+03 -13.102  < 2e-16 ***
total_trial_number  9.991e-02  6.041e-03  1.854e+03  16.538  < 2e-16 ***
block_number       -2.773e-03  1.432e-03  1.854e+03  -1.937   0.0529 .  
within_PoP_ID       8.639e-02  1.988e-02  1.854e+03   4.346 1.46e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n
ttl_trl_nmb -0.565              
block_numbr -0.409  0.006       
withn_PP_ID -0.682  0.008 -0.011
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number * block_number + within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2156.9

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-6.5788 -0.4606  0.0218  0.5110  5.7247 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.0000   0.0000  
 Residual                0.1829   0.4277  
Number of obs: 1858, groups:  prolific_id, 468

Fixed effects:
                                  Estimate Std. Error         df t value
(Intercept)                     -4.582e-01  6.158e-02  1.853e+03  -7.441
total_trial_number               7.189e-02  1.249e-02  1.853e+03   5.755
block_number                    -1.160e-02  3.729e-03  1.853e+03  -3.110
within_PoP_ID                    8.615e-02  1.985e-02  1.853e+03   4.340
total_trial_number:block_number  2.222e-03  8.673e-04  1.853e+03   2.562
                                Pr(>|t|)    
(Intercept)                     1.52e-13 ***
total_trial_number              1.01e-08 ***
block_number                      0.0019 ** 
within_PoP_ID                   1.50e-05 ***
total_trial_number:block_number   0.0105 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n w_PP_I
ttl_trl_nmb -0.813                     
block_numbr -0.765  0.810              
withn_PP_ID -0.484  0.008  0.000       
ttl_trl_n:_  0.709 -0.876 -0.924 -0.005
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number * block_number * within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2180.7

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-6.4931 -0.4694  0.0153  0.5122  5.6811 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.0000   0.0000  
 Residual                0.1828   0.4276  
Number of obs: 1858, groups:  prolific_id, 468

Fixed effects:
                                                Estimate Std. Error         df
(Intercept)                                   -1.862e-01  1.702e-01  1.850e+03
total_trial_number                             2.323e-02  3.926e-02  1.850e+03
block_number                                  -3.134e-02  1.186e-02  1.850e+03
within_PoP_ID                                 -9.468e-02  1.078e-01  1.850e+03
total_trial_number:block_number                5.620e-03  2.743e-03  1.850e+03
total_trial_number:within_PoP_ID               3.228e-02  2.500e-02  1.850e+03
block_number:within_PoP_ID                     1.308e-02  7.460e-03  1.850e+03
total_trial_number:block_number:within_PoP_ID -2.244e-03  1.735e-03  1.850e+03
                                              t value Pr(>|t|)   
(Intercept)                                    -1.094  0.27429   
total_trial_number                              0.592  0.55406   
block_number                                   -2.643  0.00828 **
within_PoP_ID                                  -0.879  0.37978   
total_trial_number:block_number                 2.048  0.04066 * 
total_trial_number:within_PoP_ID                1.291  0.19679   
block_number:within_PoP_ID                      1.753  0.07973 . 
total_trial_number:block_number:within_PoP_ID  -1.293  0.19614   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n w_PP_I tt__:_ t__:_P b_:_PP
ttl_trl_nmb -0.926                                          
block_numbr -0.874  0.811                                   
withn_PP_ID -0.949  0.880  0.827                            
ttl_trl_n:_  0.808 -0.874 -0.926 -0.766                     
tt__:_PP_ID  0.875 -0.948 -0.764 -0.925  0.827              
blc_:_PP_ID  0.832 -0.773 -0.949 -0.875  0.880  0.810       
t__:_:_PP_I -0.767  0.833  0.875  0.807 -0.949 -0.876 -0.924
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
refitting model(s) with ML (instead of REML)

Data: dataset
Models:
model1: dishab ~ total_trial_number + block_number + within_PoP_ID + (1 | prolific_id)
model2: dishab ~ total_trial_number * block_number + within_PoP_ID + (1 | prolific_id)
model3: dishab ~ total_trial_number * block_number * within_PoP_ID + (1 | prolific_id)
       npar    AIC    BIC  logLik deviance  Chisq Df Pr(>Chisq)  
model1    6 2130.2 2163.3 -1059.1   2118.2                       
model2    7 2125.6 2164.3 -1055.8   2111.6 6.5680  1    0.01038 *
model3   10 2127.7 2182.9 -1053.8   2107.7 3.9124  3    0.27107  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

ABBA: animacy

combining across identity

ABBA_animacy_noidentity <- exp2_core %>% filter(violation_type == "animacy") %>%
  mutate(
    bg_image = str_replace_all(bg_image, "[0-9]+", ""),
    dv_image = str_replace_all(dv_image, "[0-9]+", "")
  ) %>% left_join(exp2_pairs_animacy_noidentity, by = c("violation_type", "bg_image", "dv_image"))

ABBA_animacy_noidentity[which(is.na(ABBA_animacy_noidentity$dishab)),]
# A tibble: 9 × 11
  prolific_id   block_number violation_type total_trial_number bg_image dv_image
  <chr>                <dbl> <chr>                       <dbl> <chr>    <chr>   
1 5b9aa47491b2…            4 animacy                         6 inanima… animate…
2 5be9d1cb271b…            1 animacy                         2 inanima… animate…
3 5eb48e67752e…            3 animacy                         4 inanima… animate…
4 60a1b5fe1f7f…            3 animacy                         2 inanima… animate…
5 659aaea375ee…           10 animacy                         4 inanima… animate…
6 599ec8c1617c…           17 animacy                         4 animate… inanima…
7 64dd27e89ef2…            5 animacy                         4 inanima… animate…
8 6501bf8cd968…           21 animacy                         6 animate… inanima…
9 657a7e142c5f…           21 animacy                         4 animate… inanima…
# ℹ 5 more variables: test <dbl>, lastfam <dbl>, dishab <dbl>,
#   pair_of_pair_ID <int>, within_PoP_ID <int>
process_ABBA(ABBA_animacy_noidentity, exp2_pairs_animacy_noidentity)
Warning: Removed 9 rows containing non-finite outside the scale range
(`stat_boxplot()`).
Warning: Removed 9 rows containing missing values or values outside the scale range
(`geom_point()`).
Warning: Removed 9 rows containing non-finite outside the scale range
(`stat_boxplot()`).
Warning: Removed 9 rows containing missing values or values outside the scale range
(`geom_point()`).

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number + block_number + within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2712.8

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-5.0821 -0.5017 -0.0486  0.4614  4.7432 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.01439  0.1199  
 Residual                0.23438  0.4841  
Number of obs: 1863, groups:  prolific_id, 468

Fixed effects:
                     Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)        -5.742e-01  1.100e-01  1.574e+03  -5.218 2.05e-07 ***
total_trial_number  1.017e-01  7.086e-03  1.832e+03  14.357  < 2e-16 ***
block_number        7.312e-03  3.273e-03  1.530e+03   2.234  0.02564 *  
within_PoP_ID       1.534e-01  4.495e-02  1.493e+03   3.413  0.00066 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n
ttl_trl_nmb -0.284              
block_numbr -0.911  0.034       
withn_PP_ID -0.938  0.015  0.866

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number * block_number + within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2708.3

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-5.0730 -0.4985 -0.0517  0.4736  4.7393 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.01523  0.1234  
 Residual                0.23165  0.4813  
Number of obs: 1863, groups:  prolific_id, 468

Fixed effects:
                                  Estimate Std. Error         df t value
(Intercept)                     -3.407e-01  1.236e-01  1.647e+03  -2.756
total_trial_number               4.917e-02  1.475e-02  1.837e+03   3.334
block_number                    -1.060e-02  5.486e-03  1.765e+03  -1.932
within_PoP_ID                    1.474e-01  4.473e-02  1.491e+03   3.296
total_trial_number:block_number  4.232e-03  1.044e-03  1.841e+03   4.055
                                Pr(>|t|)    
(Intercept)                     0.005922 ** 
total_trial_number              0.000874 ***
block_number                    0.053542 .  
within_PoP_ID                   0.001005 ** 
total_trial_number:block_number 5.21e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n w_PP_I
ttl_trl_nmb -0.529                     
block_numbr -0.853  0.716              
withn_PP_ID -0.845  0.036  0.541       
ttl_trl_n:_  0.465 -0.878 -0.805 -0.033

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number * block_number * within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2727

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-5.0229 -0.5005 -0.0617  0.4759  4.7737 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.01522  0.1234  
 Residual                0.23153  0.4812  
Number of obs: 1863, groups:  prolific_id, 468

Fixed effects:
                                                Estimate Std. Error         df
(Intercept)                                   -4.516e-01  5.005e-01  1.825e+03
total_trial_number                             4.256e-02  1.136e-01  1.847e+03
block_number                                  -1.787e-02  2.936e-02  1.832e+03
within_PoP_ID                                  1.623e-01  2.638e-01  1.829e+03
total_trial_number:block_number                8.340e-03  6.665e-03  1.850e+03
total_trial_number:within_PoP_ID               1.540e-02  5.975e-02  1.849e+03
block_number:within_PoP_ID                     1.140e-02  1.835e-02  1.836e+03
total_trial_number:block_number:within_PoP_ID -4.317e-03  4.153e-03  1.852e+03
                                              t value Pr(>|t|)
(Intercept)                                    -0.902    0.367
total_trial_number                              0.375    0.708
block_number                                   -0.609    0.543
within_PoP_ID                                   0.615    0.538
total_trial_number:block_number                 1.251    0.211
total_trial_number:within_PoP_ID                0.258    0.797
block_number:within_PoP_ID                      0.621    0.535
total_trial_number:block_number:within_PoP_ID  -1.039    0.299

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n w_PP_I tt__:_ t__:_P b_:_PP
ttl_trl_nmb -0.934                                          
block_numbr -0.945  0.883                                   
withn_PP_ID -0.984  0.919  0.967                            
ttl_trl_n:_  0.883 -0.944 -0.935 -0.902                     
tt__:_PP_ID  0.921 -0.985 -0.904 -0.935  0.965              
blc_:_PP_ID  0.816 -0.762 -0.950 -0.886  0.888  0.827       
t__:_:_PP_I -0.764  0.816  0.890  0.828 -0.951 -0.884 -0.935
refitting model(s) with ML (instead of REML)

Data: dataset
Models:
model1: dishab ~ total_trial_number + block_number + within_PoP_ID + (1 | prolific_id)
model2: dishab ~ total_trial_number * block_number + within_PoP_ID + (1 | prolific_id)
model3: dishab ~ total_trial_number * block_number * within_PoP_ID + (1 | prolific_id)
       npar    AIC    BIC  logLik deviance   Chisq Df Pr(>Chisq)    
model1    6 2694.4 2727.6 -1341.2   2682.4                          
model2    7 2680.0 2718.8 -1333.0   2666.0 16.3814  1  5.179e-05 ***
model3   10 2682.0 2737.3 -1331.0   2662.0  4.0349  3     0.2577    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

combining across pose and number

ABBA_animacy_nopose_nonumber <- exp2_core %>% filter(violation_type == "animacy") %>%
  mutate(
            bg_image = str_replace_all(bg_image, "_pair|_single", ""),
            dv_image = str_replace_all(dv_image, "_pair|_single", "")
          ) %>% 
  mutate(
            bg_image = str_replace_all(bg_image, "_left|_right", ""),
            dv_image = str_replace_all(dv_image, "_left|_right", "")
          ) %>%
  left_join(exp2_pairs_animacy_nopose_nonumber, by = c("violation_type", "bg_image", "dv_image"))

ABBA_animacy_nopose_nonumber[which(is.na(ABBA_animacy_nopose_nonumber$dishab)),]
# A tibble: 9 × 11
  prolific_id   block_number violation_type total_trial_number bg_image dv_image
  <chr>                <dbl> <chr>                       <dbl> <chr>    <chr>   
1 5b9aa47491b2…            4 animacy                         6 inanima… animate…
2 5be9d1cb271b…            1 animacy                         2 inanima… animate…
3 5eb48e67752e…            3 animacy                         4 inanima… animate…
4 60a1b5fe1f7f…            3 animacy                         2 inanima… animate…
5 659aaea375ee…           10 animacy                         4 inanima… animate…
6 599ec8c1617c…           17 animacy                         4 animate… inanima…
7 64dd27e89ef2…            5 animacy                         4 inanima… animate…
8 6501bf8cd968…           21 animacy                         6 animate… inanima…
9 657a7e142c5f…           21 animacy                         4 animate… inanima…
# ℹ 5 more variables: test <dbl>, lastfam <dbl>, dishab <dbl>,
#   pair_of_pair_ID <int>, within_PoP_ID <int>
process_ABBA(ABBA_animacy_nopose_nonumber, exp2_pairs_animacy_nopose_nonumber)
Warning: Removed 9 rows containing non-finite outside the scale range
(`stat_boxplot()`).
Warning: Removed 9 rows containing missing values or values outside the scale range
(`geom_point()`).
Warning: Removed 9 rows containing non-finite outside the scale range
(`stat_boxplot()`).
Warning: Removed 9 rows containing missing values or values outside the scale range
(`geom_point()`).

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number + block_number + within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2711.6

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-5.0873 -0.5015 -0.0519  0.4614  4.7476 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.01403  0.1185  
 Residual                0.23452  0.4843  
Number of obs: 1863, groups:  prolific_id, 468

Fixed effects:
                     Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)        -5.741e-01  1.052e-01  1.620e+03  -5.455 5.67e-08 ***
total_trial_number  1.019e-01  7.086e-03  1.833e+03  14.385  < 2e-16 ***
block_number        7.216e-03  3.130e-03  1.567e+03   2.305 0.021283 *  
within_PoP_ID       1.544e-01  4.302e-02  1.547e+03   3.589 0.000342 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n
ttl_trl_nmb -0.302              
block_numbr -0.902  0.040       
withn_PP_ID -0.932  0.021  0.853

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number * block_number + within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2707.5

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-5.0791 -0.4983 -0.0494  0.4732  4.7421 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.01488  0.1220  
 Residual                0.23182  0.4815  
Number of obs: 1863, groups:  prolific_id, 468

Fixed effects:
                                  Estimate Std. Error         df t value
(Intercept)                     -3.396e-01  1.198e-01  1.684e+03  -2.834
total_trial_number               4.985e-02  1.476e-02  1.837e+03   3.378
block_number                    -1.061e-02  5.419e-03  1.779e+03  -1.958
within_PoP_ID                    1.470e-01  4.283e-02  1.544e+03   3.432
total_trial_number:block_number  4.192e-03  1.044e-03  1.841e+03   4.016
                                Pr(>|t|)    
(Intercept)                     0.004652 ** 
total_trial_number              0.000745 ***
block_number                    0.050443 .  
within_PoP_ID                   0.000615 ***
total_trial_number:block_number 6.16e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n w_PP_I
ttl_trl_nmb -0.553                     
block_numbr -0.851  0.730              
withn_PP_ID -0.834  0.047  0.524       
ttl_trl_n:_  0.486 -0.878 -0.818 -0.042

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: dishab ~ total_trial_number * block_number * within_PoP_ID +  
    (1 | prolific_id)
   Data: dataset

REML criterion at convergence: 2726.8

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-5.0561 -0.4976 -0.0623  0.4724  4.7672 

Random effects:
 Groups      Name        Variance Std.Dev.
 prolific_id (Intercept) 0.01477  0.1215  
 Residual                0.23182  0.4815  
Number of obs: 1863, groups:  prolific_id, 468

Fixed effects:
                                                Estimate Std. Error         df
(Intercept)                                   -2.794e-01  4.557e-01  1.818e+03
total_trial_number                             8.877e-03  1.004e-01  1.846e+03
block_number                                  -2.669e-02  2.731e-02  1.823e+03
within_PoP_ID                                  7.308e-02  2.428e-01  1.821e+03
total_trial_number:block_number                1.005e-02  6.062e-03  1.848e+03
total_trial_number:within_PoP_ID               3.332e-02  5.355e-02  1.848e+03
block_number:within_PoP_ID                     1.595e-02  1.758e-02  1.828e+03
total_trial_number:block_number:within_PoP_ID -5.213e-03  3.931e-03  1.849e+03
                                              t value Pr(>|t|)  
(Intercept)                                    -0.613   0.5398  
total_trial_number                              0.088   0.9295  
block_number                                   -0.977   0.3286  
within_PoP_ID                                   0.301   0.7635  
total_trial_number:block_number                 1.657   0.0976 .
total_trial_number:within_PoP_ID                0.622   0.5339  
block_number:within_PoP_ID                      0.907   0.3646  
total_trial_number:block_number:within_PoP_ID  -1.326   0.1850  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) ttl_t_ blck_n w_PP_I tt__:_ t__:_P b_:_PP
ttl_trl_nmb -0.935                                          
block_numbr -0.936  0.876                                   
withn_PP_ID -0.981  0.917  0.961                            
ttl_trl_n:_  0.870 -0.931 -0.935 -0.895                     
tt__:_PP_ID  0.916 -0.981 -0.900 -0.935  0.958              
blc_:_PP_ID  0.796 -0.746 -0.947 -0.875  0.889  0.821       
t__:_:_PP_I -0.736  0.788  0.882  0.811 -0.947 -0.869 -0.935
refitting model(s) with ML (instead of REML)
Data: dataset
Models:
model1: dishab ~ total_trial_number + block_number + within_PoP_ID + (1 | prolific_id)
model2: dishab ~ total_trial_number * block_number + within_PoP_ID + (1 | prolific_id)
model3: dishab ~ total_trial_number * block_number * within_PoP_ID + (1 | prolific_id)
       npar    AIC    BIC  logLik deviance   Chisq Df Pr(>Chisq)    
model1    6 2693.2 2726.4 -1340.6   2681.2                          
model2    7 2679.1 2717.8 -1332.6   2665.1 16.0642  1  6.123e-05 ***
model3   10 2681.4 2736.7 -1330.7   2661.4  3.6977  3      0.296    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
dplyr 1.1.0.
ℹ Please use `reframe()` instead.
ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
  always returns an ungrouped data frame and adjust accordingly.

Warning: Removed 1 row containing missing values or values outside the scale range
(`geom_point()`).
Warning: Removed 1 row containing missing values or values outside the scale range
(`geom_point()`).