Online Ellenbogen replication attempt (total n=110 after clearning)

group learningCriteria subs
sleep 66% 32
sleep 75% 24
wake 66% 31
wake 75% 23

Session 1 preprocessing

details.ellrep = file.info(list.files(path = "C:\\Users\\saptaf1\\Documents local\\ellrep-ti-task\\session1\\data", pattern = "*.csv", full.names = TRUE)) 
details.filtered.ellrep <- details.ellrep

data_all <- rownames(details.filtered.ellrep) %>%
  map_df(~read_csv(.x, col_types = cols(slider.response = col_character(),slider.rt = col_character(),fixation_cross.stopped = col_character(),stopFeedback.started =  col_character(),blockPerformance.started = col_character(), block_avg=col_number(),session=col_character(), block_avg_middlepair=col_number())))
## New names:
## * `` -> `...51`
session1.ellrep <- bind_rows(data_all) %>% mutate(stimCategory = case_when(
                                                                                          grepl(pattern = "faces", x = Image1) ~ "faces",
                                                                                          grepl(pattern = "objects", x = Image1) ~ "objects",
                                                                                          grepl(pattern = "scenes", x = Image1) ~ "scenes")) %>% filter(!is.na(Rank1))
## New names:
## * `...51` -> `...130`
session1.attention <- bind_rows(data_all) %>% mutate(stimCategory = case_when(
                                                                                          grepl(pattern = "faces", x = Image1) ~ "faces",
                                                                                          grepl(pattern = "objects", x = Image1) ~ "objects",
                                                                                          grepl(pattern = "scenes", x = Image1) ~ "scenes")) %>% filter(!is.na(num1))
## New names:
## * `...51` -> `...130`
session1.ellrep %>% group_by(participant) %>% summarise(blockcount = ifelse(sum(!is.na(key_resp_learning.keys))/10>10,10,sum(!is.na(key_resp_learning.keys)/10))) %>% filter(blockcount>=30) -> avgBlocks
hist(avgBlocks$blockcount)

session1.ellrep %>% group_by(participant) %>% summarise(blockcount = sum(!is.na(key_resp_learning.keys))/10) %>% filter(blockcount<=10)-> tmp

session1.avgs.ellrep <- session1.ellrep %>% select(participant,group, session, stimCategory, key_resp_im.corr, Rank1, Rank2) %>% mutate(cRank= paste0(pmin(Rank1,Rank2),pmax(Rank1,Rank2))) %>% group_by(participant,group, session,cRank,stimCategory) %>% summarise_each(funs(mean(key_resp_im.corr, na.rm = TRUE))) %>% filter(!is.na(session)) %>% select(-Rank1,-Rank2)

# for output

session1.ellrep %>% select(participant,group, session, stimCategory, key_resp_im.corr,key_resp_im.rt, Rank1, Rank2,date) %>% mutate(cRank= paste0(pmin(Rank1,Rank2),pmax(Rank1,Rank2))) %>% na.omit() %>% rename(corr=key_resp_im.corr, rt=key_resp_im.rt) %>% mutate(part="immediateTest") %>% mutate(date = lubridate::parse_date_time(date,'ymd HMS!')) %>% mutate(learningCriteria = ifelse(date>=as.Date('2022-11-23 10:30'),"75%","66%")) -> s1.im
s1.im %>% saveRDS("ellrep_tamas/session1_ellrep_trials_immediate_design-bws.RDS")

# NOTE!! 4xAFERQVTO not okay // 136 people reached criteria
s1.im %>% group_by(participant,group,date) %>% count() %>% nrow()
## [1] 136
session1.ellrep %>% select(participant,group, session, stimCategory, key_resp_learning.corr,key_resp_learning.rt, Rank1, Rank2,date) %>% mutate(part="learning") %>% mutate(date = lubridate::parse_date_time(date,'ymd HMS!')) %>% mutate(learningCriteria = ifelse(date>=as.Date('2022-11-23 10:30'),"75%","66%")) %>%  mutate(cRank= paste0(pmin(Rank1,Rank2),pmax(Rank1,Rank2))) %>% na.omit() %>% filter(date %in% s1.im$date ) ->tmp.learn 

tmp.learn  %>% saveRDS("ellrep_tamas/session1_ellrep_trials_learning_design-bws.RDS")

