read in new data:
library(lme4)
library(lmerTest)
library(readr)
library(sjPlot)
library(sjstats)
jf_neg_items <- read_csv("C:/Users/dasil/Dropbox/SCnegimages/Analysis_filesupdated/jf_neg_items.csv")
Parsed with column specification:
cols(
subject_ID = col_character(),
Image_number = col_integer(),
emotion = col_character(),
condition = col_character(),
remembered = col_integer(),
jf = col_integer(),
variable = col_character(),
valence = col_double()
)
jf_neg_items <- within(jf_neg_items, {
Image_number <- factor(Image_number)
subject_ID <- factor(subject_ID)
variable <- as.factor(variable)
emotion <- as.factor(emotion)
condition <- as.factor(condition)
})
negVall<-c(1,-.5,-.5)
contrasts(jf_neg_items$emotion) <- cbind(negVall)
socvnsoc<-c(-.5,.5)
contrasts(jf_neg_items$condition) <- cbind(socvnsoc)
read in old data:
recall_lmer_longform <- read_delim("C:/Users/dasil/Dropbox/SCnegimages/Analysis_filesupdated/recall_lmer_longform.txt", "\t", escape_double = FALSE, trim_ws = TRUE)
Parsed with column specification:
cols(
subID = col_integer(),
JF = col_integer(),
variable = col_character(),
value = col_integer(),
sociality = col_character(),
valence = col_character()
)
recall_lmer_longform <- within(recall_lmer_longform, {
SubID <- factor(subID)
variable <- as.factor(variable)
sociality <- as.factor(sociality)
valence <- as.factor(valence)
})
negVall.old<-c(1,-.5,-.5)
contrasts(recall_lmer_longform$valence) <- cbind(negVall.old)
socvnsoc.old<-c(-.5,.5)
contrasts(recall_lmer_longform$sociality) <- cbind(socvnsoc.old)
model old data and note differences between gaussian and binomial models:
m.old<-lmer(value~sociality*valence*scale(JF)+(1|subID),data=recall_lmer_longform) ###orignal model
summary(m.old)
Linear mixed model fit by REML
t-tests use Satterthwaite approximations to degrees of freedom ['lmerMod']
Formula: value ~ sociality * valence * scale(JF) + (1 | subID)
Data: recall_lmer_longform
REML criterion at convergence: 1391.6
Scaled residuals:
Min 1Q Median 3Q Max
-2.36257 -0.70489 -0.01487 0.65663 2.53505
Random effects:
Groups Name Variance Std.Dev.
subID (Intercept) 0.3196 0.5654
Residual 1.4033 1.1846
Number of obs: 414, groups: subID, 69
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 2.417874 0.089566 67.000000 26.996 < 2e-16 ***
socialitysocvnsoc.old 0.140097 0.116440 335.000000 1.203 0.22976
valencenegVall.old 0.835749 0.082336 335.000000 10.151 < 2e-16 ***
valence 0.481652 0.100840 335.000000 4.776 2.67e-06 ***
scale(JF) -0.165847 0.089674 67.000000 -1.849 0.06881 .
socialitysocvnsoc.old:valencenegVall.old 0.280193 0.164671 335.000000 1.702 0.08977 .
socialitysocvnsoc.old:valence -0.348429 0.201680 335.000000 -1.728 0.08498 .
socialitysocvnsoc.old:scale(JF) -0.004539 0.116581 335.000000 -0.039 0.96897
valencenegVall.old:scale(JF) -0.230182 0.082435 335.000000 -2.792 0.00553 **
valence:scale(JF) -0.116918 0.100962 335.000000 -1.158 0.24767
socialitysocvnsoc.old:valencenegVall.old:scale(JF) -0.235839 0.164870 335.000000 -1.430 0.15352
socialitysocvnsoc.old:valence:scale(JF) -0.067110 0.201924 335.000000 -0.332 0.73983
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) sclty. vlncV. valenc sc(JF) sc.:V. sclt.: s.:(JF vV.:(J v:(JF) s.:V.:
scltyscvns. 0.000
vlncngVll.l 0.000 0.000
valence 0.000 0.000 0.000
scale(JF) 0.000 0.000 0.000 0.000
scltysc.:V. 0.000 0.000 0.000 0.000 0.000
scltyscvn.: 0.000 0.000 0.000 0.000 0.000 0.000
sclty.:(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000
vlncV.:(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
vlnc:sc(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
sc.:V.:(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
sclt.::(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
hist(recall_lmer_longform$value)
recall_lmer_longform$weight<-rep(8,414) ###create weights in denominator
recall_lmer_longform$prop<-recall_lmer_longform$value/recall_lmer_longform$weight #create proportion correct
m.old.g<-glmer(prop~sociality*valence*scale(JF)+(1|subID),weights=weight,family=binomial,data=recall_lmer_longform)#### from .007 to .03
summary(m.old.g)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: prop ~ sociality * valence * scale(JF) + (1 | subID)
Data: recall_lmer_longform
Weights: weight
AIC BIC logLik deviance df.resid
1376.4 1428.8 -675.2 1350.4 401
Scaled residuals:
Min 1Q Median 3Q Max
-2.05701 -0.65750 -0.01028 0.59786 2.56132
Random effects:
Groups Name Variance Std.Dev.
subID (Intercept) 0.103 0.3209
Number of obs: 414, groups: subID, 69
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.89054 0.05552 -16.039 < 2e-16 ***
socialitysocvnsoc.old 0.08664 0.07891 1.098 0.2722
valencenegVall.old 0.49923 0.05354 9.324 < 2e-16 ***
valence 0.33071 0.07112 4.650 3.31e-06 ***
scale(JF) -0.09065 0.05541 -1.636 0.1018
socialitysocvnsoc.old:valencenegVall.old 0.13489 0.10690 1.262 0.2070
socialitysocvnsoc.old:valence -0.24088 0.14219 -1.694 0.0902 .
socialitysocvnsoc.old:scale(JF) 0.01323 0.07913 0.167 0.8672
valencenegVall.old:scale(JF) -0.11965 0.05353 -2.235 0.0254 *
valence:scale(JF) -0.07344 0.07142 -1.028 0.3038
socialitysocvnsoc.old:valencenegVall.old:scale(JF) -0.13381 0.10699 -1.251 0.2110
socialitysocvnsoc.old:valence:scale(JF) -0.06328 0.14282 -0.443 0.6577
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) sclty. vlncV. valenc sc(JF) sc.:V. sclt.: s.:(JF vV.:(J v:(JF) s.:V.:
scltyscvns. -0.012
vlncngVll.l -0.092 0.003
valence -0.071 0.036 0.072
scale(JF) 0.010 -0.011 0.005 0.011
scltysc.:V. 0.001 -0.122 -0.014 -0.026 0.007
scltyscvn.: 0.027 -0.096 -0.027 -0.017 0.011 0.071
sclty.:(JF) -0.011 0.015 0.010 0.015 -0.005 0.008 0.016
vlncV.:(JF) 0.007 0.010 0.021 -0.013 -0.092 -0.010 -0.011 -0.001
vlnc:sc(JF) 0.012 0.015 -0.013 0.009 -0.077 -0.011 -0.021 0.028 0.080
sc.:V.:(JF) 0.008 0.008 -0.010 -0.011 -0.001 0.022 -0.012 -0.127 -0.007 -0.021
sclt.::(JF) 0.011 0.016 -0.011 -0.021 0.020 -0.012 0.009 -0.107 -0.021 -0.005 0.079
analyze with item level effects:
m.0<-glmer(remembered~condition*emotion*scale(jf)+(1|subject_ID),family=binomial,data=jf_neg_items) ### should be same as old glm model if RA's did things correctly...looks like there is one error
summary(m.0)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: remembered ~ condition * emotion * scale(jf) + (1 | subject_ID)
Data: jf_neg_items
AIC BIC logLik deviance df.resid
3940.9 4020.3 -1957.4 3914.9 3299
Scaled residuals:
Min 1Q Median 3Q Max
-1.3380 -0.6654 -0.5238 1.1222 2.5394
Random effects:
Groups Name Variance Std.Dev.
subject_ID (Intercept) 0.102 0.3194
Number of obs: 3312, groups: subject_ID, 69
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.885986 0.055563 -15.946 < 2e-16 ***
conditionsocvnsoc 0.093665 0.078853 1.188 0.235
emotionnegVall 0.494639 0.053518 9.243 < 2e-16 ***
emotion 0.333892 0.071052 4.699 2.61e-06 ***
scale(jf) -0.087140 0.055192 -1.579 0.114
conditionsocvnsoc:emotionnegVall 0.121382 0.106858 1.136 0.256
conditionsocvnsoc:emotion -0.221898 0.142057 -1.562 0.118
conditionsocvnsoc:scale(jf) 0.009905 0.078960 0.125 0.900
emotionnegVall:scale(jf) -0.120594 0.053426 -2.257 0.024 *
emotion:scale(jf) -0.067743 0.071259 -0.951 0.342
conditionsocvnsoc:emotionnegVall:scale(jf) -0.106549 0.106784 -0.998 0.318
conditionsocvnsoc:emotion:scale(jf) -0.032815 0.142493 -0.230 0.818
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) cndtns emtnnV emotin scl(j) cndt:V cndtn: cnd:() emV:() emt:() c:V:()
cndtnscvnsc -0.013
emotinngVll -0.091 0.004
emotion -0.071 0.034 0.073
scale(jf) 0.009 -0.009 0.006 0.011
cndtnscvn:V 0.002 -0.121 -0.016 -0.025 0.005
cndtnscvns: 0.025 -0.097 -0.026 -0.019 0.007 0.071
cndtnscv:() -0.009 0.014 0.007 0.009 -0.008 0.009 0.016
emtnngVl:() 0.008 0.007 0.021 -0.012 -0.092 -0.009 -0.007 0.002
emtn:scl(j) 0.012 0.009 -0.012 0.007 -0.077 -0.007 -0.015 0.029 0.080
cndtns:V:() 0.005 0.009 -0.009 -0.007 0.001 0.022 -0.012 -0.127 -0.010 -0.022
cndtnsc::() 0.007 0.016 -0.007 -0.015 0.021 -0.012 0.007 -0.107 -0.022 -0.011 0.079
m.0_1<-glmer(remembered~condition*emotion*scale(jf)+(1|subject_ID)+(1|Image_number),family=binomial,data=jf_neg_items)
summary(m.0_1)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: remembered ~ condition * emotion * scale(jf) + (1 | subject_ID) + (1 | Image_number)
Data: jf_neg_items
AIC BIC logLik deviance df.resid
3840.6 3926.1 -1906.3 3812.6 3298
Scaled residuals:
Min 1Q Median 3Q Max
-1.9479 -0.6450 -0.4804 0.9186 3.4715
Random effects:
Groups Name Variance Std.Dev.
subject_ID (Intercept) 0.1218 0.3490
Image_number (Intercept) 0.2826 0.5316
Number of obs: 3312, groups: subject_ID, 69; Image_number, 48
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.935572 0.097054 -9.640 < 2e-16 ***
conditionsocvnsoc 0.056794 0.174015 0.326 0.7441
emotionnegVall 0.524167 0.121959 4.298 1.72e-05 ***
emotion 0.328165 0.152030 2.159 0.0309 *
scale(jf) -0.093306 0.058388 -1.598 0.1100
conditionsocvnsoc:emotionnegVall 0.173807 0.243798 0.713 0.4759
conditionsocvnsoc:emotion -0.239105 0.304037 -0.786 0.4316
conditionsocvnsoc:scale(jf) 0.007557 0.080829 0.093 0.9255
emotionnegVall:scale(jf) -0.129594 0.054965 -2.358 0.0184 *
emotion:scale(jf) -0.071803 0.072646 -0.988 0.3230
conditionsocvnsoc:emotionnegVall:scale(jf) -0.112950 0.109845 -1.028 0.3038
conditionsocvnsoc:emotion:scale(jf) -0.036999 0.145260 -0.255 0.7989
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) cndtns emtnnV emotin scl(j) cndt:V cndtn: cnd:() emV:() emt:() c:V:()
cndtnscvnsc 0.005
emotinngVll -0.027 -0.005
emotion -0.017 0.009 0.013
scale(jf) 0.006 -0.003 0.002 0.005
cndtnscvn:V -0.005 -0.027 0.002 -0.006 0.002
cndtnscvns: 0.008 -0.018 -0.006 0.006 0.003 0.013
cndtnscv:() -0.005 0.007 0.003 0.005 0.005 0.004 0.008
emtnngVl:() 0.006 0.003 0.009 -0.006 -0.079 -0.004 -0.003 -0.009
emtn:scl(j) 0.007 0.005 -0.006 0.003 -0.062 -0.003 -0.007 0.033 0.066
cndtns:V:() 0.003 0.005 -0.004 -0.003 -0.006 0.010 -0.006 -0.113 0.002 -0.024
cndtnsc::() 0.004 0.008 -0.003 -0.007 0.023 -0.005 0.003 -0.089 -0.024 0.012 0.066
anova(m.0,m.0_1) ###102.26 reduction in model deviance w/ inclusion of item effects
Data: jf_neg_items
Models:
m.0: remembered ~ condition * emotion * scale(jf) + (1 | subject_ID)
m.0_1: remembered ~ condition * emotion * scale(jf) + (1 | subject_ID) +
m.0_1: (1 | Image_number)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
m.0 13 3940.9 4020.3 -1957.5 3914.9
m.0_1 14 3840.6 3926.1 -1906.3 3812.6 102.26 1 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
sjp.glmer(m.0_1,type ="re",sort.est = "sort.all",facet.grid=FALSE)
read in recognition data:
jf_neg_items_recog <- read_csv("C:/Users/dasil/Dropbox/SCnegimages/Analysis_filesupdated/jf_neg_items_recog.csv")
Parsed with column specification:
cols(
Subject = col_integer(),
Trial = col_integer(),
CorrectAnswer = col_character(),
ImageDisplay1.RESP = col_character(),
ImageDisplay1.RT = col_integer(),
Stim = col_character(),
confidence2.RESP = col_character(),
confidence2.RT = col_integer(),
jf = col_integer(),
Image = col_character(),
response = col_integer(),
emotion = col_character(),
condition = col_character()
)
jf_neg_items_recog <- within(jf_neg_items_recog, {
Subject <- factor(Subject)
Stim <- factor(Stim)
Image <- as.factor(Image)
emotion <- as.factor(emotion)
condition <- as.factor(condition)
})
jf_neg_items_recog$recip.rt.image<-1/(jf_neg_items_recog$ImageDisplay1.RT)
jf_neg_items_recog$recip.rt.image.flipped<--1*(jf_neg_items_recog$recip.rt.image)
jf_neg_items_recog$rt.recipe.cat<-ifelse(jf_neg_items_recog$recip.rt.image.flipped>=-.000682827,"slow","fast")
jf_neg_items_recog$conf<-ifelse(jf_neg_items_recog$confidence2.RESP=="z",1,0)
jf_neg_items_recog$jf_cat<-ifelse(jf_neg_items_recog$jf>=119,"highse","lowse")
jf_neg_items_recog$log.rt.image<-log(jf_neg_items_recog$ImageDisplay1.RT)
negVall<-c(1,-.5,-.5) ######negative vs neutral as seen in the second orthogonal con
contrasts(jf_neg_items_recog$emotion) <- cbind(negVall)
socvnsoc<-c(-.5,.5)
contrasts(jf_neg_items_recog$condition) <- cbind(socvnsoc)
analyze recog data without and with random item level intercepts:
m.1.recog<-glmer(response~scale(jf)*emotion*condition*+(1|Subject),data = jf_neg_items_recog,family=binomial,control=glmerControl(optimizer="bobyqa"))
summary(m.1.recog)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: response ~ scale(jf) * emotion * condition * +(1 | Subject)
Data: jf_neg_items_recog
Control: glmerControl(optimizer = "bobyqa")
AIC BIC logLik deviance df.resid
4315.8 4404.2 -2144.9 4289.8 6611
Scaled residuals:
Min 1Q Median 3Q Max
-6.5026 0.2158 0.2904 0.3762 0.7449
Random effects:
Groups Name Variance Std.Dev.
Subject (Intercept) 0.5125 0.7159
Number of obs: 6624, groups: Subject, 69
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.34044 0.09895 23.654 < 2e-16 ***
scale(jf) -0.01436 0.09709 -0.148 0.882423
emotionnegVall 0.16817 0.06012 2.797 0.005154 **
emotion 0.16480 0.06900 2.388 0.016929 *
conditionsocvnsoc -0.13435 0.08239 -1.631 0.102969
scale(jf):emotionnegVall -0.07977 0.06050 -1.319 0.187324
scale(jf):emotion -0.03269 0.06794 -0.481 0.630428
scale(jf):conditionsocvnsoc -0.07311 0.08208 -0.891 0.373050
emotionnegVall:conditionsocvnsoc 0.44846 0.12025 3.729 0.000192 ***
emotion:conditionsocvnsoc -0.16134 0.13800 -1.169 0.242347
scale(jf):emotionnegVall:conditionsocvnsoc -0.09417 0.12095 -0.779 0.436222
scale(jf):emotion:conditionsocvnsoc -0.14773 0.13592 -1.087 0.277088
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) scl(j) emtnnV emotin cndtns sc():V scl(jf):m scl(jf):c emtnV: emtn:c s():V:
scale(jf) 0.010
emotinngVll 0.040 -0.025
emotion 0.032 -0.004 -0.049
cndtnscvnsc -0.016 -0.017 0.122 -0.043
scl(jf):mtV -0.024 0.051 -0.081 0.007 -0.042
scl(jf):mtn -0.004 0.033 0.007 -0.001 -0.027 -0.050
scl(jf):cnd -0.017 -0.006 -0.042 -0.026 -0.044 0.139 -0.025
emtnngVll:c 0.055 -0.017 0.054 0.029 0.089 -0.064 0.018 -0.059
emtn:cndtns -0.019 -0.012 0.029 -0.130 0.072 0.018 -0.009 -0.010 -0.049
scl(jf):mV: -0.016 0.060 -0.064 0.018 -0.059 0.086 0.018 0.117 -0.081 0.006
scl(jf):mt: -0.012 -0.012 0.018 -0.009 -0.010 0.018 -0.122 0.076 0.007 -0.001 -0.050
m.1.recog_1<-glmer(response~scale(jf)*emotion*condition*+(1|Subject)+(1|Stim),data = jf_neg_items_recog,family=binomial,control=glmerControl(optimizer="bobyqa"))
summary(m.1.recog_1)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: response ~ scale(jf) * emotion * condition * +(1 | Subject) + (1 | Stim)
Data: jf_neg_items_recog
Control: glmerControl(optimizer = "bobyqa")
AIC BIC logLik deviance df.resid
4207.2 4302.4 -2089.6 4179.2 6610
Scaled residuals:
Min 1Q Median 3Q Max
-7.2104 0.1850 0.2661 0.3639 1.1046
Random effects:
Groups Name Variance Std.Dev.
Stim (Intercept) 0.4233 0.6506
Subject (Intercept) 0.5622 0.7498
Number of obs: 6624, groups: Stim, 96; Subject, 69
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.50290 0.12442 20.117 <2e-16 ***
scale(jf) -0.01520 0.10080 -0.151 0.8801
emotionnegVall 0.18100 0.11371 1.592 0.1115
emotion 0.15733 0.13653 1.152 0.2492
conditionsocvnsoc -0.15515 0.15928 -0.974 0.3300
scale(jf):emotionnegVall -0.08286 0.06085 -1.362 0.1733
scale(jf):emotion -0.03360 0.06853 -0.490 0.6240
scale(jf):conditionsocvnsoc -0.07484 0.08266 -0.905 0.3653
emotionnegVall:conditionsocvnsoc 0.44081 0.22742 1.938 0.0526 .
emotion:conditionsocvnsoc -0.18283 0.27305 -0.670 0.5031
scale(jf):emotionnegVall:conditionsocvnsoc -0.09474 0.12165 -0.779 0.4361
scale(jf):emotion:conditionsocvnsoc -0.15365 0.13710 -1.121 0.2624
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) scl(j) emtnnV emotin cndtns sc():V scl(jf):m scl(jf):c emtnV: emtn:c s():V:
scale(jf) 0.007
emotinngVll 0.021 -0.013
emotion 0.012 -0.002 -0.012
cndtnscvnsc -0.013 -0.009 0.033 -0.013
scl(jf):mtV -0.020 0.047 -0.042 0.003 -0.021
scl(jf):mtn -0.003 0.030 0.004 0.000 -0.014 -0.046
scl(jf):cnd -0.014 -0.006 -0.021 -0.013 -0.022 0.127 -0.027
emtnngVll:c 0.024 -0.008 0.011 0.009 0.027 -0.033 0.010 -0.031
emtn:cndtns -0.009 -0.006 0.009 -0.037 0.018 0.009 -0.005 -0.005 -0.012
scl(jf):mV: -0.012 0.054 -0.033 0.009 -0.030 0.077 0.019 0.113 -0.042 0.003
scl(jf):mt: -0.011 -0.012 0.010 -0.005 -0.005 0.019 -0.113 0.069 0.003 0.000 -0.046
anova(m.1.recog,m.1.recog_1) #item intercepts reduce deviance by over 110
Data: jf_neg_items_recog
Models:
m.1.recog: response ~ scale(jf) * emotion * condition * +(1 | Subject)
m.1.recog_1: response ~ scale(jf) * emotion * condition * +(1 | Subject) +
m.1.recog_1: (1 | Stim)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
m.1.recog 13 4315.8 4404.2 -2144.9 4289.8
m.1.recog_1 14 4207.2 4302.4 -2089.6 4179.2 110.59 1 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Now, add in RT as a fixed effect to identify identify individual participants for whom (a) faster responses are more accurate, (b) less accurate, or (c) there is no difference
m.1.recog_2<-glmer(response~scale(jf)*emotion*condition*scale(recip.rt.image.flipped)+(1|Subject)+(1|Stim),data = jf_neg_items_recog,family=binomial,control=glmerControl(optimizer="bobyqa"))
summary(m.1.recog_2)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: response ~ scale(jf) * emotion * condition * scale(recip.rt.image.flipped) + (1 | Subject) + (1 | Stim)
Data: jf_neg_items_recog
Control: glmerControl(optimizer = "bobyqa")
AIC BIC logLik deviance df.resid
4061.5 4238.3 -2004.8 4009.5 6598
Scaled residuals:
Min 1Q Median 3Q Max
-6.8187 0.1506 0.2390 0.3565 1.7984
Random effects:
Groups Name Variance Std.Dev.
Stim (Intercept) 0.5278 0.7265
Subject (Intercept) 0.6811 0.8253
Number of obs: 6624, groups: Stim, 96; Subject, 69
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.677536 0.138315 19.358 <2e-16 ***
scale(jf) -0.030506 0.112285 -0.272 0.7859
emotionnegVall 0.316123 0.130237 2.427 0.0152 *
emotion 0.129782 0.150545 0.862 0.3886
conditionsocvnsoc 0.059192 0.179138 0.330 0.7411
scale(recip.rt.image.flipped) -0.685021 0.055557 -12.330 <2e-16 ***
scale(jf):emotionnegVall -0.181273 0.076406 -2.372 0.0177 *
scale(jf):emotion -0.016076 0.072627 -0.221 0.8248
scale(jf):conditionsocvnsoc -0.150252 0.096656 -1.555 0.1201
emotionnegVall:conditionsocvnsoc 0.559581 0.260383 2.149 0.0316 *
emotion:conditionsocvnsoc -0.204422 0.301094 -0.679 0.4972
scale(jf):scale(recip.rt.image.flipped) 0.101063 0.052495 1.925 0.0542 .
emotionnegVall:scale(recip.rt.image.flipped) -0.140145 0.074434 -1.883 0.0597 .
emotion:scale(recip.rt.image.flipped) 0.076784 0.077325 0.993 0.3207
conditionsocvnsoc:scale(recip.rt.image.flipped) -0.190571 0.097768 -1.949 0.0513 .
scale(jf):emotionnegVall:conditionsocvnsoc -0.209048 0.152123 -1.374 0.1694
scale(jf):emotion:conditionsocvnsoc -0.223285 0.145342 -1.536 0.1245
scale(jf):emotionnegVall:scale(recip.rt.image.flipped) 0.154832 0.073002 2.121 0.0339 *
scale(jf):emotion:scale(recip.rt.image.flipped) 0.002479 0.073316 0.034 0.9730
scale(jf):conditionsocvnsoc:scale(recip.rt.image.flipped) 0.059212 0.094441 0.627 0.5307
emotionnegVall:conditionsocvnsoc:scale(recip.rt.image.flipped) -0.143862 0.148667 -0.968 0.3332
emotion:conditionsocvnsoc:scale(recip.rt.image.flipped) 0.054087 0.154822 0.349 0.7268
scale(jf):emotionnegVall:conditionsocvnsoc:scale(recip.rt.image.flipped) 0.082134 0.145373 0.565 0.5721
scale(jf):emotion:conditionsocvnsoc:scale(recip.rt.image.flipped) 0.140436 0.146656 0.958 0.3383
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 24 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
anova(m.1.recog_1,m.1.recog_2) #adding so many dfs, but huge reduction in deviance
Data: jf_neg_items_recog
Models:
m.1.recog_1: response ~ scale(jf) * emotion * condition * +(1 | Subject) +
m.1.recog_1: (1 | Stim)
m.1.recog_2: response ~ scale(jf) * emotion * condition * scale(recip.rt.image.flipped) +
m.1.recog_2: (1 | Subject) + (1 | Stim)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
m.1.recog_1 14 4207.2 4302.4 -2089.6 4179.2
m.1.recog_2 26 4061.5 4238.3 -2004.8 4009.5 169.72 12 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
m.1.recog_3<-glmer(response~scale(jf)*emotion*condition*scale(recip.rt.image.flipped)+(1+scale(recip.rt.image.flipped)|Subject)+(1|Stim),data = jf_neg_items_recog,family=binomial,control=glmerControl(optimizer="bobyqa"))
summary(m.1.recog_3)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: response ~ scale(jf) * emotion * condition * scale(recip.rt.image.flipped) +
(1 + scale(recip.rt.image.flipped) | Subject) + (1 | Stim)
Data: jf_neg_items_recog
Control: glmerControl(optimizer = "bobyqa")
AIC BIC logLik deviance df.resid
4057.6 4247.9 -2000.8 4001.6 6596
Scaled residuals:
Min 1Q Median 3Q Max
-7.1517 0.1448 0.2355 0.3595 1.7526
Random effects:
Groups Name Variance Std.Dev. Corr
Stim (Intercept) 0.53003 0.7280
Subject (Intercept) 0.76963 0.8773
scale(recip.rt.image.flipped) 0.07543 0.2747 -0.47
Number of obs: 6624, groups: Stim, 96; Subject, 69
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.741602 0.146217 18.750 <2e-16 ***
scale(jf) -0.025094 0.119457 -0.210 0.8336
emotionnegVall 0.316560 0.130162 2.432 0.0150 *
emotion 0.131123 0.150671 0.870 0.3842
conditionsocvnsoc 0.057913 0.179139 0.323 0.7465
scale(recip.rt.image.flipped) -0.762957 0.074647 -10.221 <2e-16 ***
scale(jf):emotionnegVall -0.176205 0.075743 -2.326 0.0200 *
scale(jf):emotion -0.025448 0.072540 -0.351 0.7257
scale(jf):conditionsocvnsoc -0.148985 0.096000 -1.552 0.1207
emotionnegVall:conditionsocvnsoc 0.560536 0.260211 2.154 0.0312 *
emotion:conditionsocvnsoc -0.203952 0.301343 -0.677 0.4985
scale(jf):scale(recip.rt.image.flipped) 0.094880 0.064946 1.461 0.1440
emotionnegVall:scale(recip.rt.image.flipped) -0.136700 0.073584 -1.858 0.0632 .
emotion:scale(recip.rt.image.flipped) 0.071875 0.076428 0.940 0.3470
conditionsocvnsoc:scale(recip.rt.image.flipped) -0.178759 0.096787 -1.847 0.0648 .
scale(jf):emotionnegVall:conditionsocvnsoc -0.203077 0.150625 -1.348 0.1776
scale(jf):emotion:conditionsocvnsoc -0.217173 0.145096 -1.497 0.1345
scale(jf):emotionnegVall:scale(recip.rt.image.flipped) 0.146750 0.072098 2.035 0.0418 *
scale(jf):emotion:scale(recip.rt.image.flipped) 0.000338 0.072454 0.005 0.9963
scale(jf):conditionsocvnsoc:scale(recip.rt.image.flipped) 0.056669 0.093175 0.608 0.5431
emotionnegVall:conditionsocvnsoc:scale(recip.rt.image.flipped) -0.136478 0.146824 -0.930 0.3526
emotion:conditionsocvnsoc:scale(recip.rt.image.flipped) 0.063416 0.152989 0.415 0.6785
scale(jf):emotionnegVall:conditionsocvnsoc:scale(recip.rt.image.flipped) 0.075843 0.143168 0.530 0.5963
scale(jf):emotion:conditionsocvnsoc:scale(recip.rt.image.flipped) 0.134822 0.144799 0.931 0.3518
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 24 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
anova(m.1.recog_2,m.1.recog_3)##modest reduction
Data: jf_neg_items_recog
Models:
m.1.recog_2: response ~ scale(jf) * emotion * condition * scale(recip.rt.image.flipped) +
m.1.recog_2: (1 | Subject) + (1 | Stim)
m.1.recog_3: response ~ scale(jf) * emotion * condition * scale(recip.rt.image.flipped) +
m.1.recog_3: (1 + scale(recip.rt.image.flipped) | Subject) + (1 | Stim)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
m.1.recog_2 26 4061.5 4238.3 -2004.8 4009.5
m.1.recog_3 28 4057.6 4247.9 -2000.8 4001.6 7.9346 2 0.01892 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
sjp.glmer(m.1.recog_3,type ="re",sort.est = "sort.all",facet.grid=FALSE)
model confidence as a function of rt to the image itself:
m1.conf<-glmer(conf~scale(jf)*scale(recip.rt.image.flipped)*emotion*condition+(1+scale(recip.rt.image.flipped)|Subject)+(1|Stim),data = jf_neg_items_recog,family=binomial,control=glmerControl(optimizer="bobyqa"))
summary(m1.conf)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: conf ~ scale(jf) * scale(recip.rt.image.flipped) * emotion *
condition + (1 + scale(recip.rt.image.flipped) | Subject) + (1 | Stim)
Data: jf_neg_items_recog
Control: glmerControl(optimizer = "bobyqa")
AIC BIC logLik deviance df.resid
4684.5 4874.8 -2314.2 4628.5 6596
Scaled residuals:
Min 1Q Median 3Q Max
-10.9574 0.0432 0.1826 0.4179 2.4970
Random effects:
Groups Name Variance Std.Dev. Corr
Stim (Intercept) 0.5136 0.7166
Subject (Intercept) 1.5835 1.2584
scale(recip.rt.image.flipped) 0.4886 0.6990 -0.91
Number of obs: 6624, groups: Stim, 96; Subject, 69
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.770406 0.187490 14.776 < 2e-16 ***
scale(jf) -0.007109 0.167122 -0.043 0.96607
scale(recip.rt.image.flipped) -1.833194 0.114360 -16.030 < 2e-16 ***
emotionnegVall 0.377194 0.127196 2.965 0.00302 **
emotion 0.200796 0.149962 1.339 0.18058
conditionsocvnsoc 0.077416 0.176573 0.438 0.66107
scale(jf):scale(recip.rt.image.flipped) 0.086138 0.107575 0.801 0.42329
scale(jf):emotionnegVall -0.060759 0.072389 -0.839 0.40127
scale(jf):emotion 0.104711 0.078845 1.328 0.18416
scale(recip.rt.image.flipped):emotionnegVall 0.048624 0.073296 0.663 0.50708
scale(recip.rt.image.flipped):emotion 0.001852 0.083512 0.022 0.98230
scale(jf):conditionsocvnsoc 0.030057 0.097010 0.310 0.75669
scale(recip.rt.image.flipped):conditionsocvnsoc 0.063682 0.100396 0.634 0.52588
emotionnegVall:conditionsocvnsoc -0.023623 0.254047 -0.093 0.92591
emotion:conditionsocvnsoc -0.465821 0.300018 -1.553 0.12051
scale(jf):scale(recip.rt.image.flipped):emotionnegVall 0.069558 0.070587 0.985 0.32442
scale(jf):scale(recip.rt.image.flipped):emotion 0.133468 0.079841 1.672 0.09459 .
scale(jf):scale(recip.rt.image.flipped):conditionsocvnsoc 0.031797 0.096353 0.330 0.74140
scale(jf):emotionnegVall:conditionsocvnsoc 0.337590 0.145683 2.317 0.02049 *
scale(jf):emotion:conditionsocvnsoc 0.137436 0.158208 0.869 0.38501
scale(recip.rt.image.flipped):emotionnegVall:conditionsocvnsoc -0.093510 0.146628 -0.638 0.52365
scale(recip.rt.image.flipped):emotion:conditionsocvnsoc 0.025894 0.167615 0.154 0.87723
scale(jf):scale(recip.rt.image.flipped):emotionnegVall:conditionsocvnsoc -0.453716 0.142311 -3.188 0.00143 **
scale(jf):scale(recip.rt.image.flipped):emotion:conditionsocvnsoc -0.340306 0.160427 -2.121 0.03390 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 24 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it