require('ggpubr')
## Loading required package: ggpubr
## Warning: package 'ggpubr' was built under R version 4.3.2
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.3.2
require('emmeans')
## Loading required package: emmeans
## Warning: package 'emmeans' was built under R version 4.3.2
require('plyr')
## Loading required package: plyr
## Warning: package 'plyr' was built under R version 4.3.2
## 
## Attaching package: 'plyr'
## The following object is masked from 'package:ggpubr':
## 
##     mutate
require('dplyr')
## Loading required package: dplyr
## Warning: package 'dplyr' was built under R version 4.3.2
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
require('Rmisc')
## Loading required package: Rmisc
## Warning: package 'Rmisc' was built under R version 4.3.2
## Loading required package: lattice
require('effsize')
## Loading required package: effsize
## Warning: package 'effsize' was built under R version 4.3.2
require('reshape2')
## Loading required package: reshape2
## Warning: package 'reshape2' was built under R version 4.3.2
require('car')
## Loading required package: car
## Warning: package 'car' was built under R version 4.3.2
## Loading required package: carData
## Warning: package 'carData' was built under R version 4.3.2
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
require('rstatix')
## Loading required package: rstatix
## Warning: package 'rstatix' was built under R version 4.3.2
## 
## Attaching package: 'rstatix'
## The following objects are masked from 'package:plyr':
## 
##     desc, mutate
## The following object is masked from 'package:stats':
## 
##     filter
require('readxl')
## Loading required package: readxl
require('stats')
require('multcomp')
## Loading required package: multcomp
## Warning: package 'multcomp' was built under R version 4.3.2
## Loading required package: mvtnorm
## Warning: package 'mvtnorm' was built under R version 4.3.2
## Loading required package: survival
## Loading required package: TH.data
## Warning: package 'TH.data' was built under R version 4.3.2
## Loading required package: MASS
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:rstatix':
## 
##     select
## The following object is masked from 'package:dplyr':
## 
##     select
## 
## Attaching package: 'TH.data'
## The following object is masked from 'package:MASS':
## 
##     geyser
require('multcompView')
## Loading required package: multcompView
## Warning: package 'multcompView' was built under R version 4.3.2
require('ggplot2')

#preparing data
data <- read_excel("C:/Users/lab mazzoni 2/Downloads/Museum_Gulara/Museum_Gulara/Study 1_main data file.xlsx", 
                                     col_types = c("numeric", "numeric", "text", 
                                                   "text", "text", "numeric", "text", 
                                                   "text", "text", "numeric", "numeric", 
                                                   "numeric", "numeric", "numeric", 
                                                   "numeric", "numeric", "numeric", 
                                                   "numeric", "numeric", "numeric", 
                                                   "numeric"))

data$Condition <- as.factor(data$Condition)
data$RT <- log(data$Recog_RT)
data <- na.omit(data)
############################EXPERIMENT 1#######################################

#one way anova for accuracy

accuracy <- aov(data = data, Recog_ACC ~ Condition)
summary(accuracy)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## Condition    2  130.8   65.42   6.535 0.00309 **
## Residuals   48  480.5   10.01                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(accuracy)
## Condition 
## 0.2140191
ggboxplot(data, x = "Condition", y = "Recog_ACC", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

TUKEY <- TukeyHSD(accuracy, wich = 'data$Condition', conf.level = 0.95)
print(TUKEY)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Recog_ACC ~ Condition, data = data)
## 
## $Condition
##                            diff        lwr       upr     p adj
## 8-capture-1-capture  -3.2647059 -5.8525707 -0.676841 0.0101841
## no-capture-1-capture  0.1727941 -2.4924734  2.838062 0.9865417
## no-capture-8-capture  3.4375000  0.8083734  6.066627 0.0075149
#anova for reaction times

