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("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_firstfam_only <- exp2_adult %>% filter(trial_number == 1) %>% mutate(my_trial_type = "firstfam")

exp2_core <- pivot_wider(bind_rows(exp2_firstfam_only, exp2_lastfam_only, exp2_test_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)

data quality check

raw data

skimr::skim(exp2_adult)
Data summary
Name exp2_adult
Number of rows 44775
Number of columns 15
_______________________
Column type frequency:
character 10
numeric 5
________________________
Group variables None

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
prolific_id 0 1.00 24 24 0 468 0
trial_type 0 1.00 7 10 0 2 0
block_type 0 1.00 13 16 0 2 0
background_stimulus 0 1.00 39 42 0 64 0
deviant_stimulus 14931 0.67 39 42 0 64 0
background_type 0 1.00 17 22 0 8 0
deviant_type 14931 0.67 17 22 0 8 0
violation_type 0 1.00 4 10 0 5 0
bg_image 0 1.00 21 26 0 128 0
dv_image 0 1.00 21 26 0 128 0

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
total_rt 0 1 2347.60 2161.48 500.00 949.00 1568.00 2981.5 20526.00 ▇▁▁▁▁
block_number 0 1 12.49 6.92 1.00 6.00 13.00 18.0 24.00 ▇▇▆▇▇
trial_number 0 1 2.84 1.57 1.00 2.00 3.00 4.0 6.00 ▇▂▂▂▂
total_trial_number 0 1 4.67 1.49 2.00 4.00 6.00 6.0 6.00 ▃▁▅▁▇
total_rt_log 0 1 7.46 0.74 6.21 6.86 7.36 8.0 9.93 ▇▇▆▂▁
naniar::vis_miss(exp2_adult)

janitor::get_dupes(exp2_adult)
## No variable names specified - using all columns.
## No duplicate combinations found of: prolific_id, trial_type, total_rt, block_type, block_number, background_stimulus, deviant_stimulus, background_type, deviant_type, ... and 6 other variables
## # A tibble: 0 × 16
## # ℹ 16 variables: prolific_id <chr>, trial_type <chr>, total_rt <dbl>,
## #   block_type <chr>, block_number <dbl>, background_stimulus <chr>,
## #   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>, dupe_count <int>

dishab data

skimr::skim(exp2_core)
Data summary
Name exp2_core
Number of rows 11232
Number of columns 10
_______________________
Column type frequency:
character 4
numeric 6
________________________
Group variables None

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
prolific_id 0 1 24 24 0 468 0
violation_type 0 1 4 10 0 5 0
bg_image 0 1 21 26 0 128 0
dv_image 0 1 21 26 0 128 0

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
block_number 0 1.00 12.50 6.92 1.00 6.75 12.50 18.25 24.00 ▇▇▆▇▇
total_trial_number 0 1.00 4.00 1.64 2.00 2.00 4.00 6.00 6.00 ▇▁▇▁▇
firstfam 62 0.99 7.72 0.73 6.22 7.15 7.68 8.24 9.92 ▃▇▇▃▁
lastfam 39 1.00 7.46 0.74 6.22 6.84 7.35 8.00 9.92 ▇▇▆▂▁
test 25 1.00 7.44 0.72 6.21 6.85 7.33 7.96 9.93 ▇▇▆▂▁
dishab 62 0.99 -0.02 0.50 -3.20 -0.23 0.00 0.21 2.95 ▁▁▇▁▁
naniar::vis_miss(exp2_core)

janitor::get_dupes(exp2_core)
## No variable names specified - using all columns.
## No duplicate combinations found of: prolific_id, block_number, violation_type, total_trial_number, bg_image, dv_image, firstfam, lastfam, test, dishab
## # A tibble: 0 × 11
## # ℹ 11 variables: prolific_id <chr>, block_number <dbl>, violation_type <chr>,
## #   total_trial_number <dbl>, bg_image <chr>, dv_image <chr>, firstfam <dbl>,
## #   lastfam <dbl>, test <dbl>, dishab <dbl>, dupe_count <int>
# dlookr::plot_outlier(exp2_core)

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: 8 × 12
##   prolific_id   block_number violation_type total_trial_number bg_image dv_image
##   <chr>                <dbl> <chr>                       <dbl> <chr>    <chr>   
## 1 6025d40ede4e…            3 pose                            4 inanima… inanima…
## 2 6140d7cdf9bc…           16 pose                            6 animate… animate…
## 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…
## 8 600959b17473…            3 pose                            2 inanima… inanima…
## # ℹ 6 more variables: firstfam <dbl>, lastfam <dbl>, test <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 8 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 8 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 8 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 8 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
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## dishab ~ total_trial_number * block_number + firstfam + within_PoP_ID +  
##     (1 | prolific_id)
##    Data: dataset
## 
## REML criterion at convergence: 2357
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.5503 -0.5053  0.0156  0.5069  6.2232 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  prolific_id (Intercept) 0.00647  0.08043 
##  Residual                0.19728  0.44416 
## Number of obs: 1856, groups:  prolific_id, 468
## 
## Fixed effects:
##                                   Estimate Std. Error         df t value
## (Intercept)                      6.489e-01  1.358e-01  1.183e+03   4.777
## total_trial_number               7.746e-02  1.300e-02  1.850e+03   5.959
## block_number                    -1.363e-02  3.936e-03  1.842e+03  -3.462
## firstfam                        -1.241e-01  1.509e-02  9.751e+02  -8.225
## within_PoP_ID                   -1.747e-03  2.089e-02  1.820e+03  -0.084
## total_trial_number:block_number  2.004e-03  9.154e-04  1.850e+03   2.189
##                                 Pr(>|t|)    
## (Intercept)                     2.01e-06 ***
## total_trial_number              3.04e-09 ***
## block_number                    0.000547 ***
## firstfam                        6.22e-16 ***
## within_PoP_ID                   0.933359    
## total_trial_number:block_number 0.028715 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) ttl_t_ blck_n frstfm w_PP_I
## ttl_trl_nmb -0.360                            
## block_numbr -0.413  0.804                     
## firstfam    -0.882 -0.024  0.063              
## withn_PP_ID -0.230  0.003 -0.004  0.001       
## ttl_trl_n:_  0.306 -0.873 -0.921  0.029  0.000

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 × 12
##    prolific_id  block_number violation_type total_trial_number bg_image dv_image
##    <chr>               <dbl> <chr>                       <dbl> <chr>    <chr>   
##  1 5b9aa47491b…            3 number                          4 inanima… inanima…
##  2 5e743544be8…           17 number                          4 animate… animate…
##  3 606cddc3cc6…           22 number                          4 animate… animate…
##  4 62eed9e3e4c…           12 number                          4 inanima… inanima…
##  5 63d7a79e260…            9 number                          4 inanima… inanima…
##  6 659aaea375e…            5 number                          4 inanima… inanima…
##  7 659c0682d10…            2 number                          6 inanima… inanima…
##  8 57a1e03b8ec…            6 number                          2 inanima… inanima…
##  9 60511bc8689…           10 number                          2 inanima… inanima…
## 10 60d20236448…            8 number                          4 inanima… inanima…
## 11 60f18127a0b…            6 number                          2 inanima… inanima…
## 12 6164692cd6e…            5 number                          2 inanima… inanima…
## 13 650ba232969…            3 number                          2 inanima… inanima…
## 14 659c0682d10…           14 number                          2 animate… animate…
## # ℹ 6 more variables: firstfam <dbl>, lastfam <dbl>, test <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
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## dishab ~ total_trial_number * block_number + firstfam + within_PoP_ID +  
##     (1 | prolific_id)
##    Data: dataset
## 
## REML criterion at convergence: 2097.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.9969 -0.4944  0.0032  0.5288  5.5937 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  prolific_id (Intercept) 0.0048   0.06928 
##  Residual                0.1726   0.41548 
## Number of obs: 1852, groups:  prolific_id, 468
## 
## Fixed effects:
##                                   Estimate Std. Error         df t value
## (Intercept)                      4.053e-01  1.285e-01  1.239e+03   3.153
## total_trial_number               7.220e-02  1.231e-02  1.841e+03   5.864
## block_number                    -1.382e-02  3.673e-03  1.815e+03  -3.762
## firstfam                        -1.061e-01  1.402e-02  1.000e+03  -7.566
## within_PoP_ID                    7.657e-02  1.955e-02  1.815e+03   3.916
## total_trial_number:block_number  2.129e-03  8.541e-04  1.837e+03   2.493
##                                 Pr(>|t|)    
## (Intercept)                     0.001653 ** 
## total_trial_number              5.34e-09 ***
## block_number                    0.000174 ***
## firstfam                        8.68e-14 ***
## within_PoP_ID                   9.34e-05 ***
## total_trial_number:block_number 0.012755 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) ttl_t_ blck_n frstfm w_PP_I
## ttl_trl_nmb -0.366                            
## block_numbr -0.423  0.808                     
## firstfam    -0.882 -0.020  0.072              
## withn_PP_ID -0.275  0.007  0.003  0.054       
## ttl_trl_n:_  0.310 -0.876 -0.920  0.027 -0.003

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 × 12
##   prolific_id   block_number violation_type total_trial_number bg_image dv_image
##   <chr>                <dbl> <chr>                       <dbl> <chr>    <chr>   
## 1 599ec8c1617c…           17 animacy                         4 animate… inanima…
## 2 5eb48e67752e…            3 animacy                         4 inanima… animate…
## 3 64dd27e89ef2…            5 animacy                         4 inanima… animate…
## 4 6501bf8cd968…           21 animacy                         6 animate… inanima…
## 5 657a7e142c5f…           21 animacy                         4 animate… inanima…
## 6 659aaea375ee…           10 animacy                         4 inanima… animate…
## 7 5b9aa47491b2…            4 animacy                         6 inanima… animate…
## 8 5be9d1cb271b…            1 animacy                         2 inanima… animate…
## 9 60a1b5fe1f7f…            3 animacy                         2 inanima… animate…
## # ℹ 6 more variables: firstfam <dbl>, lastfam <dbl>, test <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
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## dishab ~ total_trial_number * block_number + firstfam + within_PoP_ID +  
##     (1 | prolific_id)
##    Data: dataset
## 
## REML criterion at convergence: 2680.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.7409 -0.4985 -0.0748  0.4622  4.8525 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  prolific_id (Intercept) 0.02222  0.1491  
##  Residual                0.22307  0.4723  
## Number of obs: 1856, groups:  prolific_id, 468
## 
## Fixed effects:
##                                   Estimate Std. Error         df t value
## (Intercept)                      4.245e-01  1.918e-01  1.702e+03   2.213
## total_trial_number               4.939e-02  1.466e-02  1.809e+03   3.370
## block_number                    -1.461e-02  5.475e-03  1.737e+03  -2.669
## firstfam                        -8.850e-02  1.732e-02  1.159e+03  -5.110
## within_PoP_ID                    1.259e-01  4.415e-02  1.456e+03   2.850
## total_trial_number:block_number  4.229e-03  1.036e-03  1.814e+03   4.081
##                                 Pr(>|t|)    
## (Intercept)                     0.027030 *  
## total_trial_number              0.000767 ***
## block_number                    0.007668 ** 
## firstfam                        3.76e-07 ***
## within_PoP_ID                   0.004430 ** 
## total_trial_number:block_number 4.67e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) ttl_t_ blck_n frstfm w_PP_I
## ttl_trl_nmb -0.337                            
## block_numbr -0.639  0.712                     
## firstfam    -0.772 -0.001  0.131              
## withn_PP_ID -0.597  0.036  0.543  0.081       
## ttl_trl_n:_  0.297 -0.879 -0.800  0.000 -0.033

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 × 12
##   prolific_id   block_number violation_type total_trial_number bg_image dv_image
##   <chr>                <dbl> <chr>                       <dbl> <chr>    <chr>   
## 1 599ec8c1617c…           17 animacy                         4 animate… inanima…
## 2 5eb48e67752e…            3 animacy                         4 inanima… animate…
## 3 64dd27e89ef2…            5 animacy                         4 inanima… animate…
## 4 6501bf8cd968…           21 animacy                         6 animate… inanima…
## 5 657a7e142c5f…           21 animacy                         4 animate… inanima…
## 6 659aaea375ee…           10 animacy                         4 inanima… animate…
## 7 5b9aa47491b2…            4 animacy                         6 inanima… animate…
## 8 5be9d1cb271b…            1 animacy                         2 inanima… animate…
## 9 60a1b5fe1f7f…            3 animacy                         2 inanima… animate…
## # ℹ 6 more variables: firstfam <dbl>, lastfam <dbl>, test <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
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## dishab ~ total_trial_number * block_number + firstfam + within_PoP_ID +  
##     (1 | prolific_id)
##    Data: dataset
## 
## REML criterion at convergence: 2680.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.7451 -0.5023 -0.0755  0.4648  4.8558 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  prolific_id (Intercept) 0.02192  0.1480  
##  Residual                0.22320  0.4724  
## Number of obs: 1856, groups:  prolific_id, 468
## 
## Fixed effects:
##                                   Estimate Std. Error         df t value
## (Intercept)                      4.212e-01  1.887e-01  1.675e+03   2.232
## total_trial_number               4.998e-02  1.466e-02  1.809e+03   3.409
## block_number                    -1.454e-02  5.409e-03  1.751e+03  -2.689
## firstfam                        -8.829e-02  1.730e-02  1.157e+03  -5.104
## within_PoP_ID                    1.266e-01  4.230e-02  1.505e+03   2.994
## total_trial_number:block_number  4.193e-03  1.036e-03  1.814e+03   4.046
##                                 Pr(>|t|)    
## (Intercept)                     0.025774 *  
## total_trial_number              0.000666 ***
## block_number                    0.007239 ** 
## firstfam                        3.88e-07 ***
## within_PoP_ID                   0.002800 ** 
## total_trial_number:block_number 5.43e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) ttl_t_ blck_n frstfm w_PP_I
## ttl_trl_nmb -0.348                            
## block_numbr -0.629  0.725                     
## firstfam    -0.779  0.000  0.128              
## withn_PP_ID -0.580  0.047  0.527  0.076       
## ttl_trl_n:_  0.307 -0.879 -0.813  0.000 -0.042
## 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.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

## 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()`).

check baseline looking

animacy

exp2_core_animacy <- exp2_core %>% 
  filter(c(violation_type == "animacy")) %>%
  mutate(bg_image_feature = ifelse(str_detect(bg_image, "inanimate") == TRUE, "inanimate", "animate")) 

exp2_core_animacy %>% group_by(bg_image_feature) %>% rstatix::get_summary_stats(firstfam, type = "common")
## # A tibble: 2 × 11
##   bg_image_feature variable     n   min   max median   iqr  mean    sd    se
##   <chr>            <fct>    <dbl> <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 animate          firstfam   934  6.24  9.92   7.48  1.01  7.58 0.711 0.023
## 2 inanimate        firstfam   928  6.22  9.82   7.92  1.10  7.87 0.723 0.024
## # ℹ 1 more variable: ci <dbl>
m1 <- lmerTest::lmer(firstfam ~ block_number + bg_image_feature + (1|prolific_id), data = exp2_core_animacy)
m2 <- lmerTest::lmer(firstfam ~ block_number * bg_image_feature + (1|prolific_id), data = exp2_core_animacy)
anova(m1, m2)
## refitting model(s) with ML (instead of REML)
## Data: exp2_core_animacy
## Models:
## m1: firstfam ~ block_number + bg_image_feature + (1 | prolific_id)
## m2: firstfam ~ block_number * bg_image_feature + (1 | prolific_id)
##    npar    AIC    BIC  logLik deviance  Chisq Df Pr(>Chisq)    
## m1    5 3370.8 3398.5 -1680.4   3360.8                         
## m2    6 3287.2 3320.4 -1637.6   3275.2 85.643  1  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(m1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: firstfam ~ block_number + bg_image_feature + (1 | prolific_id)
##    Data: exp2_core_animacy
## 
## REML criterion at convergence: 3381.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5167 -0.6027 -0.0763  0.5205  3.5992 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  prolific_id (Intercept) 0.2625   0.5124  
##  Residual                0.2324   0.4820  
## Number of obs: 1862, groups:  prolific_id, 468
## 
## Fixed effects:
##                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                8.332e+00  6.758e-02  1.781e+03 123.284  < 2e-16 ***
## block_number              -4.071e-02  3.327e-03  1.426e+03 -12.236  < 2e-16 ***
## bg_image_featureinanimate -1.953e-01  4.545e-02  1.417e+03  -4.298 1.84e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) blck_n
## block_numbr -0.907       
## bg_mg_ftrnn -0.871  0.871
summary(m2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: firstfam ~ block_number * bg_image_feature + (1 | prolific_id)
##    Data: exp2_core_animacy
## 
## REML criterion at convergence: 3304.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.7756 -0.5734 -0.0848  0.5158  3.7700 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  prolific_id (Intercept) 0.2664   0.5162  
##  Residual                0.2186   0.4675  
## Number of obs: 1862, groups:  prolific_id, 468
## 
## Fixed effects:
##                                          Estimate Std. Error         df t value
## (Intercept)                             7.756e+00  9.004e-02  1.643e+03  86.134
## block_number                           -9.422e-03  4.638e-03  1.421e+03  -2.031
## bg_image_featureinanimate               5.731e-01  9.294e-02  1.420e+03   6.166
## block_number:bg_image_featureinanimate -6.064e-02  6.458e-03  1.422e+03  -9.390
##                                        Pr(>|t|)    
## (Intercept)                             < 2e-16 ***
## block_number                             0.0424 *  
## bg_image_featureinanimate              9.11e-10 ***
## block_number:bg_image_featureinanimate  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) blck_n bg_mg_
## block_numbr -0.949              
## bg_mg_ftrnn -0.901  0.920       
## blck_nmb:__  0.682 -0.718 -0.880

number

exp2_core_number <- exp2_core %>% 
  filter(c(violation_type == "number")) %>%
  mutate(bg_image_feature = ifelse(str_detect(bg_image, "pair") == TRUE, "pair", "single"))

exp2_core_number %>% group_by(bg_image_feature) %>% rstatix::get_summary_stats(firstfam, type = "common")
## # A tibble: 2 × 11
##   bg_image_feature variable     n   min   max median   iqr  mean    sd    se
##   <chr>            <fct>    <dbl> <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 pair             firstfam   946  6.26  9.90   7.71  1.11  7.76 0.751 0.024
## 2 single           firstfam   913  6.27  9.84   7.65  1.03  7.69 0.72  0.024
## # ℹ 1 more variable: ci <dbl>
m1 <- lmerTest::lmer(firstfam ~ block_number + bg_image_feature + (1|prolific_id), data = exp2_core_number)
m2 <- lmerTest::lmer(firstfam ~ block_number * bg_image_feature + (1|prolific_id), data = exp2_core_number)
anova(m1, m2)
## refitting model(s) with ML (instead of REML)
## Data: exp2_core_number
## Models:
## m1: firstfam ~ block_number + bg_image_feature + (1 | prolific_id)
## m2: firstfam ~ block_number * bg_image_feature + (1 | prolific_id)
##    npar    AIC    BIC  logLik deviance Chisq Df Pr(>Chisq)
## m1    5 3407.2 3434.8 -1698.6   3397.2                    
## m2    6 3408.9 3442.0 -1698.4   3396.9 0.346  1     0.5564
summary(m1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: firstfam ~ block_number + bg_image_feature + (1 | prolific_id)
##    Data: exp2_core_number
## 
## REML criterion at convergence: 3419.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.8719 -0.5939 -0.1119  0.5037  4.3813 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  prolific_id (Intercept) 0.2768   0.5261  
##  Residual                0.2357   0.4855  
## Number of obs: 1859, groups:  prolific_id, 468
## 
## Fixed effects:
##                          Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)             8.081e+00  3.579e-02  1.214e+03 225.771   <2e-16 ***
## block_number           -2.601e-02  1.633e-03  1.396e+03 -15.925   <2e-16 ***
## bg_image_featuresingle -5.414e-02  2.480e-02  1.513e+03  -2.183   0.0292 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) blck_n
## block_numbr -0.569       
## bg_mg_ftrsn -0.332 -0.015

pose

exp2_core_pose <- exp2_core %>% 
  filter(c(violation_type == "pose")) %>%
  mutate(bg_image_feature = ifelse(str_detect(bg_image, "left") == TRUE, "left", "right"))

exp2_core_pose %>% group_by(bg_image_feature) %>% rstatix::get_summary_stats(firstfam, type = "common")
## # A tibble: 2 × 11
##   bg_image_feature variable     n   min   max median   iqr  mean    sd    se
##   <chr>            <fct>    <dbl> <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 left             firstfam   942  6.25  9.88   7.69  1.12  7.73 0.737 0.024
## 2 right            firstfam   921  6.24  9.89   7.68  1.04  7.72 0.729 0.024
## # ℹ 1 more variable: ci <dbl>
m1 <- lmerTest::lmer(firstfam ~ block_number + bg_image_feature + (1|prolific_id), data = exp2_core_pose)
m2 <- lmerTest::lmer(firstfam ~ block_number * bg_image_feature + (1|prolific_id), data = exp2_core_pose)
anova(m1, m2)
## refitting model(s) with ML (instead of REML)
## Data: exp2_core_pose
## Models:
## m1: firstfam ~ block_number + bg_image_feature + (1 | prolific_id)
## m2: firstfam ~ block_number * bg_image_feature + (1 | prolific_id)
##    npar  AIC    BIC logLik deviance  Chisq Df Pr(>Chisq)
## m1    5 3332 3359.6  -1661     3322                     
## m2    6 3332 3365.2  -1660     3320 1.9557  1      0.162
summary(m1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: firstfam ~ block_number + bg_image_feature + (1 | prolific_id)
##    Data: exp2_core_pose
## 
## REML criterion at convergence: 3344
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.9244 -0.5771 -0.0920  0.4948  3.8651 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  prolific_id (Intercept) 0.2916   0.540   
##  Residual                0.2199   0.469   
## Number of obs: 1863, groups:  prolific_id, 468
## 
## Fixed effects:
##                         Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)            8.018e+00  3.556e-02  1.151e+03 225.484   <2e-16 ***
## block_number          -2.340e-02  1.578e-03  1.400e+03 -14.831   <2e-16 ***
## bg_image_featureright  8.011e-03  2.404e-02  1.510e+03   0.333    0.739    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) blck_n
## block_numbr -0.549       
## bg_mg_ftrrg -0.325 -0.017
exp2_core_baseline_check <- bind_rows(exp2_core_pose, exp2_core_number, exp2_core_animacy)

exp2_core_baseline_check$bg_image_feature <- as.factor(exp2_core_baseline_check$bg_image_feature)
exp2_core_baseline_check$bg_image_feature <- fct_relevel(exp2_core_baseline_check$bg_image_feature, "left", "right", "single", "pair", "inanimate", "animate")

exp2_core_baseline_check %>%
    ggplot(aes(x = as.factor(bg_image_feature), y = dishab, fill = violation_type)) + 
    geom_boxplot(outlier.color = "red", outlier.shape = 1, outlier.alpha = 0.05) + 
    geom_point(alpha = 0.01) +
    labs(x = "Feature of Familiarization Image", 
         y = "Looking Time at First Familiarization (s)", 
         title = "Baseline Looking for Different Stimuli") +
    theme_classic()
## Warning: Removed 31 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 31 rows containing missing values or values outside the scale range
## (`geom_point()`).