# NOTE!! 4xAFERQVTO not okay // 134 people reached criteria -weird discrepancy
tmp.learn %>% group_by(participant,group,date) %>% count() %>% nrow()
## [1] 134
#attention checks

session1.attention %>% select(participant,group, session, date,slider.response,desc,num1,num2,  totalsum)  %>% mutate(date = lubridate::parse_date_time(date,'ymd HMS!')) %>% na.omit() %>% filter(date %in% s1.im$date ) %>% saveRDS("ellrep_tamas/session1_ellrep_attentioncheck_design-bws.RDS")

#immediate recall performance
print(head(session1.avgs.ellrep))
## # A tibble: 6 x 6
## # Groups:   participant, group, session, cRank [6]
##   participant group session cRank stimCategory key_resp_im.corr
##   <chr>       <chr> <chr>   <chr> <chr>                   <dbl>
## 1 AFERQVTO    sleep 1       12    faces                  NaN   
## 2 AFERQVTO    sleep 1       23    faces                  NaN   
## 3 AFERQVTO    sleep 1       34    faces                  NaN   
## 4 AFERQVTO    sleep 1       45    faces                  NaN   
## 5 AFERQVTO    sleep 1       56    faces                  NaN   
## 6 AFERQVTO    wake  1       12    faces                    0.52
immediatePerformance.s1 <- session1.avgs.ellrep %>% mutate(pairType= ifelse(cRank %in% c("12","23","34","45","56"),"premise", ifelse(cRank %in% c("24","25","35"), "inference","anchor"))) %>% na.omit() %>% group_by(participant,group, pairType) %>% summarise(meanPerf=mean(key_resp_im.corr)) 
## `summarise()` has grouped output by 'participant', 'group'. You can override
## using the `.groups` argument.
grouped_ggbetweenstats(
  data = immediatePerformance.s1,
  x = group,
  y = meanPerf,
  grouping.var = pairType,
  type="p",
  bf.messsage = FALSE
)

Session 2 preprocessing

details.ellrep = file.info(list.files(path = "C:\\Users\\saptaf1\\Documents local\\ellrep-ti-task\\session2\\data",     
                       pattern = "*.csv", full.names = TRUE))
details.filtered.ellrep <- details.ellrep

data_all <- rownames(details.filtered.ellrep) %>%
  map_df(~read_csv(.x, col_types = cols(slider.response = col_character(),slider.rt = col_character(),fixation_cross.stopped = col_character(),stopFeedback.started =  col_character(),blockPerformance.started = col_character(), block_avg=col_number(), block_avg_middlepair=col_number())))

session2.ellrep <- bind_rows(data_all) %>% mutate(stimCategory = case_when(
                                                                                          grepl(pattern = "faces", x = Image1) ~ "faces",
                                                                                          grepl(pattern = "objects", x = Image1) ~ "objects",
                                                                                          grepl(pattern = "scenes", x = Image1) ~ "scenes")) %>% filter(!is.na(Rank1))

# session2.ellrep %>% group_by(participant) %>% summarise(blockcount = ifelse(sum(!is.na(key_resp_learning.keys))/10>10,10,sum(!is.na(key_resp_learning.keys)/10))) %>% filter(blockcount>=30) -> avgBlocks
# hist(avgBlocks$blockcount)

# session2.ellrep %>% group_by(participant) %>% summarise(blockcount = sum(!is.na(key_resp_learning.keys))/10) %>% filter(blockcount<=10)-> tmp

session2.ellrep %>% select(participant,group, session, stimCategory, key_resp_im.corr,key_resp_im.rt, Rank1, Rank2,date) %>% mutate(cRank= paste0(pmin(Rank1,Rank2),pmax(Rank1,Rank2))) %>% na.omit() %>% rename(corr=key_resp_im.corr, rt=key_resp_im.rt) %>% mutate(part="delayedTest") %>% mutate(date = lubridate::parse_date_time(date,'ymd HMS!')) %>%  mutate(learningCriteria = ifelse(date>=as.Date('2022-11-24'),"75%","66%"), session=2) %>% saveRDS("ellrep_tamas/session2_ellrep_trials_delayed_design-bws.RDS")