rt <- aov(data = data, RT ~ Condition)
summary(rt)
##             Df Sum Sq Mean Sq F value Pr(>F)
## Condition    2  0.114 0.05683   0.584  0.562
## Residuals   48  4.671 0.09732
eta_squared(rt)
##  Condition 
## 0.02375085
ggboxplot(data, x = "Condition", y = "RT", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

#anova for confidence ratings

conf <- aov(data = data, Conf_rate  ~ Condition)
summary(conf)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Condition    2   2.34   1.170   2.641 0.0816 .
## Residuals   48  21.26   0.443                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(conf)
##  Condition 
## 0.09913742
ggboxplot(data, x = "Condition", y = "Conf_rate", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

phc <- TukeyHSD(conf, which = 'Condition', conf.level = 0.95)
print(phc)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Conf_rate ~ Condition, data = data)
## 
## $Condition
##                            diff         lwr       upr     p adj
## 8-capture-1-capture  0.01088235 -0.53351672 0.5552814 0.9987123
## no-capture-1-capture 0.46713235 -0.09354961 1.0278143 0.1195264
## no-capture-8-capture 0.45625000 -0.09682914 1.0093291 0.1243669
#confidence for correct trials

confcorr <- aov(data = data, Conf_aver_corr  ~ Condition)
summary(confcorr)
##             Df Sum Sq Mean Sq F value Pr(>F)
## Condition    2  1.642  0.8212   1.825  0.172
## Residuals   48 21.603  0.4501
eta_squared(confcorr)
##  Condition 
## 0.07065596
ggboxplot(data, x = "Condition", y = "Conf_rate", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

#confidence for incorrect trials

confincor <- aov(data = data, Conf_aver_incor ~ Condition)
summary(confincor)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Condition    2   7.13   3.564   2.426 0.0991 .
## Residuals   48  70.51   1.469                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(confincor)
##  Condition 
## 0.09181125
ggboxplot(data, x = "Condition", y = "Conf_rate", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

########################EXPERIMENT 2############################################

data2 <- read_excel("C:/Users/lab mazzoni 2/Downloads/Museum_Gulara/Museum_Gulara/Study 2_main data file.xlsx")
data2 <- na.omit(data2)

data2$Condition <- as.factor(data2$Condition)
data2$RT <- log(data2$Recog_RT)

#one way anova for accuracy

accuracy2 <- aov(data = data2, Recog_ACC ~ Condition)
summary(accuracy2)
##             Df Sum Sq Mean Sq F value Pr(>F)
## Condition    2     90   44.89   0.533   0.59
## Residuals   49   4126   84.20
eta_squared(accuracy2)
##  Condition 
## 0.02129541
TUKEY2 <- TukeyHSD(accuracy2, wich = 'data2$Condition', conf.level = 0.95)
print(TUKEY2)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Recog_ACC ~ Condition, data = data2)
## 
## $Condition
##                             diff        lwr       upr     p adj
## 8-capture-1-capture  -2.79084967 -10.291538  4.709839 0.6433265
## no-capture-1-capture -0.05882353  -7.665910  7.548263 0.9998074
## no-capture-8-capture  2.73202614  -4.768663 10.232715 0.6551496
#anova for reaction times

rt2 <- aov(data = data2, RT ~ Condition)
summary(rt2)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Condition    2  0.696   0.348   3.283 0.0459 *
## Residuals   49  5.194   0.106                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(rt2)
## Condition 
## 0.1181543
ggboxplot(data2, x = "Condition", y = "RT", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

TUKEYRT <- TukeyHSD(rt2, wich = 'data2$Condition', conf.level = 0.95)
print(TUKEYRT)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = RT ~ Condition, data = data2)
## 
## $Condition
##                             diff          lwr        upr     p adj
## 8-capture-1-capture   0.27020100  0.004069802 0.53633220 0.0458808
## no-capture-1-capture  0.06798671 -0.201919584 0.33789301 0.8160075
## no-capture-8-capture -0.20221429 -0.468345484 0.06391691 0.1685053
#anova for reaction times correct and incorrect

data2$RT_aver_corr <- log(data2$RT_aver_corr)
data2$logRT_aver_incor <- log(data2$RT_aver_incor)

#correct rt
rtcorr <- aov(data = data2, RT_aver_corr ~ Condition)
summary(rtcorr)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Condition    2  0.587  0.2936   2.765 0.0728 .
## Residuals   49  5.202  0.1062                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(rtcorr)
## Condition 
## 0.1014179
corrposthoc <- TukeyHSD(rtcorr, wich = 'data2$Condition', conf.level = 0.95)
print(corrposthoc)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = RT_aver_corr ~ Condition, data = data2)
## 
## $Condition
##                             diff         lwr       upr     p adj
## 8-capture-1-capture   0.24870474 -0.01762747 0.5150369 0.0717198
## no-capture-1-capture  0.06426593 -0.20584423 0.3343761 0.8340123
## no-capture-8-capture -0.18443881 -0.45077101 0.0818934 0.2254482
#incorrect rt
incorrt <- aov(data = data2, logRT_aver_incor ~ Condition)
summary(incorrt)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Condition    2  0.703  0.3515   2.594 0.0849 .
## Residuals   49  6.639  0.1355                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(incorrt)
##  Condition 
## 0.09574576
incorrposthoc <- TukeyHSD(incorrt, wich = 'data2$Condition', conf.level = 0.95)
print(incorrposthoc)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = logRT_aver_incor ~ Condition, data = data2)
## 
## $Condition
##                              diff         lwr        upr     p adj
## 8-capture-1-capture   0.242986283 -0.05789967 0.54387223 0.1352070
## no-capture-1-capture -0.002807798 -0.30796185 0.30234625 0.9997274
## no-capture-8-capture -0.245794082 -0.54668003 0.05509187 0.1293446
#anova for confidence ratings

