library(lmSupport)
## Warning: package 'lmSupport' was built under R version 3.5.2
library(psych)
## Warning: package 'psych' was built under R version 3.5.2
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.5.3
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 3.5.3
## Loading required package: magrittr
## Warning: package 'magrittr' was built under R version 3.5.2
library(lme4)
## Warning: package 'lme4' was built under R version 3.5.3
## Loading required package: Matrix
library(lmerTest)
## Warning: package 'lmerTest' was built under R version 3.5.3
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
library(lme4)
library(plyr)
## Warning: package 'plyr' was built under R version 3.5.2
##
## Attaching package: 'plyr'
## The following object is masked from 'package:ggpubr':
##
## mutate
library(tidyr)
## Warning: package 'tidyr' was built under R version 3.5.3
##
## Attaching package: 'tidyr'
## The following objects are masked from 'package:Matrix':
##
## expand, pack, unpack
## The following object is masked from 'package:magrittr':
##
## extract
library(sjPlot)
## Warning: package 'sjPlot' was built under R version 3.5.3
## Learn more about sjPlot with 'browseVignettes("sjPlot")'.
library(splines)
source('http://psych.colorado.edu/~jclab/R/mcSummaryLm.R')
setwd("C:/Users/Dani Grant/Dropbox/CU Boulder/study - attention & trust")
df_long <- read.csv('./df_long.csv', header = T, stringsAsFactors = F)
#create dataframe excluding practice trials
df_long_noPrac <- df_long[!df_long$trial%in%c(1,2,3),]
setwd("C:/Users/Dani Grant/Desktop/attention trust")
m1 <- glmer(cuedFaceChosen_1 ~ 1 +
(1 | participant), family=binomial(), data=df_long_noPrac)
summary(m1)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: cuedFaceChosen_1 ~ 1 + (1 | participant)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6831.9 6844.9 -3413.9 6827.9 4973
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.5456 -0.9973 0.5601 0.9610 1.3563
##
## Random effects:
## Groups Name Variance Std.Dev.
## participant (Intercept) 0.1809 0.4254
## Number of obs: 4975, groups: participant, 199
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.07882 0.04185 1.883 0.0596 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
exp(.07882)
## [1] 1.08201
Interpretation for m1:
\(\beta_0\): Cued face is chosen marginally significantly more than uncued face (OR = 1.08, p = .060).
m2 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5 +
(1 | participant), family=binomial, data=df_long_noPrac)
summary(m2)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: cuedFaceChosen_1 ~ sideCuedRight_.5 + (1 | participant)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6827.7 6847.3 -3410.9 6821.7 4972
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.6047 -0.9934 0.5801 0.9360 1.4100
##
## Random effects:
## Groups Name Variance Std.Dev.
## participant (Intercept) 0.1811 0.4256
## Number of obs: 4975, groups: participant, 199
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.07906 0.04187 1.888 0.0590 .
## sideCuedRight_.5 0.14519 0.05858 2.478 0.0132 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## sdCdRght_.5 0.003
exp(0.07906)
## [1] 1.082269
exp(0.14519)
## [1] 1.156259
Interpretation for m2:
\(\beta_0\): Across side cued, on average, the odds of the cued face being chosen is marginally significant (OR = 1.08, p = .059).
\(\beta_1\): As you move from left side cued to right side cued,on average there is an increase in odds by a factor of 1.15 for the cued face being chosen (OR = 1.15, p = .013).
m3 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5 +
(1 | participant) +
(1 | faceLeft) +
(1 | faceRight), family=binomial, data=df_long_noPrac)
summary(m3)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: cuedFaceChosen_1 ~ sideCuedRight_.5 + (1 | participant) + (1 |
## faceLeft) + (1 | faceRight)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6830.3 6862.9 -3410.2 6820.3 4970
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.5937 -0.9849 0.5791 0.9351 1.4323
##
## Random effects:
## Groups Name Variance Std.Dev.
## participant (Intercept) 0.18241 0.4271
## faceLeft (Intercept) 0.01339 0.1157
## faceRight (Intercept) 0.01016 0.1008
## Number of obs: 4975, groups:
## participant, 199; faceLeft, 143; faceRight, 143
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.08098 0.04401 1.840 0.0658 .
## sideCuedRight_.5 0.14699 0.05892 2.495 0.0126 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## sdCdRght_.5 0.004
exp(0.08098)
## [1] 1.084349
exp(.14699)
## [1] 1.158342
Interpretation for m3:
\(\beta_0\): Across side cued, on average, the odds of the cued face being chosen is marginally significant (OR = 1.08, p = .066).
\(\beta_1\): As you move from left side cued to right side cued, on average there is an increase in odds by a factor of 1.16 for the cued face being chosen (OR = 1.16, p = .013).
m4 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5 +
(sideCuedRight_.5 | participant) +
(1 | faceLeft) +
(1 | faceRight), family=binomial("logit"), data=df_long_noPrac)
summary(m4)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 + (sideCuedRight_.5 | participant) +
## (1 | faceLeft) + (1 | faceRight)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6830.1 6875.7 -3408.0 6816.1 4968
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.6713 -0.9748 0.5952 0.9353 1.4106
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## participant (Intercept) 0.185696 0.43092
## sideCuedRight_.5 0.140996 0.37549 0.22
## faceLeft (Intercept) 0.013758 0.11730
## faceRight (Intercept) 0.008831 0.09397
## Number of obs: 4975, groups:
## participant, 199; faceLeft, 143; faceRight, 143
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.08105 0.04427 1.831 0.0671 .
## sideCuedRight_.5 0.14941 0.06492 2.301 0.0214 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## sdCdRght_.5 0.071
exp(.08105)
## [1] 1.084425
exp(.14941)
## [1] 1.161149
prob.cuedRight.m4 <- (exp(.08105) * (exp(.14941)^.5)) / (1 + (exp(.08105) * (exp(.14941)^.5)))
prob.cuedLeft.m4 <- (exp(.08105) * (exp(.14941)^-.5)) / (1 + (exp(.08105) * (exp(.14941)^-.5)))
sd.prop <- 0.37549/(1+0.37549)
se <- sd.prop/sqrt(199)
se
## [1] 0.01935149
prob.cuedRight.m4
## [1] 0.5388602
prob.cuedLeft.m4
## [1] 0.5015862
p <- plot_model(m4, type = "pred", terms = "sideCuedRight_.5")
p + labs(title = "probability for cued face chosen given side cued",
x = "Left(-.5) side cued Right(.5)",
y = "probability of cued face chosen")
model 4 for side cued
Interpretation for m4:
\(\beta_0\): Across side cued, on average, the odds of the cued face being chosen is marginally significant (OR = 1.08, p = .067).
\(\beta_1\): As you move from left side cued to right side cued, on average there is an increase in odds by a factor of 1.16 for the cued face being chosen (OR = 1.16, p = .021).
#singularity problems
m5 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5 +
(sideCuedRight_.5 + stim_female_.5 | participant) +
(1 | faceLeft) +
(1 | faceRight), family=binomial, data=df_long_noPrac)
## boundary (singular) fit: see ?isSingular
summary(m5)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 + (sideCuedRight_.5 + stim_female_.5 |
## participant) + (1 | faceLeft) + (1 | faceRight)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6836.0 6901.1 -3408.0 6816.0 4965
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.6611 -0.9746 0.5985 0.9339 1.4262
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## participant (Intercept) 0.190795 0.43680
## sideCuedRight_.5 0.141474 0.37613 0.21
## stim_female_.5 0.001172 0.03424 -0.77 0.46
## faceLeft (Intercept) 0.013662 0.11688
## faceRight (Intercept) 0.008912 0.09441
## Number of obs: 4975, groups:
## participant, 199; faceLeft, 143; faceRight, 143
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.07948 0.04465 1.780 0.0751 .
## sideCuedRight_.5 0.15000 0.06546 2.291 0.0219 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## sdCdRght_.5 0.073
## convergence code: 0
## boundary (singular) fit: see ?isSingular
no interpretation - singularity issues
m6 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5*pt_female_.5 +
(1 | participant), family=binomial, data=df_long_noPrac)
summary(m6)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 * pt_female_.5 + (1 | participant)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6830.4 6863.0 -3410.2 6820.4 4970
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.5818 -0.9833 0.5781 0.9429 1.4309
##
## Random effects:
## Groups Name Variance Std.Dev.
## participant (Intercept) 0.1803 0.4246
## Number of obs: 4975, groups: participant, 199
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.08358 0.04369 1.913 0.05575 .
## sideCuedRight_.5 0.17309 0.06388 2.710 0.00673 **
## pt_female_.5 -0.02318 0.06360 -0.364 0.71555
## sideCuedRight_.5:pt_female_.5 -0.14031 0.12772 -1.099 0.27195
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) sdCR_.5 pt__.5
## sdCdRght_.5 0.003
## pt_femal_.5 -0.289 -0.002
## sCR_.5:__.5 0.000 -0.399 0.004
exp(.08358)
## [1] 1.087172
exp(.17309)
## [1] 1.188973
exp(-.02318)
## [1] 0.9770866
exp(-.14031)
## [1] 0.8690888
Interpretation for m6:
\(\beta_0\): On average, the odds of the cued face being chosen is marginally significant (OR = 1.09, p = .056).
\(\beta_1\): Across participant gender, on average there is a signficant increase in the odds for choosing the cued face by a factor of 1.19 as the cued face moved from left to right side of the screen (OR = 1.19, p = .006).
\(\beta_2\): Controlling for which side of the screen the face is cued, on average there is no signficant change in the odds for choosing the cued face for female participants vs. male participants (OR = .98, p = .716).
\(\beta_3\): There is no signficant interaction between side cued and participant gender (OR = .87, p = .272).
m7 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5*pt_female_.5 +
(1 | participant) +
(1 | faceLeft) +
(1 | faceRight), family=binomial, data=df_long_noPrac)
summary(m7)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 * pt_female_.5 + (1 | participant) +
## (1 | faceLeft) + (1 | faceRight)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6833.1 6878.6 -3409.5 6819.1 4968
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.5726 -0.9849 0.5814 0.9382 1.4409
##
## Random effects:
## Groups Name Variance Std.Dev.
## participant (Intercept) 0.181584 0.42613
## faceLeft (Intercept) 0.013461 0.11602
## faceRight (Intercept) 0.009621 0.09809
## Number of obs: 4975, groups:
## participant, 199; faceLeft, 143; faceRight, 143
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.08549 0.04573 1.870 0.06154 .
## sideCuedRight_.5 0.17454 0.06424 2.717 0.00659 **
## pt_female_.5 -0.02323 0.06395 -0.363 0.71638
## sideCuedRight_.5:pt_female_.5 -0.13854 0.12840 -1.079 0.28058
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) sdCR_.5 pt__.5
## sdCdRght_.5 0.004
## pt_femal_.5 -0.278 -0.002
## sCR_.5:__.5 0.000 -0.398 0.004
exp(.08549)
## [1] 1.089251
exp(.17454)
## [1] 1.190698
exp(-.02323)
## [1] 0.9770377
exp(-.13854)
## [1] 0.8706284
Interpretation for m7:
\(\beta_0\): On average, the odds of the cued face being chosen is marginally significant (OR = 1.09, p = .062).
\(\beta_1\): Across participant gender, on average there is a signficant increase in the odds for choosing the cued face by a factor of 1.19 as the cued face moved from left to right side of the screen (OR = 1.19, p = .006).
\(\beta_2\): Controlling for which side of the screen the face is cued, on average there is no signficant change in the odds for choosing the cued face for female participants vs. male participants (OR = .98, p = .716).
\(\beta_3\): There is no signficant interaction between side cued and participant gender (OR = .87, p = .272).
m8 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5*pt_female_.5 +
(sideCuedRight_.5 | participant) +
(1 | faceLeft) +
(1 | faceRight), family=binomial, data=df_long_noPrac)
summary(m8)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 * pt_female_.5 + (sideCuedRight_.5 |
## participant) + (1 | faceLeft) + (1 | faceRight)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6832.7 6891.3 -3407.4 6814.7 4966
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.6485 -0.9738 0.5916 0.9359 1.4284
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## participant (Intercept) 0.184845 0.42994
## sideCuedRight_.5 0.142260 0.37717 0.21
## faceLeft (Intercept) 0.013847 0.11767
## faceRight (Intercept) 0.008295 0.09108
## Number of obs: 4975, groups:
## participant, 199; faceLeft, 143; faceRight, 143
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.08540 0.04601 1.856 0.0634 .
## sideCuedRight_.5 0.17782 0.06990 2.544 0.0110 *
## pt_female_.5 -0.02245 0.06443 -0.348 0.7275
## sideCuedRight_.5:pt_female_.5 -0.14293 0.12924 -1.106 0.2688
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) sdCR_.5 pt__.5
## sdCdRght_.5 0.064
## pt_femal_.5 -0.279 -0.005
## sCR_.5:__.5 -0.003 -0.369 0.014
exp(.0854)
## [1] 1.089153
exp(.17782)
## [1] 1.19461
exp(-.02245)
## [1] 0.9778001
exp(-.14293)
## [1] 0.8668147
prob.cuedRight.m8 <- (exp(.0854) * (exp(.17782)^.5)) / (1 + (exp(.0854) * (exp(.17782)^.5)))
prob.cuedLeft.m8 <- (exp(.0854) * (exp(.17782)^-.5)) / (1 + (exp(.0854) * (exp(.17782)^-.5)))
prob.cuedRight.m8
## [1] 0.5434675
prob.cuedLeft.m8
## [1] 0.4991225
sd.prop <- 0.37717/(1+0.37717)
se <- sd.prop/sqrt(199)
se
## [1] 0.01941436
p <- plot_model(m8, type = "pred", terms = "sideCuedRight_.5")
p + labs(title = "probability for cued face chosen given side cued",
x = "Left(-.5) side cued Right(.5)",
y = "probability of cued face chosen")
model 8 for side cued
Interpretation for m8:
\(\beta_0\): On average, the odds of the cued face being chosen is marginally significant (OR = 1.09, p = .063).
\(\beta_1\): Across participant gender, on average there is a signficant increase in the odds for choosing the cued face by a factor of 1.19 as the cued face moved from left to right side of the screen (OR = 1.19, p = .011).
\(\beta_2\): Controlling for which side of the screen the face is cued, on average there is no signficant change in the odds for choosing the cued face for female participants vs. male participants (OR = .98, p = .728).
\(\beta_3\): There is no signficant interaction between side cued and participant gender (OR = .87, p = .269).
m9 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5*pt_female_.5 +
(sideCuedRight_.5 + stim_female_.5 | participant) +
(1 | faceLeft) +
(1 | faceRight), family=binomial, data=df_long_noPrac)
## boundary (singular) fit: see ?isSingular
summary(m9)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 * pt_female_.5 + (sideCuedRight_.5 +
## stim_female_.5 | participant) + (1 | faceLeft) + (1 | faceRight)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6838.6 6916.8 -3407.3 6814.6 4963
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.6386 -0.9742 0.5959 0.9361 1.4447
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## participant (Intercept) 0.190025 0.43592
## sideCuedRight_.5 0.142701 0.37776 0.20
## stim_female_.5 0.001067 0.03267 -0.82 0.39
## faceLeft (Intercept) 0.013753 0.11727
## faceRight (Intercept) 0.008385 0.09157
## Number of obs: 4975, groups:
## participant, 199; faceLeft, 143; faceRight, 143
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.08376 0.04640 1.805 0.0710 .
## sideCuedRight_.5 0.17825 0.07034 2.534 0.0113 *
## pt_female_.5 -0.02228 0.06444 -0.346 0.7296
## sideCuedRight_.5:pt_female_.5 -0.14290 0.12926 -1.105 0.2690
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) sdCR_.5 pt__.5
## sdCdRght_.5 0.065
## pt_femal_.5 -0.278 -0.005
## sCR_.5:__.5 -0.002 -0.364 0.014
## convergence code: 0
## boundary (singular) fit: see ?isSingular
no interpretation - singularity issues
\[ cuedFaceChosen = \beta_0 + \beta_1 sideCued + \beta_2 stimGender + \beta_1 sideCued*stimGender + \epsilon_i \]
m10 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5*stim_female_.5 +
(1 | participant), family=binomial, data=df_long_noPrac)
summary(m10)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 * stim_female_.5 + (1 | participant)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6826.3 6858.8 -3408.1 6816.3 4970
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.5582 -0.9906 0.5852 0.9509 1.4215
##
## Random effects:
## Groups Name Variance Std.Dev.
## participant (Intercept) 0.1798 0.424
## Number of obs: 4975, groups: participant, 199
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.10826 0.04400 2.460 0.01389 *
## sideCuedRight_.5 0.17987 0.06475 2.778 0.00547 **
## stim_female_.5 -0.13411 0.06458 -2.077 0.03785 *
## sideCuedRight_.5:stim_female_.5 -0.14765 0.12957 -1.140 0.25448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) sdCR_.5 st__.5
## sdCdRght_.5 0.026
## stim_fml_.5 -0.312 -0.043
## sCR_.5:__.5 -0.031 -0.424 0.035
exp(.10826)
## [1] 1.114337
exp(.17987)
## [1] 1.197062
exp(-.13411)
## [1] 0.8744939
exp(-.14765)
## [1] 0.862733
Interpretation for m10:
\(\beta_0\): On average, the odds of the cued face being chosen is significant (OR = 1.11, p = .014).
\(\beta_1\): Across stimuli gender, on average there is a signficant increase in the odds for choosing the cued face by a factor of 1.97 as the cued face moved from left to right side of the screen (OR = 1.97, p = .005).
\(\beta_2\): Controlling for which side of the screen the face is cued, on average there is no signficant change in the odds for choosing the cued face for female stimuli trials vs. male stimuli trials (OR = .87, p = .874).
\(\beta_3\): There is no signficant interaction between side cued and stimulus gender (OR = .87, p = .272).
m11 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5*stim_female_.5 +
(1 | participant) +
(1 | faceLeft) +
(1 | faceRight), family=binomial, data=df_long_noPrac)
summary(m11)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 * stim_female_.5 + (1 | participant) +
## (1 | faceLeft) + (1 | faceRight)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6829.4 6875.0 -3407.7 6815.4 4968
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.5496 -0.9834 0.5786 0.9402 1.4359
##
## Random effects:
## Groups Name Variance Std.Dev.
## participant (Intercept) 0.180845 0.4253
## faceLeft (Intercept) 0.009821 0.0991
## faceRight (Intercept) 0.008667 0.0931
## Number of obs: 4975, groups:
## participant, 199; faceLeft, 143; faceRight, 143
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.10995 0.04591 2.395 0.01663 *
## sideCuedRight_.5 0.18071 0.06502 2.779 0.00545 **
## stim_female_.5 -0.13591 0.06951 -1.955 0.05057 .
## sideCuedRight_.5:stim_female_.5 -0.14711 0.13013 -1.130 0.25829
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) sdCR_.5 st__.5
## sdCdRght_.5 0.025
## stim_fml_.5 -0.320 -0.041
## sCR_.5:__.5 -0.029 -0.424 0.033
exp(0.10995)
## [1] 1.116222
exp(.18071)
## [1] 1.198068
exp(-.13591)
## [1] 0.8729212
exp(-.14711)
## [1] 0.863199
Interpretation for m11:
\(\beta_0\): On average, the odds of the cued face being chosen is significant (OR = 1.12, p = .017).
\(\beta_1\): Across stimuli gender, on average there is a signficant increase in the odds for choosing the cued face by a factor of 1.20 as the cued face moved from left to right side of the screen (OR = 1.20, p = .005).
\(\beta_2\): Controlling for which side of the screen the face is cued, on average there is a marginally signficant increase in the odds for choosing the cued face for female stimuli trials vs. male stimuli trials (OR = .87, p = .051).
\(\beta_3\): There is no signficant interaction between side cued and stimuli gender (OR = .86, p = .258).
m12 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5*stim_female_.5 +
(sideCuedRight_.5 | participant) +
(1 | faceLeft) +
(1 | faceRight), family=binomial, data=df_long_noPrac)
summary(m12)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 * stim_female_.5 + (sideCuedRight_.5 |
## participant) + (1 | faceLeft) + (1 | faceRight)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6829.4 6888.0 -3405.7 6811.4 4966
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.6224 -0.9740 0.5962 0.9371 1.4300
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## participant (Intercept) 0.184180 0.4292
## sideCuedRight_.5 0.137860 0.3713 0.21
## faceLeft (Intercept) 0.010348 0.1017
## faceRight (Intercept) 0.007516 0.0867
## Number of obs: 4975, groups:
## participant, 199; faceLeft, 143; faceRight, 143
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.10945 0.04621 2.368 0.01787 *
## sideCuedRight_.5 0.18317 0.07047 2.599 0.00934 **
## stim_female_.5 -0.13315 0.06983 -1.907 0.05657 .
## sideCuedRight_.5:stim_female_.5 -0.14792 0.13100 -1.129 0.25881
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) sdCR_.5 st__.5
## sdCdRght_.5 0.080
## stim_fml_.5 -0.319 -0.041
## sCR_.5:__.5 -0.032 -0.394 0.042
exp(.10945)
## [1] 1.115664
exp(.18317)
## [1] 1.201019
exp(-.13315)
## [1] 0.8753338
exp(-.14792)
## [1] 0.8625001
prob.cuedRight.m12a <- (exp(.10945) * (exp(0.18317)^.5)) / (1 + (exp(.10945) * (exp(.18317)^.5)))
prob.cuedLeft.m12a <- (exp(.10945) * (exp(.18317)^-.5)) / (1 + (exp(.10945) * (exp(.18317)^-.5)))
prob.cuedRight.m12a
## [1] 0.5500902
prob.cuedLeft.m12a
## [1] 0.5044661
sd.prop <- 0.3713/(1+0.3713)
se <- sd.prop/sqrt(199)
se
## [1] 0.01919402
p <- plot_model(m12, type = "pred", terms = "sideCuedRight_.5")
p + labs(title = "probability for cued face chosen given side cued",
subtitle = "controlling for stimulus gender",
x = "Left(-.5) side cued Right(.5)",
y = "probability of cued face chosen",
tag = "A")
model 12 for side cued
prob.cuedFemale.m12b <- (exp(.10945) * (exp(-.13315)^.5)) / (1 + (exp(.10945) * (exp(-.13315)^.5)))
prob.cuedMale.m12b <- (exp(.10945) * (exp(-.13315)^-.5)) / (1 + (exp(.10945) * (exp(-.13315)^-.5)))
prob.cuedFemale.m12b
## [1] 0.5107171
prob.cuedMale.m12b
## [1] 0.543893
se12b <- 0.3713/sqrt(199)
se12b
## [1] 0.02632076
p <- plot_model(m12, type = "pred", terms = "stim_female_.5")
p + labs(title = "probability for cued face chosen given stimulus gender",
subtitle = "controlling for side cued",
x = "Male(-.5) stimulus gender Female(.5)",
y = "probability of cued face chosen",
tag = "B")
model 12 for side cued
Interpretation for m12:
\(\beta_0\): On average, the odds of the cued face being chosen is significant (OR = 1.12, p = .018).
\(\beta_1\): Across stimuli gender, on average there is a signficant increase in the odds for choosing the cued face by a factor of 1.20 as the cued face moved from left to right side of the screen (OR = 1.20, p = .009).
\(\beta_2\): Controlling for which side of the screen the face is cued, on average there is a marginally signficant increase in the odds for choosing the cued face for female stimuli trials vs. male stimuli trials (OR = .88, p = .057).
\(\beta_3\): There is no signficant interaction between side cued and stimuli gender (OR = .86, p = .259).
#singluarity problems
m13 <- glmer(cuedFaceChosen_1 ~ sideCuedRight_.5*stim_female_.5 +
(sideCuedRight_.5 + stim_female_.5 | participant) +
(1 | faceLeft) +
(1 | faceRight), family=binomial, data=df_long_noPrac)
## boundary (singular) fit: see ?isSingular
summary(m13)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## cuedFaceChosen_1 ~ sideCuedRight_.5 * stim_female_.5 + (sideCuedRight_.5 +
## stim_female_.5 | participant) + (1 | faceLeft) + (1 | faceRight)
## Data: df_long_noPrac
##
## AIC BIC logLik deviance df.resid
## 6835.2 6913.4 -3405.6 6811.2 4963
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.6195 -0.9723 0.5929 0.9366 1.4236
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## participant (Intercept) 0.190627 0.43661
## sideCuedRight_.5 0.138338 0.37194 0.20
## stim_female_.5 0.001500 0.03873 -0.84 0.36
## faceLeft (Intercept) 0.010202 0.10101
## faceRight (Intercept) 0.007592 0.08713
## Number of obs: 4975, groups:
## participant, 199; faceLeft, 143; faceRight, 143
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.10975 0.04661 2.355 0.01855 *
## sideCuedRight_.5 0.18303 0.07061 2.592 0.00954 **
## stim_female_.5 -0.13439 0.07009 -1.917 0.05519 .
## sideCuedRight_.5:stim_female_.5 -0.14752 0.13125 -1.124 0.26101
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) sdCR_.5 st__.5
## sdCdRght_.5 0.077
## stim_fml_.5 -0.342 -0.034
## sCR_.5:__.5 -0.031 -0.397 0.040
## convergence code: 0
## boundary (singular) fit: see ?isSingular
no interpretation - singularity issues