session2.ellrep %>% select(participant,group, session, stimCategory, key_resp_im.corr,key_resp_im.rt, Rank1, Rank2,date) %>% mutate(cRank= paste0(pmin(Rank1,Rank2),pmax(Rank1,Rank2))) %>% na.omit() %>% rename(corr=key_resp_im.corr, rt=key_resp_im.rt) %>% mutate(part="delayedTest") %>% mutate(date = lubridate::parse_date_time(date,'ymd HMS!')) %>%  mutate(learningCriteria = ifelse(date>=as.Date('2022-11-24'),"75%","66%"), session=2) %>% mutate(participant_u_id =paste(participant,group,date, sep ="_" ), distance=abs(Rank1-Rank2), pairType=ifelse(distance==1,"premise",ifelse(distance %in% c(2,3), "inference","anchor"))) %>% filter(group %in% c("wake","sleep"))-> session2.ellrep.tidy

session2.avgs.ellrep <- session2.ellrep %>% select(participant,group, session, stimCategory, key_resp_im.corr, Rank1, Rank2,date) %>% mutate(cRank= paste0(pmin(Rank1,Rank2),pmax(Rank1,Rank2))) %>% group_by(participant,group, session,cRank,stimCategory,date) %>% summarise_each(funs(mean(key_resp_im.corr, na.rm = TRUE))) %>% filter(!is.na(session)) %>% select(-Rank1,-Rank2) %>% mutate(date = lubridate::parse_date_time(date,'ymd HMS!')) %>% mutate(learningCriteria = ifelse(date>=as.Date('2022-11-24'),"75%","66%")) %>% filter(group != "ws")

# how many people per group
# time of when the raise to 75% happens: 2022-11-23_10h49.00.768.csv
session2.avgs.ellrep %>% group_by(participant,group,date,learningCriteria) %>% count() %>% ungroup() %>% group_by(group, learningCriteria) %>% count() %>% arrange(learningCriteria)
## # A tibble: 4 x 3
## # Groups:   group, learningCriteria [4]
##   group learningCriteria     n
##   <chr> <chr>            <int>
## 1 sleep 66%                 38
## 2 wake  66%                 34
## 3 sleep 75%                 29
## 4 wake  75%                 34
#for some reason there are 2s and 3s in this column.. investigate
session2.avgs.ellrep$session <-2

#immediate recall performance
print(length(unique(session2.avgs.ellrep$participant)))
## [1] 133
#immediate recall performance
print(head(session2.avgs.ellrep))
## # A tibble: 6 x 8
## # Groups:   participant, group, session, cRank, stimCategory [6]
##   participant group session cRank stimCate~1 date                key_r~2 learn~3
##   <chr>       <chr>   <dbl> <chr> <chr>      <dttm>                <dbl> <chr>  
## 1 AFERQVTO    sleep       2 12    faces      2022-11-23 18:43:13   0.375 66%    
## 2 AFERQVTO    sleep       2 16    faces      2022-11-23 18:43:13   0.875 66%    
## 3 AFERQVTO    sleep       2 23    faces      2022-11-23 18:43:13   0.625 66%    
## 4 AFERQVTO    sleep       2 24    faces      2022-11-23 18:43:13   0.5   66%    
## 5 AFERQVTO    sleep       2 25    faces      2022-11-23 18:43:13   0.375 66%    
## 6 AFERQVTO    sleep       2 34    faces      2022-11-23 18:43:13   0.5   66%    
## # ... with abbreviated variable names 1: stimCategory, 2: key_resp_im.corr,
## #   3: learningCriteria
grouped_ggbetweenstats(
  data = session2.avgs.ellrep %>% mutate(pairType= ifelse(cRank %in% c("12","23","34","45","56"),"premise", ifelse(cRank %in% c("24","25","35"), "inference","anchor"))) %>% group_by(participant,group,learningCriteria, pairType) %>% summarise(meanPerf=mean(key_resp_im.corr)) %>% ungroup(),
  x = group,
  y = meanPerf,
  grouping.var = pairType,
  type="p",
  bf.messsage = FALSE
)
## `summarise()` has grouped output by 'participant', 'group', 'learningCriteria'.
## You can override using the `.groups` argument.

grouped_ggbetweenstats(
  data = session2.avgs.ellrep %>% mutate(pairType= ifelse(cRank %in% c("12","23","34","45","56"),"premise", ifelse(cRank %in% c("24","25","35"), "inference","anchor"))) %>% group_by(participant,group,learningCriteria, pairType) %>% summarise(meanPerf=mean(key_resp_im.corr)) %>% ungroup() %>% filter(learningCriteria== "66%"),
  x = group,
  y = meanPerf,
  grouping.var = pairType,
  type="p",
  bf.messsage = FALSE
)
## `summarise()` has grouped output by 'participant', 'group', 'learningCriteria'.
## You can override using the `.groups` argument.