shapiro.test(data2$Conf_rate)
## 
##  Shapiro-Wilk normality test
## 
## data:  data2$Conf_rate
## W = 0.94736, p-value = 0.02254
conf2 <- aov(data = data2, Conf_rate  ~ Condition)
summary(conf2)
##             Df Sum Sq Mean Sq F value Pr(>F)
## Condition    2  1.202  0.6009   1.426   0.25
## Residuals   49 20.648  0.4214
eta_squared(conf2)
##  Condition 
## 0.05499815
phc <- TukeyHSD(conf, which = 'Condition', conf.level = 0.95)
print(phc)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Conf_rate ~ Condition, data = data)
## 
## $Condition
##                            diff         lwr       upr     p adj
## 8-capture-1-capture  0.01088235 -0.53351672 0.5552814 0.9987123
## no-capture-1-capture 0.46713235 -0.09354961 1.0278143 0.1195264
## no-capture-8-capture 0.45625000 -0.09682914 1.0093291 0.1243669
#confidence for correct trials

confcorr2 <- aov(data = data2, Conf_aver_corr  ~ Condition)
summary(confcorr2)
##             Df Sum Sq Mean Sq F value Pr(>F)
## Condition    2   1.45  0.7248   1.495  0.234
## Residuals   49  23.75  0.4847
eta_squared(confcorr)
##  Condition 
## 0.07065596
#confidence for incorrect trials

confincor2 <- aov(data = data2, Conf_aver_incor ~ Condition)
summary(confincor2)
##             Df Sum Sq Mean Sq F value Pr(>F)
## Condition    2   1.51  0.7531   0.479  0.623
## Residuals   49  77.10  1.5735
eta_squared(confincor2)
##  Condition 
## 0.01916038
################CROSS-EXPERIMENTAL RESULTS######################################

sdat <- data[,c('Study no', 'Condition', 'Recog_ACC', 'RT', 'Conf_rate', 'Conf_aver_incor',
                'Conf_aver_corr')]

names(sdat) <- c('Study','Condition', 'Recog_ACC', 'RT', 'Conf_rate', 'Conf_aver_incor',
                 'Conf_aver_corr')

sdata <- data2[,c('Study', 'Condition', 'Recog_ACC', 'RT', 'Conf_rate', 'Conf_aver_incor',
                  'Conf_aver_corr')]

