See Analyses file in the Experiment 1 folder
This file presents the analyses reported in the manuscript titled “Lexical stress representation in Greek spoken word recognition” by Andrikopoulou et al. See the file “mega script.R” for pre-processing and additional analyses.
load("newcordat.rda")
targettimes <- read.table(paste("TargetTimes2.txt",sep=""),header=T,sep="\t",encoding="UTF-8")
names(targettimes)[1] <- "Item"
sylbnd <- cbind(tapply(targettimes$Syl1Dur,targettimes$StrPos,mean),
tapply(targettimes$Syl12Dur,targettimes$StrPos,mean),
tapply(targettimes$AllDur,targettimes$StrPos,mean))*1000
sylnm <- c("1st syllable","2nd syllable","Word end")
sylnm2 <- paste(sylnm,"+ 200ms",sep=" ")
strpos <- c("fir"="Ant","sec"="Pen","thi"="Fin")
strpof <- c("rst"="Ant","sec"="Pen","ird"="Fin")
avg <- aggregate(cbind(IA_1_P,IA_2_P,IA_3_P,IA_4_P) ~ Time + str_type, data=newcordat, mean, na.rm=TRUE)
avg$trgstr <- strpos[substr(as.character(avg$str_type),1,3)]
avg$cmpstr <- strpof[substr(as.character(avg$str_type),nchar(as.character(avg$str_type))-2,nchar(as.character(avg$str_type)))]
par(mfcol=c(2,3))
par(oma=c(0.5,0.5,0,0.2))
par(mai=c(0.4,0.4,0.3,0.09))
par(mgp=c(2,0.5,0))
par(tcl=-0.35)
for (tpi in 1:3) {
tp <- strpos[tpi]
for (pp in strpos[-tpi]) {
emptyPlot(range(avg$Time), c(0,1),xlab = 'Time from target onset (ms)', ylab = 'Proportion of Looks',
main=paste(tp,"target,",pp,"competitor"))
lines(IA_1_P~Time,avg,subset= trgstr==tp & cmpstr==pp,col="turquoise4", lwd = 2) # Target
lines(IA_2_P~Time,avg,subset= trgstr==tp & cmpstr==pp,col="turquoise3", lwd = 2) # Competitor
lines(IA_3_P~Time,avg,subset= trgstr==tp & cmpstr==pp,col="antiquewhite4", lwd = 2) # Distractor 1
lines(IA_4_P~Time,avg,subset= trgstr==tp & cmpstr==pp,col="antiquewhite3", lwd = 2) # Distractor 2
}
}
legend(-325,1.05, ncol=2,legend=c("Target","Competitor", "Distractor 1", "Distractor 2"), bg="white",
fill=c("turquoise4","turquoise3", "antiquewhite4", "antiquewhite3"), title="Interest Areas", xpd=NA, cex=1)
This is Figure 2 in the submitted manuscript
See file “mega script.R” in the folder above for additional models and model comparisons.
if (FALSE) { # takes a long time to run
newm4b <- bam(TargetLooks ~ str_type + s(TRIAL_INDEX) + s(Time)
+s(Time, by=str_type)
+s(Time, Subject, bs = 'fs', m = 1)
+s(Time, Item, bs = 'fs', m = 1),
data = newcordat, family = "binomial",
cluster = cl)
save(newm4b, file = "model_newm4b.rda", compress = 'xz')
} else { load("model_newm4b.rda") }
selmod <- newm4b
summary(newm4b)
##
## Family: binomial
## Link function: logit
##
## Formula:
## TargetLooks ~ str_type + s(TRIAL_INDEX) + s(Time) + s(Time, by = str_type) +
## s(Time, Subject, bs = "fs", m = 1) + s(Time, Item, bs = "fs",
## m = 1)
##
## Parametric coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.8199 0.2673 3.067 0.00216 **
## str_typefirstthird 0.3294 0.3191 1.032 0.30196
## str_typesecfirst 0.1474 0.3200 0.461 0.64506
## str_typesecthird 0.3808 0.3062 1.244 0.21356
## str_typethirdfirst 0.3761 0.2996 1.255 0.20942
## str_typethirdsec 0.2895 0.3157 0.917 0.35914
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Approximate significance of smooth terms:
## edf Ref.df Chi.sq p-value
## s(TRIAL_INDEX) 8.968 9.000 2542.274 < 2e-16 ***
## s(Time) 5.346 5.652 49.779 7.38e-09 ***
## s(Time):str_typefirstsec 5.077 5.428 2.233 0.856
## s(Time):str_typefirstthird 5.113 5.433 6.304 0.310
## s(Time):str_typesecfirst 7.579 7.778 5.593 0.669
## s(Time):str_typesecthird 1.000 1.001 0.229 0.632
## s(Time):str_typethirdfirst 1.001 1.001 0.408 0.524
## s(Time):str_typethirdsec 3.201 3.504 7.267 0.102
## s(Time,Subject) 318.611 332.000 63911.473 < 2e-16 ***
## s(Time,Item) 448.166 489.000 56193.651 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Rank: 905/906
## R-sq.(adj) = 0.191 Deviance explained = 18.2%
## fREML = 7.971e+05 Scale est. = 1 n = 99860
In the first graph, the vertical dotted lines indicate the syllable boundaries, offset by 200 ms to account for saccadic programming. The region marked in red shows the time interval during which the target and competitor curves were significantly different.
par(mfcol=c(2,3))
par(oma=c(0.5,0.5,0,0.2))
par(mai=c(0.4,0.4,0.3,0.09))
par(mgp=c(2,0.5,0))
par(tcl=-0.35)
for (cnd in levels(selmod$model$str_type)) {
out <- plot_smooth(selmod,view="Time", cond=list(str_type=cnd),ylab="Target vs. competitor looks (log odds)",
main=paste(strpos[substr(cnd,1,3)],"target,",strpof[substr(cnd,nchar(cnd)-2,nchar(cnd))],"competitor"),
col="blue",ylim=c(-1,4),rug=F,
rm.ranef=TRUE,hide.label=T,print.summary=F)
(diff <- find_difference(out$fv$fit, out$fv$CI, xVals=out$fv$Time))
addInterval(0, lowVals=diff$start, highVals = diff$end, col='red', lwd=2)
abline(v=c(diff$start, diff$end), lty=3, col='red')
syl <- 4-which(names(strpos)==substr(cnd,1,3))
abline(v=sylbnd[syl,]+200,lty=3,col="gray50")
text(sylbnd[syl,]+200,rep(4,3),sylnm2,adj=c(0,1),srt=-90,col="gray50")
}
This is Figure 3 in the submitted manuscript.
In the second graph, the top row shows the curves for the same targets following two different competitors, superimposed. “c” stands for “competitor”. The bottom row plots the difference between the two curves shown on the top row, along with the corresponding confidence interval. Any regions of significant difference are marked in red (none in this case).
par(mfrow=c(2,3))
par(oma=c(0.3,0.2,0,0))
par(mai=c(0.4,0.4,0.2,0.1))
par(mgp=c(2,0.5,0.5))
par(tcl=-0.35)
plot_smooth(selmod,view="Time", cond=list(str_type="firstsec"),ylab="Target vs. competitor looks (log odds)",
rm.ranef=TRUE,col="red",ylim=c(-1,4),main="Ant targets",rug=F,hide.label=T,print.summary=F)
plot_smooth(selmod,view="Time", cond=list(str_type="firstthird"),
rm.ranef=TRUE,col="blue",add=T,rug=F,print.summary=F)
text( 950,3.9,"Fin c",adj=c(1,0),col="blue")
text(1000,1.5,"Pen c",adj=c(1,0),col="red")
plot_smooth(selmod,view="Time", cond=list(str_type="secfirst"),ylab="",
rm.ranef=TRUE,col="blue",ylim=c(-1,4),main="Pen targets",rug=F,hide.label=T,print.summary=F)
plot_smooth(selmod,view="Time", cond=list(str_type="secthird"),
rm.ranef=TRUE,col="red",add=T,rug=F,print.summary=F)
text(1000,1.5,"Ant c",adj=c(1,0),col="blue")
text( 900,3.9,"Fin c",adj=c(1,0),col="red")
plot_smooth(selmod,view="Time", cond=list(str_type="thirdfirst"),ylab="",
rm.ranef=TRUE,col="red",ylim=c(-1,4),main="Fin targets",rug=F,hide.label=T,print.summary=F)
plot_smooth(selmod,view="Time", cond=list(str_type="thirdsec"),
rm.ranef=TRUE,col="blue",add=T,rug=F,print.summary=F)
text( 900,3.9,"Ant c",adj=c(1,0),col="red")
plot_diff(selmod,view="Time",ylab = "Difference in target looks (logits)",comp=list(str_type=c("firstthird","firstsec")),rm.ranef=T,main="Fin minus Pen",ylim=c(-2,2),hide.label=T,print.summary=F)
plot_diff(selmod,view="Time",comp=list(str_type=c("secthird","secfirst")),ylab="",rm.ranef=T,main="Fin minus Ant",ylim=c(-2,2),hide.label=T,print.summary=F)
plot_diff(selmod,view="Time",comp=list(str_type=c("thirdsec","thirdfirst")),ylab="",rm.ranef=T,main="Pen minus Ant",ylim=c(-2,2),hide.label=T,print.summary=F)
This figure was not included in the manuscript.
In this graph, each panel contrasts two conditions with opposite target-competitor stress patterns (e.g., Ant target with Pen competitor vs. Pen target with Ant competitor). The top row shows the curves for the two conditions superimposed. The bottom row plots the difference between the two curves shown on the top row, along with the corresponding confidence interval. Any regions of significant difference are marked in red (none in this case). It is in these graphs where any effects of underspecification should be seen, exposing any asymmetry between stress patterns.
par(mfrow=c(2,3))
par(oma=c(0.5,0.5,0,0.2))
par(mai=c(0.4,0.4,0.3,0.09))
par(mgp=c(2,0.5,0))
par(tcl=-0.35)
plot_smooth(selmod,view="Time", cond=list(str_type="firstsec"),rm.ranef=TRUE,col="red", ylab="Target Looks",
ylim=c(-1,4),main="Ant vs Pen",rug=F,hide.label=T,print.summary=F)
plot_smooth(selmod,view="Time", cond=list(str_type="secfirst"),rm.ranef=TRUE,col="blue",add=T,rug=F,print.summary=F)
text(1000,3.9,"Pen targ",adj=c(1,0),col="blue")
text(1000,1.8,"Ant targ",adj=c(1,0),col="red")
plot_smooth(selmod,view="Time", cond=list(str_type="thirdsec"), rm.ranef=TRUE,col="blue", ylab = "",
ylim=c(-1,4),main="Fin vs Pen",rug=F,hide.label=T,print.summary=F)
plot_smooth(selmod,view="Time", cond=list(str_type="secthird"), rm.ranef=TRUE,col="red",add=T,rug=F,print.summary=F)
text( 900,3.9,"Fin targ",adj=c(1,0),col="blue")
text(1000,2.2,"Pen targ",adj=c(1,0),col="red")
plot_smooth(selmod,view="Time", cond=list(str_type="thirdfirst"),rm.ranef=TRUE,col="red",ylab = "",
ylim=c(-1,4),main="Ant vs Final",rug=F,hide.label=T,print.summary=F)
plot_smooth(selmod,view="Time", cond=list(str_type="firstthird"),rm.ranef=TRUE,col="blue",add=T,rug=F,print.summary=F)
text( 900,3.9,"Fin targ",adj=c(1,0),col="red")
text(1000,2.2,"Ant targ",adj=c(1,0),col="blue")
plot_diff(selmod,view="Time",comp=list(str_type=c("firstsec","secfirst")),ylab="Difference in Target Looks",
rm.ranef=T,main="Ant target minus Pen target",ylim=c(-2,2),hide.label=T,print.summary=F)
plot_diff(selmod,view="Time",comp=list(str_type=c("thirdsec","secthird")),ylab="",
rm.ranef=T,main="Fin target minus Pen target",ylim=c(-2,2),hide.label=T,print.summary=F)
plot_diff(selmod,view="Time",comp=list(str_type=c("firstthird","thirdfirst")),ylab="",
rm.ranef=T,main="Ant target minus Final target",ylim=c(-2,2),hide.label=T,print.summary=F)
This is Figure 4 in the submitted manuscript.
sessionInfo()
## R version 3.6.2 (2019-12-12)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 18363)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United States.1252
## [2] LC_CTYPE=English_United States.1252
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.1252
##
## attached base packages:
## [1] parallel stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] gtools_3.8.1 itsadug_2.3 plotfunctions_1.3 mgcv_1.8-31
## [5] nlme_3.1-144
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.3 lattice_0.20-40 digest_0.6.25 grid_3.6.2
## [5] magrittr_1.5 evaluate_0.14 rlang_0.4.2 stringi_1.4.6
## [9] Matrix_1.2-18 rmarkdown_2.1 splines_3.6.2 tools_3.6.2
## [13] stringr_1.4.0 xfun_0.12 yaml_2.2.1 compiler_3.6.2
## [17] htmltools_0.4.0 knitr_1.28