grouped_ggbetweenstats(
  data = session2.avgs.ellrep %>% mutate(pairType= ifelse(cRank %in% c("12","23","34","45","56"),"premise", ifelse(cRank %in% c("24","25","35"), "inference","anchor"))) %>% group_by(participant,group,learningCriteria, pairType) %>% summarise(meanPerf=mean(key_resp_im.corr)) %>% ungroup() %>% filter(learningCriteria== "75%"),
  x = group,
  y = meanPerf,
  grouping.var = pairType,
  type="p",
  bf.messsage = FALSE
)
## `summarise()` has grouped output by 'participant', 'group', 'learningCriteria'.
## You can override using the `.groups` argument.

# proper filtering
s1.im %>% group_by(participant,group,date)%>% summarise(meanIm=mean(corr)) %>% filter(participant !="AFERQVTO") -> s1.im.aggr
## `summarise()` has grouped output by 'participant', 'group'. You can override
## using the `.groups` argument.
session2.ellrep.tidy.ext <- session2.ellrep.tidy %>% filter(pairType == "inference") %>% left_join(s1.im.aggr, by = c("participant"="participant","group"="group")) %>% filter(participant!="AFERQVTO") %>% mutate(timeelapsed=date.x-date.y)

session2.ellrep.tidy.ext %>% group_by(participant,group,date.x) %>% summarise(timeelapsed=unique(timeelapsed)) %>% ggplot(., aes(timeelapsed)) +
  geom_histogram()
## `summarise()` has grouped output by 'participant', 'group'. You can override
## using the `.groups` argument.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

minTime<-480
maxTime<-840
session2.ellrep.tidy.ext %>% group_by(participant,group,date.x) %>% summarise(timeelapsed=unique(timeelapsed)) %>%  filter(timeelapsed>minTime,timeelapsed<maxTime)  %>% ggplot(., aes(timeelapsed)) +
  geom_histogram()
## `summarise()` has grouped output by 'participant', 'group'. You can override
## using the `.groups` argument.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

session2.ellrep.tidy.ext %>% group_by(participant,group,date.x) %>% summarise(timeelapsed=unique(timeelapsed)) %>%  filter(timeelapsed>minTime,timeelapsed<maxTime) -> subs.normalrange
## `summarise()` has grouped output by 'participant', 'group'. You can override
## using the `.groups` argument.
grouped_ggbetweenstats(
  data = session2.avgs.ellrep %>% mutate(pairType= ifelse(cRank %in% c("12","23","34","45","56"),"premise", ifelse(cRank %in% c("24","25","35"), "inference","anchor"))) %>% group_by(participant,group,learningCriteria, pairType) %>% summarise(meanPerf=mean(key_resp_im.corr)) %>% ungroup() %>% filter(participant %in% subs.normalrange$participant),
  x = group,
  y = meanPerf,
  grouping.var = pairType,
  type="r",
  bf.messsage = FALSE
)
## `summarise()` has grouped output by 'participant', 'group', 'learningCriteria'.
## You can override using the `.groups` argument.

grouped_ggbetweenstats(
  data = session2.avgs.ellrep %>% mutate(pairType= ifelse(cRank %in% c("12","23","34","45","56"),"premise", ifelse(cRank %in% c("24","25","35"), "inference","anchor"))) %>% group_by(participant,group,learningCriteria, pairType) %>% summarise(meanPerf=mean(key_resp_im.corr)) %>% ungroup() %>% filter(learningCriteria== "66%")  %>% filter(participant %in% subs.normalrange$participant),
  x = group,
  y = meanPerf,
  grouping.var = pairType,
  type="p",
  bf.messsage = FALSE
)
## `summarise()` has grouped output by 'participant', 'group', 'learningCriteria'.
## You can override using the `.groups` argument.