as.data.frame(sdat)
##    Study  Condition Recog_ACC       RT Conf_rate Conf_aver_incor Conf_aver_corr
## 1      1  1-capture        34 6.914979      3.00            3.50           2.98
## 2      1  1-capture        35 7.305766      4.00            2.00           4.05
## 3      1  1-capture        28 6.813291      4.17            3.25           4.42
## 4      1  1-capture        31 7.195330      4.31            3.40           4.45
## 5      1  1-capture        30 7.171319      3.00            1.67           3.27
## 6      1  1-capture        30 7.466702      3.64            3.00           3.77
## 7      1  1-capture        35 6.856841      3.56            6.00           3.48
## 8      1  1-capture        33 7.182162      3.39            4.33           3.30
## 9      1  1-capture        34 7.148283      3.92            3.50           3.94
## 10     1  1-capture        34 6.999094      3.47            3.50           3.47
## 11     1  1-capture        32 7.209385      3.94            5.50           3.75
## 12     1  1-capture        30 6.933501      3.83            4.67           3.67
## 13     1  1-capture        35 6.778591      3.78            1.00           3.85
## 14     1  1-capture        32 7.781844      3.03            3.75           2.93
## 15     1  1-capture        33 7.065451      5.36            5.00           5.39
## 16     1  1-capture        24 7.116305      2.08            1.42           2.42
## 17     1  1-capture        30 7.087925      3.64            3.00           3.77
## 18     1  8-capture        27 7.372709      2.78            1.78           3.11
## 19     1  8-capture        31 7.190005      3.78            4.20           3.71
## 20     1  8-capture        29 7.316661      3.78            4.28           3.65
## 21     1  8-capture        20 7.955572      4.50            4.44           4.55
## 22     1  8-capture        33 7.063142      3.50            2.00           3.63
## 23     1  8-capture        32 6.635185      3.22            3.50           3.19
## 24     1  8-capture        29 6.794777      3.39            4.00           3.24
## 25     1  8-capture        30 7.179773      3.94            4.50           3.83
## 26     1  8-capture        30 6.995610      3.50            3.17           3.57
## 27     1  8-capture        29 7.894866      3.89            4.00           3.86
## 28     1  8-capture        26 7.167184      2.69            2.10           2.92
## 29     1  8-capture        32 7.029699      3.64            2.50           3.78
## 30     1  8-capture        24 7.390749      4.42            3.92           4.67
## 31     1  8-capture        27 6.981442      3.89            3.78           3.92
## 32     1  8-capture        26 7.000945      3.00            2.50           3.19
## 33     1  8-capture        24 7.778944      4.58            4.17           4.79
## 34     1  8-capture        34 7.014518      3.19            1.00           3.32
## 35     1  8-capture        30 7.022645      4.28            3.67           4.40
## 36     1 no-capture        29 6.932126      3.92            3.57           4.00
## 37     1 no-capture        28 7.745085      3.33            3.12           3.39
## 38     1 no-capture        32 7.224877      3.50            3.50           3.50
## 39     1 no-capture        24 7.341017      3.81            4.67           3.37
## 40     1 no-capture        33 6.821020      4.06            4.33           4.03
## 41     1 no-capture        34 6.940039      3.81            3.50           3.82
## 42     1 no-capture        34 7.092964      5.89            5.00           5.94
## 43     1 no-capture        34 6.848886      3.75            4.50           3.70
## 44     1 no-capture        33 7.868798      3.78            2.00           3.93
## 45     1 no-capture        32 6.875056      3.64            3.50           3.65
## 46     1 no-capture        35 6.946120      3.75            6.00           3.68
## 47     1 no-capture        33 6.792872      4.31            3.33           4.39
## 48     1 no-capture        32 7.231229      4.92            5.50           4.84
## 49     1 no-capture        34 6.996023      3.47            6.00           3.32
## 50     1 no-capture        34 7.005689      4.53            3.00           4.61
## 51     1 no-capture        30 7.014518      5.47            5.17           5.53
as.data.frame(sdata)
##    Study  Condition Recog_ACC       RT Conf_rate Conf_aver_incor Conf_aver_corr
## 1      2  1-capture        32 7.046264      4.28            4.50           4.25
## 2      2  1-capture        28 7.993593      3.94            3.00           4.21
## 3      2  1-capture        31 7.181067      4.11            4.00           4.13
## 4      2  1-capture        34 6.802606      4.56            3.00           4.65
## 5      2  1-capture        34 6.786649      3.97            2.00           4.09
## 6      2  1-capture        33 7.016457      3.67            4.33           3.61
## 7      2  1-capture        34 6.922072      4.83            3.50           4.92
## 8      2  1-capture        29 6.672071      3.42            3.43           3.42
## 9      2  1-capture        33 6.921934      4.06            4.33           4.03
## 10     2  1-capture        33 6.923412      3.92            3.00           4.00
## 11     2  1-capture        32 6.867131      3.61            4.00           3.56
## 12     2  1-capture        27 6.967598      3.92            4.89           3.59
## 13     2  1-capture         8 7.068649      3.64            4.75           3.32
## 14     2  1-capture        25 6.811828      3.22            3.00           3.32
## 15     2  1-capture         6 7.274674      3.97            5.00           3.77
## 16     2  1-capture        35 7.257059      3.58            1.00           3.66
## 17     2  1-capture         9 6.827813      3.00            4.22           2.59
## 18     2  8-capture        29 7.194670      5.06            4.86           5.10
## 19     2  8-capture        24 7.413687      3.22            2.67           3.50
## 20     2  8-capture        27 6.900449      4.11            3.67           4.26
## 21     2  8-capture        19 7.964514      3.33            3.53           3.16
## 22     2  8-capture        30 7.501789      3.31            3.67           3.23
## 23     2  8-capture        22 7.319514      4.14            4.50           3.91
## 24     2  8-capture        33 6.973000      3.78            3.00           3.85
## 25     2  8-capture        27 7.072235      3.03            2.44           3.22
## 26     2  8-capture        26 7.964639      4.19            3.70           4.38
## 27     2  8-capture        30 7.176996      3.33            4.67           3.07
## 28     2  8-capture        27 7.451143      3.36            4.22           3.07
## 29     2  8-capture        31 7.030221      3.67            3.40           3.71
## 30     2  8-capture        26 6.863605      3.11            4.20           2.69
## 31     2  8-capture         3 7.461962      3.31            3.33           3.30
## 32     2  8-capture        34 7.083925      3.67            4.50           3.62
## 33     2  8-capture        13 7.564010      2.64            2.69           2.61
## 34     2  8-capture        26 7.092524      3.83            4.30           3.65
## 35     2  8-capture        13 7.195667      2.28            2.46           2.17
## 36     2 no-capture        33 7.023064      3.69            3.00           3.76
## 37     2 no-capture        35 7.196829      3.47            6.00           3.40
## 38     2 no-capture        34 6.699094      3.33            5.00           3.23
## 39     2 no-capture        30 7.701526      5.83            6.00           5.80
## 40     2 no-capture        34 6.652682      4.47            6.00           4.38
## 41     2 no-capture        32 6.788972      3.36            1.00           3.66
## 42     2 no-capture        34 6.859552      3.39            6.00           3.23
## 43     2 no-capture        25 7.250160      3.31            3.45           3.24
## 44     2 no-capture        26 6.869970      2.78            1.70           3.19
## 45     2 no-capture        33 6.928459      3.69            3.00           3.76
## 46     2 no-capture        34 6.933852      3.50            1.00           3.65
## 47     2 no-capture        26 7.920105      4.53            4.30           4.61
## 48     2 no-capture         9 6.996581      3.28            3.33           3.26
## 49     2 no-capture        27 7.244349      3.97            3.44           4.15
## 50     2 no-capture        10 7.545902      3.06            4.00           2.69
## 51     2 no-capture        35 6.961002      5.39            6.00           5.37
## 52     2 no-capture         5 6.924553      3.69            5.00           3.48
cer <- bind_rows(sdat, sdata)
cer$Study <- as.factor(cer$Study)