grouped_ggbetweenstats(
  data = session2.avgs.ellrep %>% mutate(pairType= ifelse(cRank %in% c("12","23","34","45","56"),"premise", ifelse(cRank %in% c("24","25","35"), "inference","anchor"))) %>% group_by(participant,group,learningCriteria, pairType) %>% summarise(meanPerf=mean(key_resp_im.corr)) %>% ungroup() %>% filter(learningCriteria== "75%")  %>% filter(participant %in% subs.normalrange$participant),
  x = group,
  y = meanPerf,
  grouping.var = pairType,
  type="p",
  bf.messsage = FALSE
)
## `summarise()` has grouped output by 'participant', 'group', 'learningCriteria'.
## You can override using the `.groups` argument.

Qualtrics

library(qualtRics)

qualtrics_api_credentials(api_key = "ysZ6HezYt3Wc43hoFcwSG82LoMSbFHTqb0x1FWdW",
                          base_url = "cardiffunipsych.fra1.qualtrics.com",
                          install = TRUE)


awareness_survey.ellrep <-fetch_survey(surveyID = "SV_7armt1volf3zVfE", 
                         verbose = TRUE)

awareness_survey.ellrep %>% saveRDS("ellrep_tamas/session2_ellrep_awarenesssurvey_design-bws.RDS")

s1start.ellrep <-fetch_survey(surveyID = "SV_6lJ6YCFlcjdao8S", 
                         verbose = TRUE)

s1start.starttime.ellrep <- s1start.ellrep %>% group_by(code) %>% summarise(starttime=max(EndDate))

s1finish.ellrep <-fetch_survey(surveyID = "SV_2rTYD8fdqbPRWJM", 
                         verbose = TRUE)
s1finish.starttime.ellrep <- s1finish.ellrep %>% group_by(code) %>% summarise(endtime=max(EndDate))


s1start.starttime.ellrep %>% left_join(s1finish.starttime.ellrep) %>% mutate(total = endtime-starttime) %>% filter(code %in% awareness_survey.ellrep$code ) -> totalTimes

s2start.ellrep <-fetch_survey(surveyID = "SV_9phc9enBGE9abbg", 
                         verbose = TRUE)

s2start.starttime.ellrep <- s2start.ellrep %>% group_by(code) %>% summarise(starttime=max(EndDate))

s2finish.ellrep <-fetch_survey(surveyID = "SV_7armt1volf3zVfE", 
                         verbose = TRUE)
s2finish.starttime.ellrep <- s2finish.ellrep %>% group_by(code) %>% summarise(endtime=max(EndDate))

s2start.starttime.ellrep %>% left_join(s2finish.starttime.ellrep) %>% mutate(total = endtime-starttime) %>% filter(code %in% awareness_survey.ellrep$code ) -> totalTimes

#check whether time between S1.end and S2.start is approx 12h
s2start.starttime.ellrep %>% left_join(s1finish.starttime.ellrep) %>% mutate(total = difftime(starttime, endtime, units='hours')) %>% filter(code %in% awareness_survey.ellrep$code ) -> totaltimebetweensessions

hist(as.numeric(totaltimebetweensessions$total))

awareness_survey.ellrep %>% select(code,SC0) %>% rename("awareness"="SC0") -> awareness_score.ellrep

hist(awareness_score.ellrep$awareness)

Stats

library(tidyverse) # data wrangling and visualization
library(sjPlot)    # to visualizing mixed-effects models
## Warning: package 'sjPlot' was built under R version 4.1.3
# library(effects)   # to visualizing mixed-effects models
library(lme4)      # "golden standard" for mixed-effects modelling in R (no p-values)
## Warning: package 'lme4' was built under R version 4.1.3
## Loading required package: Matrix
## Warning: package 'Matrix' was built under R version 4.1.3
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
library(lmerTest)  # p-values for MEMs based on the Satterthwaite approximation
## Warning: package 'lmerTest' was built under R version 4.1.3
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
library(report)    # mainly for an "report" function
## Warning: package 'report' was built under R version 4.1.3
# library(emmeans)   # post-hoc analysis
# library(knitr)     # beautifying tables
# library(sjstats)   # ICC - intraclass-correlation coefficient
# library(caret)     # ML, model comparison & utility functions