#one way anova for accuracy

acc_enc <- aov(data = cer, Recog_ACC ~ Condition + Study)
summary(acc_enc)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## Condition    2    214   106.8   2.294 0.10615   
## Study        1    507   507.0  10.891 0.00134 **
## Residuals   99   4609    46.6                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(acc_enc)
##  Condition      Study 
## 0.04008473 0.09513317
ggboxplot(cer, x = "Condition", y = "Recog_ACC", color = "Study",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

TUKEYCER <- TukeyHSD(acc_enc, wich = 'Condition', conf.level = 0.95)
print(TUKEYCER)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Recog_ACC ~ Condition + Study, data = cer)
## 
## $Condition
##                             diff        lwr       upr     p adj
## 8-capture-1-capture  -3.02777778 -6.9102801 0.8547246 0.1571686
## no-capture-1-capture -0.01515152 -3.9824456 3.9521425 0.9999545
## no-capture-8-capture  3.01262626 -0.9000124 6.9252649 0.1644790
## 
## $Study
##          diff       lwr      upr     p adj
## 2-1 -4.437017 -7.105064 -1.76897 0.0013457
plot(TUKEYCER, col="#00AFBB") 

#anova for reaction times

rt_enc <- aov(data = cer, RT ~ Condition + Study)
summary(rt_enc)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Condition    2  0.669  0.3346   3.310 0.0406 *
## Study        1  0.003  0.0026   0.026 0.8719  
## Residuals   99 10.007  0.1011                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(rt_enc)
##   Condition       Study 
## 0.062668688 0.000247421
ggboxplot(cer, x = "Condition", y = "RT", color = "Study",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

rtcer <- TukeyHSD(rt_enc, wich = 'cer$Condition', conf.level = 0.95)
print(rtcer)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = RT ~ Condition + Study, data = cer)
## 
## $Condition
##                             diff           lwr        upr     p adj
## 8-capture-1-capture   0.18061267 -0.0002976329 0.36152297 0.0504757
## no-capture-1-capture  0.02651398 -0.1583472959 0.21137526 0.9378582
## no-capture-8-capture -0.15409868 -0.3364132236 0.02821586 0.1148147
## 
## $Study
##            diff      lwr       upr     p adj
## 2-1 -0.01012882 -0.13445 0.1141923 0.8719029
#anova for confidence ratings

conf_enc <- aov(data = cer, Conf_rate  ~ Condition + Study)
summary(conf_enc)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Condition    2   2.32  1.1618   2.668 0.0744 .
## Study        1   0.17  0.1697   0.390 0.5339  
## Residuals   99  43.11  0.4355                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(conf_enc)
##  Condition      Study 
## 0.05094824 0.00372051
ggboxplot(cer, x = "Condition", y = "Conf_rate", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

postcer <- TukeyHSD(conf_enc, which = 'Condition', conf.level = 0.95)
print(postcer)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Conf_rate ~ Condition + Study, data = cer)
## 
## $Condition
##                            diff         lwr       upr     p adj
## 8-capture-1-capture  -0.1666340 -0.54215478 0.2088868 0.5436498
## no-capture-1-capture  0.2005882 -0.18313372 0.5843102 0.4303998
## no-capture-8-capture  0.3672222 -0.01121339 0.7456578 0.0591759
#confidence for correct trials

confcorr <- aov(data = data, Conf_aver_corr  ~ Condition)
summary(confcorr)
##             Df Sum Sq Mean Sq F value Pr(>F)
## Condition    2  1.642  0.8212   1.825  0.172
## Residuals   48 21.603  0.4501
eta_squared(confcorr)
##  Condition 
## 0.07065596
ggboxplot(data, x = "Condition", y = "Conf_rate", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

#confidence for incorrect trials

confincor <- aov(data = data, Conf_aver_incor ~ Condition)
summary(confincor)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Condition    2   7.13   3.564   2.426 0.0991 .
## Residuals   48  70.51   1.469                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
eta_squared(confincor)
##  Condition 
## 0.09181125
ggboxplot(data, x = "Condition", y = "Conf_rate", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

#########################EXPERIMENT 3##########################################

study3 <- read_excel("C:/Users/lab mazzoni 2/Downloads/Museum_Gulara/Museum_Gulara/main data file study 3.xlsx")
study3$detail <- as.factor(study3$detail)
study3$Condition <- as.factor(study3$Condition)
study3$`Timing` <- as.factor(study3$`Recog Timing`)
study3$`Part no` <- as.factor(study3$`Part no`)
study3 <- na.omit(study3)

acc3 <- aov(acc ~ (detail*Condition*Timing) + 
              Error(`Part no`/detail) + (Condition*Timing), study3)
## Warning in aov(acc ~ (detail * Condition * Timing) + Error(`Part no`/detail) +
## : Error() model is singular
summary(acc3)
## 
## Error: Part no
##                   Df Sum Sq Mean Sq F value   Pr(>F)    
## detail             1    5.9    5.92   1.272   0.2620    
## Condition          1  225.2  225.19  48.423 3.51e-10 ***
## Timing             1   15.3   15.34   3.298   0.0723 .  
## Condition:Timing   1    1.5    1.48   0.318   0.5739    
## Residuals        101  469.7    4.65                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: `Part no`:detail
##                          Df Sum Sq Mean Sq F value   Pr(>F)    
## detail                    1 137.62  137.62  55.685 3.06e-11 ***
## detail:Condition          1   0.40    0.40   0.161    0.689    
## detail:Timing             1   0.20    0.20   0.081    0.777    
## detail:Condition:Timing   1   2.17    2.17   0.879    0.351    
## Residuals               101 249.61    2.47                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
partial_eta_squared(acc3$`Part no`)
##           detail        Condition           Timing Condition:Timing 
##      0.012439066      0.324064400      0.031619166      0.003141853
partial_eta_squared(acc3$`\`Part no\`:detail`)
##                  detail        detail:Condition           detail:Timing 
##            0.3553928375            0.0015934618            0.0007982474 
## detail:Condition:Timing 
##            0.0086241741
ggboxplot(study3, x = c("Condition"), y = "acc", color = "detail",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

posthoc <- emmeans(acc3, pairwise ~ detail | Condition) 
## Note: re-fitting model with sum-to-zero contrasts
## Warning in aov(formula = acc ~ (detail * Condition * Timing) + Error(`Part
## no`/detail) + : Error() model is singular
## NOTE: Results are based on intra-block estimates and are biased.
## NOTE: Results may be misleading due to involvement in interactions
emmip(posthoc, detail ~ Condition, CIs = TRUE, type ="response") + theme_light() + labs(x = "Group", y = "Accuracy") 
## NOTE: Results may be misleading due to involvement in interactions

emmeans(acc3, pairwise  ~  Condition)
## Note: re-fitting model with sum-to-zero contrasts
## Warning in aov(formula = acc ~ (detail * Condition * Timing) + Error(`Part
## no`/detail) + : Error() model is singular
## NOTE: Results are based on intra-block estimates and are biased.
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Condition emmean   SE  df lower.CL upper.CL
##  8-photo     13.5 0.21 101     13.1       14
##  no-photo    15.6 0.21 101     15.2       16
## 
## Results are averaged over the levels of: detail, Timing 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast               estimate    SE  df t.ratio p.value
##  (8-photo) - (no-photo)    -2.07 0.298 101  -6.946  <.0001
## 
## Results are averaged over the levels of: detail, Timing
emmeans(acc3, pairwise  ~  detail)
## Note: re-fitting model with sum-to-zero contrasts
## Warning in aov(formula = acc ~ (detail * Condition * Timing) + Error(`Part
## no`/detail) + : Error() model is singular
## NOTE: Results are based on intra-block estimates and are biased.
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  detail emmean    SE  df lower.CL upper.CL
##  nozoom   15.4 0.184 185     15.0     15.7
##  zoom     13.8 0.184 185     13.4     14.1
## 
## Results are averaged over the levels of: Condition, Timing 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast      estimate    SE  df t.ratio p.value
##  nozoom - zoom     1.62 0.217 101   7.454  <.0001
## 
## Results are averaged over the levels of: Condition, Timing
##rt analysis

study3$LogRT <- log(study3$Recog_RT)
RT3 <- aov(LogRT ~ (detail*Condition*Timing) + 
              Error(`Part no`/detail) + (Condition*Timing), study3)
## Warning in aov(LogRT ~ (detail * Condition * Timing) + Error(`Part no`/detail)
## + : Error() model is singular
summary(RT3)
## 
## Error: Part no
##                   Df Sum Sq Mean Sq F value   Pr(>F)    
## detail             1  0.007  0.0070   0.053    0.819    
## Condition          1  0.217  0.2165   1.635    0.204    
## Timing             1  2.662  2.6623  20.101 1.94e-05 ***
## Condition:Timing   1  0.037  0.0372   0.281    0.597    
## Residuals        101 13.377  0.1324                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: `Part no`:detail
##                          Df    Sum Sq   Mean Sq F value Pr(>F)
## detail                    1 7.100e-30 7.144e-30   0.722  0.398
## detail:Condition          1 6.100e-30 6.118e-30   0.618  0.434
## detail:Timing             1 5.200e-30 5.164e-30   0.522  0.472
## detail:Condition:Timing   1 3.400e-30 3.415e-30   0.345  0.558
## Residuals               101 9.995e-28 9.896e-30
partial_eta_squared(RT3$`Part no`)
##           detail        Condition           Timing Condition:Timing 
##     0.0005210538     0.0159274713     0.1659870658     0.0027765468
partial_eta_squared(RT3$`\`Part no\`:detail`)
##                  detail        detail:Condition           detail:Timing 
##             0.007097032             0.006083905             0.005139805 
## detail:Condition:Timing 
##             0.003405289
emmeans(RT3, pairwise ~ Timing)
## Note: re-fitting model with sum-to-zero contrasts
## Warning in aov(formula = LogRT ~ (detail * Condition * Timing) + Error(`Part
## no`/detail) + : Error() model is singular
## NOTE: Results are based on intra-block estimates and are biased.
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Timing   emmean     SE  df lower.CL upper.CL
##  3 sec      7.35 0.0355 101     7.28     7.43
##  infinite   7.58 0.0355 101     7.51     7.65
## 
## Results are averaged over the levels of: detail, Condition 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast         estimate     SE  df t.ratio p.value
##  3 sec - infinite   -0.226 0.0503 101  -4.497  <.0001
## 
## Results are averaged over the levels of: detail, Condition
posthocRT <- emmeans(RT3, pairwise ~ Timing)
## Note: re-fitting model with sum-to-zero contrasts
## Warning in aov(formula = LogRT ~ (detail * Condition * Timing) + Error(`Part
## no`/detail) + : Error() model is singular
## NOTE: Results are based on intra-block estimates and are biased.
## NOTE: Results may be misleading due to involvement in interactions
plot(posthocRT)

ggboxplot(study3, x = "Timing", y = "LogRT", color = "Timing",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

##confidence

conf3 <- aov(Conf_rate ~ (detail*Condition*Timing) + 
             Error(`Part no`/detail) + (Condition*Timing), study3)
## Warning in aov(Conf_rate ~ (detail * Condition * Timing) + Error(`Part
## no`/detail) + : Error() model is singular
summary(conf3)
## 
## Error: Part no
##                   Df Sum Sq Mean Sq F value   Pr(>F)    
## detail             1   0.17   0.167   0.232    0.631    
## Condition          1  18.88  18.879  26.128 1.52e-06 ***
## Timing             1   0.56   0.560   0.775    0.381    
## Condition:Timing   1   0.31   0.314   0.434    0.511    
## Residuals        101  72.98   0.723                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: `Part no`:detail
##                          Df    Sum Sq   Mean Sq F value Pr(>F)
## detail                    1 1.900e-30 1.938e-30   0.592  0.444
## detail:Condition          1 5.700e-30 5.679e-30   1.734  0.191
## detail:Timing             1 5.200e-30 5.223e-30   1.594  0.210
## detail:Condition:Timing   1 9.000e-31 9.150e-31   0.279  0.598
## Residuals               101 3.308e-28 3.276e-30
partial_eta_squared(conf3$`Part no`)
##           detail        Condition           Timing Condition:Timing 
##      0.002288295      0.205523982      0.007614700      0.004282897
partial_eta_squared(conf3$`\`Part no\`:detail`)
##                  detail        detail:Condition           detail:Timing 
##             0.005823094             0.016877269             0.015540801 
## detail:Condition:Timing 
##             0.002756780
ggboxplot(study3, x = "Condition", y = "Conf_rate", color = "Condition",
          palette = c("#00AFBB", "#E7B800", "#FC4E07"))

phc3 <- emmeans(conf3, pairwise ~ Condition)
## Note: re-fitting model with sum-to-zero contrasts
## Warning in aov(formula = Conf_rate ~ (detail * Condition * Timing) +
## Error(`Part no`/detail) + : Error() model is singular
## NOTE: Results are based on intra-block estimates and are biased.
## NOTE: Results may be misleading due to involvement in interactions
phc3
## $emmeans
##  Condition emmean     SE  df lower.CL upper.CL
##  8-photo     4.54 0.0829 101     4.38     4.71
##  no-photo    5.14 0.0829 101     4.98     5.31
## 
## Results are averaged over the levels of: detail, Timing 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast               estimate    SE  df t.ratio p.value
##  (8-photo) - (no-photo)   -0.598 0.117 101  -5.096  <.0001
## 
## Results are averaged over the levels of: detail, Timing
###confidence for correct and incorrect recognitions
#correct recognitions, confidence
conf3corr <- aov(Conf_aver_corr ~ (detail*Condition*Timing) + 
               Error(`Part no`/detail) + (Condition*Timing), study3)
## Warning in aov(Conf_aver_corr ~ (detail * Condition * Timing) + Error(`Part
## no`/detail) + : Error() model is singular
summary(conf3corr)
## 
## Error: Part no
##                   Df Sum Sq Mean Sq F value   Pr(>F)    
## detail             1   0.05   0.045   0.070    0.791    
## Condition          1  16.06  16.064  24.856 2.57e-06 ***
## Timing             1   0.17   0.174   0.269    0.605    
## Condition:Timing   1   0.23   0.229   0.354    0.553    
## Residuals        101  65.27   0.646                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: `Part no`:detail
##                          Df    Sum Sq   Mean Sq F value Pr(>F)
## detail                    1 1.650e-30 1.650e-30   0.560  0.456
## detail:Condition          1 3.950e-30 3.952e-30   1.341  0.250
## detail:Timing             1 5.760e-30 5.764e-30   1.955  0.165
## detail:Condition:Timing   1 4.300e-31 4.350e-31   0.147  0.702
## Residuals               101 2.977e-28 2.948e-30
partial_eta_squared(conf3corr$`Part no`)
##           detail        Condition           Timing Condition:Timing 
##     0.0006965424     0.1974941033     0.0026534772     0.0034969627
partial_eta_squared(conf3corr$`\`Part no\`:detail`)
##                  detail        detail:Condition           detail:Timing 
##             0.005510702             0.013101720             0.018991902 
## detail:Condition:Timing 
##             0.001457697
phc3corr <- emmeans(conf3corr, pairwise ~ Condition)
## Note: re-fitting model with sum-to-zero contrasts
## Warning in aov(formula = Conf_aver_corr ~ (detail * Condition * Timing) + :
## Error() model is singular
## NOTE: Results are based on intra-block estimates and are biased.
## NOTE: Results may be misleading due to involvement in interactions
phc3corr
## $emmeans
##  Condition emmean     SE  df lower.CL upper.CL
##  8-photo     4.73 0.0784 101     4.58     4.89
##  no-photo    5.28 0.0784 101     5.13     5.44
## 
## Results are averaged over the levels of: detail, Timing 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast               estimate    SE  df t.ratio p.value
##  (8-photo) - (no-photo)   -0.552 0.111 101  -4.974  <.0001
## 
## Results are averaged over the levels of: detail, Timing
#incorrect recognitions, confidence

conf3incor <- aov(Conf_aver_incor ~ (detail*Condition*Timing) + 
                   Error(`Part no`/detail) + (Condition*Timing), study3)
## Warning in aov(Conf_aver_incor ~ (detail * Condition * Timing) + Error(`Part
## no`/detail) + : Error() model is singular
summary(conf3incor)
## 
## Error: Part no
##                   Df Sum Sq Mean Sq F value Pr(>F)
## detail             1   3.92   3.924   2.251  0.137
## Condition          1   3.38   3.384   1.941  0.167
## Timing             1   1.30   1.298   0.745  0.390
## Condition:Timing   1   0.16   0.160   0.092  0.763
## Residuals        101 176.06   1.743               
## 
## Error: `Part no`:detail
##                          Df    Sum Sq   Mean Sq F value Pr(>F)
## detail                    1 2.300e-30 2.314e-30   0.286  0.594
## detail:Condition          1 2.000e-31 1.920e-31   0.024  0.878
## detail:Timing             1 2.140e-29 2.135e-29   2.636  0.108
## detail:Condition:Timing   1 4.500e-30 4.488e-30   0.554  0.458
## Residuals               101 8.183e-28 8.102e-30
partial_eta_squared(conf3incor$`Part no`)
##           detail        Condition           Timing Condition:Timing 
##     0.0218000354     0.0188582606     0.0073197717     0.0009051693
partial_eta_squared(conf3incor$`\`Part no\`:detail`)
##                  detail        detail:Condition           detail:Timing 
##            0.0028197321            0.0002346517            0.0254315543 
## detail:Condition:Timing 
##            0.0054545517
phc3incor <- emmeans(conf3incor, pairwise ~ Condition)
## Note: re-fitting model with sum-to-zero contrasts
## Warning in aov(formula = Conf_aver_incor ~ (detail * Condition * Timing) + :
## Error() model is singular
## NOTE: Results are based on intra-block estimates and are biased.
## NOTE: Results may be misleading due to involvement in interactions
phc3incor
## $emmeans
##  Condition emmean    SE  df lower.CL upper.CL
##  8-photo     3.90 0.129 101     3.64     4.15
##  no-photo    4.15 0.129 101     3.89     4.41
## 
## Results are averaged over the levels of: detail, Timing 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast               estimate    SE  df t.ratio p.value
##  (8-photo) - (no-photo)   -0.252 0.182 101  -1.382  0.1701
## 
## Results are averaged over the levels of: detail, Timing