str(session2.ellrep.tidy)
## tibble [9,720 x 15] (S3: tbl_df/tbl/data.frame)
##  $ participant     : chr [1:9720] "AFERQVTO" "AFERQVTO" "AFERQVTO" "AFERQVTO" ...
##  $ group           : chr [1:9720] "wake" "wake" "wake" "wake" ...
##  $ session         : num [1:9720] 2 2 2 2 2 2 2 2 2 2 ...
##  $ stimCategory    : chr [1:9720] "faces" "faces" "faces" "faces" ...
##  $ corr            : num [1:9720] 0 0 1 1 0 0 0 1 0 0 ...
##  $ rt              : num [1:9720] 1.168 0.244 0.154 0.177 0.134 ...
##  $ Rank1           : num [1:9720] 5 5 2 1 6 4 3 2 2 5 ...
##  $ Rank2           : num [1:9720] 3 2 3 2 1 3 2 5 1 4 ...
##  $ date            : POSIXct[1:9720], format: "2022-02-08 17:41:31" "2022-02-08 17:41:31" ...
##  $ cRank           : chr [1:9720] "35" "25" "23" "12" ...
##  $ part            : chr [1:9720] "delayedTest" "delayedTest" "delayedTest" "delayedTest" ...
##  $ learningCriteria: chr [1:9720] "66%" "66%" "66%" "66%" ...
##  $ participant_u_id: chr [1:9720] "AFERQVTO_wake_2022-02-08 17:41:31" "AFERQVTO_wake_2022-02-08 17:41:31" "AFERQVTO_wake_2022-02-08 17:41:31" "AFERQVTO_wake_2022-02-08 17:41:31" ...
##  $ distance        : num [1:9720] 2 3 1 1 5 1 1 3 1 1 ...
##  $ pairType        : chr [1:9720] "inference" "inference" "premise" "premise" ...
session2.ellrep.tidy %>% group_by(group, learningCriteria) %>% summarise(subs = n_distinct(participant_u_id))
## `summarise()` has grouped output by 'group'. You can override using the
## `.groups` argument.
## # A tibble: 4 x 3
## # Groups:   group [2]
##   group learningCriteria  subs
##   <chr> <chr>            <int>
## 1 sleep 66%                 38
## 2 sleep 75%                 29
## 3 wake  66%                 34
## 4 wake  75%                 34
#good plot
ggplot(aes(x=group, y=corr, group=interaction(learningCriteria,pairType), color=pairType, linetype=learningCriteria), data=session2.ellrep.tidy) + 
  stat_summary(fun.data="mean_cl_boot", geom='line') + ggtitle("All data..") +   stat_summary(fun.data=mean_cl_boot,fun.args=list(conf.int=.68), geom='errorbar', width=0.1) + ylab("Inference %")

ggplot(aes(x=group, y=corr, group=interaction(learningCriteria,pairType), color=pairType, linetype=learningCriteria), data=session2.ellrep.tidy%>% filter(participant %in% subs.normalrange$participant)) + 
  stat_summary(fun.data="mean_cl_boot", geom='line') +   stat_summary(fun.data=mean_cl_boot,fun.args=list(conf.int=.68), geom='errorbar', width=0.1) + ggtitle("Filtered data..") + ylab("Inference %")

#p=0.064 groupXpairType interaction
m1 <- glmer(corr ~ group*pairType  + (1 | participant_u_id ), data = session2.ellrep.tidy%>% filter(participant %in% subs.normalrange$participant, pairType %in% c("premise","inference")), family = binomial, control = glmerControl(optimizer = "bobyqa"))



m2 <- glmer(corr ~ group*pairType  + meanIm + (1 | participant_u_id ), data = session2.ellrep.tidy%>% filter(participant %in% subs.normalrange$participant,pairType %in% c("premise","inference")) %>% left_join(s1.im.aggr, by = c("participant"="participant","group"="group")), family = binomial, control = glmerControl(optimizer = "bobyqa"))
tab_model(m1,m2)
  corr corr
Predictors Odds Ratios CI p Odds Ratios CI p
(Intercept) 1.45 1.12 – 1.87 0.005 0.12 0.08 – 0.20 <0.001
group [wake] 0.82 0.57 – 1.18 0.288 0.82 0.63 – 1.07 0.137
pairType [premise] 1.81 1.56 – 2.11 <0.001 1.81 1.56 – 2.10 <0.001
group [wake] * pairType
[premise]
1.09 0.88 – 1.35 0.426 1.09 0.88 – 1.35 0.412
meanIm 32.08 16.81 – 61.23 <0.001
Random Effects
σ2 3.29 3.29
τ00 0.77 participant_u_id 0.30 participant_u_id
ICC 0.19 0.08
N 110 participant_u_id 110 participant_u_id
Observations 7040 7040
Marginal R2 / Conditional R2 0.024 / 0.209 0.123 / 0.196
#mean inf sig above chance
m1.inf <- glmer(corr ~ group + learningCriteria + (1 | participant_u_id ), data = session2.ellrep.tidy%>% filter(participant %in% subs.normalrange$participant) %>% filter(pairType == "inference"), family = binomial, control = glmerControl(optimizer = "bobyqa"))
tab_model(m1.inf)
  corr
Predictors Odds Ratios CI p
(Intercept) 1.57 1.05 – 2.36 0.027
group [wake] 0.80 0.49 – 1.31 0.379
learningCriteria [75%] 0.90 0.55 – 1.48 0.684
Random Effects
σ2 3.29
τ00 participant_u_id 1.47
ICC 0.31
N participant_u_id 110
Observations 2640
Marginal R2 / Conditional R2 0.003 / 0.311
m1.inf.subset <- glmer(corr ~ group+ (1 | participant_u_id ), data = session2.ellrep.tidy%>% filter(participant %in% subs.normalrange$participant) %>% filter(pairType == "inference", learningCriteria=="75%"), family = binomial, control = glmerControl(optimizer = "bobyqa"))
tab_model(m1.inf.subset)
  corr
Predictors Odds Ratios CI p
(Intercept) 1.60 0.87 – 2.95 0.132
group [wake] 0.66 0.27 – 1.57 0.345
Random Effects
σ2 3.29
τ00 participant_u_id 2.07
ICC 0.39
N participant_u_id 47
Observations 1128
Marginal R2 / Conditional R2 0.008 / 0.391
m1.inf.ext <- glmer(corr ~ group*meanIm + (1 | participant_u_id ), data = session2.ellrep.tidy %>% filter(pairType == "inference") %>% left_join(s1.im.aggr, by = c("participant"="participant","group"="group")) %>% filter(participant %in% subs.normalrange$participant) %>% na.omit(), family = binomial, control = glmerControl(optimizer = "bobyqa"))
tab_model(m1.inf.ext)
  corr
Predictors Odds Ratios CI p
(Intercept) 0.24 0.06 – 0.97 0.045
group [wake] 1.30 0.20 – 8.40 0.783
meanIm 13.58 1.97 – 93.84 0.008
group [wake] * meanIm 0.50 0.04 – 6.55 0.594
Random Effects
σ2 3.29
τ00 participant_u_id 1.32
ICC 0.29
N participant_u_id 110
Observations 2640
Marginal R2 / Conditional R2 0.038 / 0.314
m1.inf.ext.sleep <- glmer(corr ~ learningCriteria+meanIm + (1 | participant_u_id ), data = session2.ellrep.tidy %>% filter(pairType == "inference", group=="sleep") %>% left_join(s1.im.aggr, by = c("participant"="participant","group"="group")) %>% filter(participant %in% subs.normalrange$participant) %>% na.omit(), family = binomial, control = glmerControl(optimizer = "bobyqa"))
tab_model(m1.inf.ext.sleep)
  corr
Predictors Odds Ratios CI p
(Intercept) 0.25 0.06 – 0.97 0.046
learningCriteria [75%] 0.90 0.46 – 1.75 0.761
meanIm 14.07 2.01 – 98.68 0.008
Random Effects
σ2 3.29
τ00 participant_u_id 1.28
ICC 0.28
N participant_u_id 56
Observations 1344
Marginal R2 / Conditional R2 0.043 / 0.311
session2.ellrep.tidy %>% filter(pairType == "inference") %>% left_join(s1.im.aggr, by = c("participant"="participant")) %>% filter(participant %in% subs.normalrange$participant) %>% na.omit() %>% group_by(group.x,learningCriteria) %>% summarise(subs = n_distinct(participant_u_id))
## `summarise()` has grouped output by 'group.x'. You can override using the
## `.groups` argument.
## # A tibble: 4 x 3
## # Groups:   group.x [2]
##   group.x learningCriteria  subs
##   <chr>   <chr>            <int>
## 1 sleep   66%                 32
## 2 sleep   75%                 24
## 3 wake    66%                 31
## 4 wake    75%                 23
plot_model(m1.inf.ext,"pred", terms = c("meanIm[all]","group"))

plot_model(m1.inf.ext,"int", terms = c("group"))