This notebook provides the first half of the full analysis of the article: Heyne, M., Derrick, D., and Al-Tamimi, J. (under review). “Native language influence on brass instrument performance: An application of generalized additive mixed models (GAMMs) to midsagittal ultrasound images of the tongue”. Frontiers Research Topic: Models and Theories of Speech Production. Ed. Adamantios Gafos & Pascal van Lieshout.
# specify directory to save models and summaries
output_dir = "updated_models"
# specify whether to run models -> if set to false script will attempt to load saved models from output_dir
run_models = FALSE
load_packages = c("readr","knitr","ggplot2","mgcv","itsadug","parallel","dplyr","rlist","plotly")
# dplyr, rlist, and plotly are required by the custom plotting functions
for(pkg in load_packages){
eval(bquote(library(.(pkg))))
if (paste0("package:", pkg) %in% search()){
cat(paste0("Successfully loaded the ", pkg, " package.\n"))
}else{
install.packages(pkg)
eval(bquote(library(.(pkg))))
if (paste0("package:", pkg) %in% search()){
cat(paste0("Successfully loaded the ", pkg, " package.\n"))
}
}
}
Successfully loaded the readr package.
Successfully loaded the knitr package.
Successfully loaded the ggplot2 package.
Successfully loaded the mgcv package.
Successfully loaded the itsadug package.
Successfully loaded the parallel package.
Successfully loaded the dplyr package.
Successfully loaded the rlist package.
Successfully loaded the plotly package.
rm(load_packages, pkg)
# detect number of cores available for model calculations
ncores = detectCores()
cat(paste0("Number of cores available for model calculations set to ", ncores, "."))
Number of cores available for model calculations set to 8.
# This function plots multiple smoothing splines in the same window
plotly_scatterpolar_multiplot <- function(df, horizontal, vertical, cols2plot, print=TRUE){
if (length(cols2plot)>2){
print("ERROR: You specified more than 2 columns of values to plot.")
}else{
dat1=df
df_name=deparse(substitute(df))
# layout option 1
if (length(horizontal)==2 & length(vertical)==1){
# Note, Intensity, Language
hori1=nrow(unique(select(dat1, horizontal[1])))
hori2=nrow(unique(select(dat1, horizontal[2])))
hori=hori1*hori2
vert=nrow(unique(select(dat1, vertical[1])))
dat1=select(dat1, c(horizontal[1],horizontal[2],vertical[1],cols2plot[1],cols2plot[2]))
dat1=droplevels(dat1)
var_hori1=levels(dat1[,1])
var_hori2=levels(dat1[,2])
var_vert1=levels(dat1[,3])
# set up line types & colors
ltypes=list("","dash") # match length of hori1
colors=list("blue","green","orange","red") # match length of hori2
cat(paste0("Proceeding to assemble a ", hori, "x", vert, " multiplot.\n"))
cat(paste0("Your plot will show the columns/variables ",horizontal[1]," & ",horizontal[2]," in the horizontal direction and ",vertical[1]," in the vertical direction.\n"))
cat(paste0(horizontal[1], " will be plotted using the following linestyles: -> "))
for (n in 1:length(var_hori1)){
if (n<length(var_hori1)){
cat(paste0(var_hori1[n], ": ", ltypes[n], " - "))
}else{
cat(paste0(var_hori1[n], ": ", ltypes[n], "\n"))
}
}
cat(paste0(horizontal[2], " will be plotted using the following colors: -> "))
for (n in 1:length(var_hori2)){
if (n<length(var_hori2)){
cat(paste0(var_hori2[n], ": ", colors[n], " - "))
}else{
cat(paste0(var_hori2[n], ": ", colors[n], "\n"))
}
}
rm(n)
cat(paste0(vertical[1], " will be shown in the vertical direction from ", var_vert1[1], " (bottom) to ", var_vert1[length(var_vert1)], " (top).\n"))
# assemble layout options for all subplots
# plot_specs set as default
plot_specs = list(sector=c(20,160), radialaxis=list(angle=90, range=c(0,max(dat1$rho_uncut_z)), tickfont=list(size=2)),
angularaxis=list(thetaunit='radians', direction="clockwise", rotation=0, tickfont=list(size=4)))
# set layout options for required number of subplots
for (i in 1:hori){
for (j in 1:vert){
specsX=list.append(plot_specs, domain=list(x=c((i-1)/hori+(1/hori*0.2), i/hori-1/hori*0.2),
y=c((j-1)/vert+(1/vert*0.1),j/vert-1/vert*0.1)))
assign(paste0("sub_plot",((j-1)*hori)+i), specsX)
}
}
rm(i, j, specsX)
# assemble smoothing splines for traces
for (j in 1:vert){
# subset data set by vertical
dat2=dat1[dat1[,3]==var_vert1[j],]
for (i1 in 1:hori1){
# subset data set by horizontal[1]
dat3=dat2[dat2[,1]==var_hori1[i1],]
for (i2 in 1:hori2){
# subset data set by horizontal[2]
dat4=dat3[dat3[,2]==var_hori2[i2],]
if (!nrow(dat4)==0){
if ((((j-1)*hori)+((i1-1)*hori2)+i2)==1){
# assemble trace & assign number
traceX=list(theta=seq(min(dat4$theta_uncut_z)*180/pi,max(dat4$theta_uncut_z)*180/pi, length=100),
r=predict(smooth.spline(dat4$theta_uncut_z, dat4$rho_uncut_z),
seq(min(dat4$theta_uncut_z),max(dat4$theta_uncut_z), length=100))$y,
line=list(color=colors[i2], dash=ltypes[i1]))
assign(paste0("trace",((j-1)*hori)+((i1-1)*hori2)+i2),traceX)
}else if ((((j-1)*hori)+((i1-1)*hori2)+i2)<=hori){
# assemble trace & assign number
traceX=list(theta=seq(min(dat4$theta_uncut_z)*180/pi,max(dat4$theta_uncut_z)*180/pi, length=100),
r=predict(smooth.spline(dat4$theta_uncut_z, dat4$rho_uncut_z),
seq(min(dat4$theta_uncut_z),max(dat4$theta_uncut_z), length=100))$y,
line=list(color=colors[i2], dash=ltypes[i1]), subplot=paste0("polar",((j-1)*hori)+((i1-1)*hori2)+i2))
assign(paste0("trace",((j-1)*hori)+((i1-1)*hori2)+i2),traceX)
}else{
# assemble trace & assign number
traceX=list(theta=seq(min(dat4$theta_uncut_z)*180/pi,max(dat4$theta_uncut_z)*180/pi, length=100),
r=predict(smooth.spline(dat4$theta_uncut_z, dat4$rho_uncut_z),
seq(min(dat4$theta_uncut_z),max(dat4$theta_uncut_z), length=100))$y,
line=list(color=colors[i2], dash=ltypes[i1]), subplot=paste0("polar",((j-1)*hori)+((i1-1)*hori2)+i2), showlegend=FALSE)
assign(paste0("trace",((j-1)*hori)+((i1-1)*hori2)+i2),traceX)
}
}
}
}
}
rm(j, i1, i2, traceX, dat2, dat3, dat4)
# plot assembled traces with assembed layout specifications
p = plot_ly(type='scatterpolar', mode='lines')
dont_plot=c()
p = add_trace(p, theta=trace1$theta, r=trace1$r, line=list(color=trace1$line$color[[1]], dash=trace1$line$dash[[1]]))
for (k in 2:(hori*vert)){
if (exists(paste0("trace",k))){
p = add_trace(p, theta=get(paste0("trace",k))$theta, r=get(paste0("trace",k))$r,
subplot=get(paste0("trace",k))$subplot,
line=list(color=get(paste0("trace",k))$line$color[[1]], dash=get(paste0("trace",k))$line$dash[[1]]))
}else{
dont_plot=c(dont_plot,k)
}
}
# set layout
layout_comp = capture.output(
for (l in 1:(hori*vert)){
if (is.na(match(l, dont_plot))){
if (l==1){
cat(paste0("layout(p, polar=sub_plot",l,", "))
}else if (l<=hori){
cat(paste0("polar",l,"=sub_plot",l,", "))
}else if (l<hori*vert){
cat(paste0("polar",l,"=sub_plot",l,", "))
}else{
cat(paste0("polar",l,"=sub_plot",l,", showlegend=FALSE)"))
}
}
})
p; eval(parse(text=layout_comp))
# layout option 2
}else if (length(horizontal)==1 & length(vertical)==2){
# Subject, Note, Intensity
hori=nrow(unique(select(dat1, horizontal[1])))
vert1=nrow(unique(select(dat1, vertical[1])))
vert2=nrow(unique(select(dat1, vertical[2])))
vert=vert1*vert2
dat1=select(dat1, c(horizontal[1],vertical[1],vertical[2],cols2plot[1],cols2plot[2]))
# dat1[,1]=horizontal[1]; dat1[,2]=horizontal[2]; dat1[,3]=vertical[1];
dat1=droplevels(dat1)
var_hori1=levels(dat1[,1])
var_vert1=levels(dat1[,2])
var_vert2=levels(dat1[,3])
# set up line types & colors
colors=list("blue","green","orange","red","gray") # match length of vert1
ltypes=list("","dash","dashdot","dot") # match length of vert2
cat(paste0("Proceeding to assemble a ", hori, "x", vert, " multiplot.\n"))
cat(paste0("Your plot will show the columns/variables ",vertical[1]," & ",vertical[2]," in the vertical direction and ",horizontal[1]," in the horizontal direction.\n"))
cat(paste0(vertical[1], " will be plotted using the following colors: -> "))
for (n in 1:length(var_vert1)){
if (n<length(var_vert1)){
cat(paste0(var_vert1[n], ": ", colors[n], " - "))
}else{
cat(paste0(var_vert1[n], ": ", colors[n], "\n"))
}
}
cat(paste0(vertical[2], " will be plotted using the following linestyles: -> "))
for (n in 1:length(var_vert2)){
if (n<length(var_vert2)){
cat(paste0(var_vert2[n], ": ", ltypes[n], " - "))
}else{
cat(paste0(var_vert2[n], ": ", ltypes[n], "\n"))
}
}
rm(n)
cat(paste0(horizontal[1], " will be shown in the horizontal direction from ", var_hori1[1], " (left) to ", var_hori1[length(var_hori1)], " (right).\n"))
# assemble layout options for all subplots
# plot_specs set as default
plot_specs = list(sector=c(20,160), radialaxis=list(angle=90, range=c(0,max(dat1$rho_uncut_z)), tickfont=list(size=2)),
angularaxis=list(thetaunit='radians', direction="clockwise", rotation=0, tickfont=list(size=4)))
# set layout options for required number of subplots
for (i in 1:hori){
for (j in 1:vert){
specsX=list.append(plot_specs, domain=list(x=c((i-1)/hori+(1/hori*0.2), i/hori-1/hori*0.2),
y=c((j-1)/vert+(1/vert*0.1),j/vert-1/vert*0.1)))
assign(paste0("sub_plot",((j-1)*hori)+i), specsX)
}
}
rm(i, j, specsX)
# assemble smoothing splines for traces
for (i in 1:hori){
# subset data set by horizontal
dat2=dat1[dat1[,1]==var_hori1[i],]
for (j1 in 1:vert1){
# subset data set by vertical[1]
dat3=dat2[dat2[,2]==var_vert1[j1],]
for (j2 in 1:vert2){
# subset data set by vertical[2]
dat4=dat3[dat3[,3]==var_vert2[j2],]
if (!nrow(dat4)==0){
if (i+((j1-1)*vert)+((j2-1)*hori)+((j1-1)*vert)==1){
# assemble trace & assign number
traceX=list(theta=seq(min(dat4$theta_uncut_z)*180/pi,max(dat4$theta_uncut_z)*180/pi, length=100),
r=predict(smooth.spline(dat4$theta_uncut_z, dat4$rho_uncut_z),
seq(min(dat4$theta_uncut_z),max(dat4$theta_uncut_z), length=100))$y,
line=list(color=colors[j1], dash=ltypes[j2]))
assign(paste0("trace", i+((j1-1)*vert)+((j2-1)*hori)+((j1-1)*vert)), traceX)
}else if (i+((j1-1)*vert)+((j2-1)*hori)+((j1-1)*vert)<=hori){
# assemble trace & assign number
traceX=list(theta=seq(min(dat4$theta_uncut_z)*180/pi,max(dat4$theta_uncut_z)*180/pi, length=100),
r=predict(smooth.spline(dat4$theta_uncut_z, dat4$rho_uncut_z),
seq(min(dat4$theta_uncut_z),max(dat4$theta_uncut_z), length=100))$y,
line=list(color=colors[j1], dash=ltypes[j2]), subplot=paste0("polar",i+((j1-1)*vert)+((j2-1)*hori)+((j1-1)*vert)))
assign(paste0("trace",i+((j1-1)*vert)+((j2-1)*hori)+((j1-1)*vert)),traceX)
}else{
# assemble trace & assign number
traceX=list(theta=seq(min(dat4$theta_uncut_z)*180/pi,max(dat4$theta_uncut_z)*180/pi, length=100),
r=predict(smooth.spline(dat4$theta_uncut_z, dat4$rho_uncut_z),
seq(min(dat4$theta_uncut_z),max(dat4$theta_uncut_z), length=100))$y,
line=list(color=colors[j1], dash=ltypes[j2]), subplot=paste0("polar",i+((j1-1)*vert)+((j2-1)*hori)+((j1-1)*vert)), showlegend=FALSE)
assign(paste0("trace",i+((j1-1)*vert)+((j2-1)*hori)+((j1-1)*vert)),traceX)
}
}
}
}
}
rm(i, j1, j2, traceX, dat2, dat3, dat4)
# plot assembled traces with assembed layout specifications
p = plot_ly(type='scatterpolar', mode='lines')
dont_plot=c()
p = add_trace(p, theta=trace1$theta, r=trace1$r, line=list(color=trace1$line$color[[1]], dash=trace1$line$dash[[1]]))
for (k in 2:(hori*vert)){
if (exists(paste0("trace",k))){
p = add_trace(p, theta=get(paste0("trace",k))$theta, r=get(paste0("trace",k))$r,
subplot=get(paste0("trace",k))$subplot,
line=list(color=get(paste0("trace",k))$line$color[[1]], dash=get(paste0("trace",k))$line$dash[[1]]))
}else{
dont_plot=c(dont_plot,k)
}
}
# set layout
layout_comp = capture.output(
for (l in 1:(hori*vert)){
if (is.na(match(l, dont_plot))){
if (l==1){
cat(paste0("layout(p, polar=sub_plot",l,", "))
}else if (l<=hori){
cat(paste0("polar",l,"=sub_plot",l,", "))
}else if (l<hori*vert){
cat(paste0("polar",l,"=sub_plot",l,", "))
}else{
cat(paste0("polar",l,"=sub_plot",l,", showlegend=FALSE)"))
}
}
})
p; eval(parse(text=layout_comp))
# layout option 3
}else if (length(horizontal)==1 & length(vertical)==1){
# Subject, tokenPooled
hori=nrow(unique(select(dat1, horizontal[1])))
vert=nrow(unique(select(dat1, vertical[1])))
dat1=select(dat1, c(horizontal[1],vertical[1],cols2plot[1],cols2plot[2]))
dat1=droplevels(dat1)
var_hori1=levels(dat1[,1])
var_vert1=levels(dat1[,2])
# set up line types & colors
if (unique(df$native_lg=="Tongan") && vertical=="token"){
# levels(dfTongan$token)
colors=list("#D50D0B","#D50D0B","#003380","#003380","#FF7B00","#FF7B00","#009737","#009737","#C20088","#C20088","#191919","#191919","#191919","#191919","#191919")
ltypes=list("","dash","","dash","","dash","","dash","","dash","","dash","dashdot","dot","dash")
}else if (unique(df$native_lg=="Tongan") && vertical=="tokenPooled"){
colors=list("#D50D0B","#003380","#FF7B00","#009737","#C20088","#191919","#191919","#191919","#191919","#191919")
ltypes=list("","","","","","","dash","dashdot","dot","dash")
}else if (unique(df$native_lg=="NZE")){
# levels(dfNZE$token)
colors=list("#D50D0B","#990000","#0075DC","#E082B4","#003380","#FF7B00","#009737","#00AFC3","#C20088","#8F48B7","#ACB500","#7B4937","#6C6C6C","#191919","#191919","#191919","#191919","#191919")
ltypes=list("","","","","","","","","","","","","","","dash","dashdot","dot","dash")
}
cat(paste0("Proceeding to assemble a ", hori, "x", vert, " multiplot.\n"))
cat(paste0("Your plot will show the columns/variables ",horizontal[1]," in the horizontal direction and ",vertical[1]," in the vertical direction.\n"))
cat(paste0(vertical[1], " will be shown in the vertical direction from ", var_vert1[1], " (bottom) to ", var_vert1[length(var_vert1)], " (top).\n"))
# assemble layout options for all subplots
# plot_specs set as default
plot_specs = list(sector=c(20,160), radialaxis=list(angle=90, range=c(0,max(dat1$rho_uncut_z)), tickfont=list(size=2)),
angularaxis=list(thetaunit='radians', direction="clockwise", rotation=0, tickfont=list(size=4)))
# set layout options for required number of subplots
for (i in 1:hori){
for (j in 1:vert){
specsX=list.append(plot_specs, domain=list(x=c((i-1)/hori+(1/hori*0.2), i/hori-1/hori*0.2),
y=c((j-1)/vert+(1/vert*0.1),j/vert-1/vert*0.1)))
assign(paste0("sub_plot",((j-1)*hori)+i), specsX)
}
}
rm(i, j, specsX)
# assemble smoothing splines for traces
for (i in 1:hori){
# subset data set by horizontal
dat2=dat1[dat1[,1]==var_hori1[i],]
for (j in 1:vert){
# subset data set by vertical[1]
dat3=dat2[dat2[,2]==var_vert1[j],]
if (!nrow(dat3)==0){
if (i+(j-1)*hori==1){
# assemble trace & assign number
traceX=list(theta=seq(min(dat3$theta_uncut_z)*180/pi,max(dat3$theta_uncut_z)*180/pi, length=100),
r=predict(smooth.spline(dat3$theta_uncut_z, dat3$rho_uncut_z),
seq(min(dat3$theta_uncut_z),max(dat3$theta_uncut_z), length=100))$y,
line=list(color=colors[j], dash=ltypes[j]))
assign(paste0("trace", i+(j-1)*hori), traceX)
}else if (i+(j-1)*hori<=hori){
# assemble trace & assign number
traceX=list(theta=seq(min(dat3$theta_uncut_z)*180/pi,max(dat3$theta_uncut_z)*180/pi, length=100),
r=predict(smooth.spline(dat3$theta_uncut_z, dat3$rho_uncut_z),
seq(min(dat3$theta_uncut_z),max(dat3$theta_uncut_z), length=100))$y,
line=list(color=colors[j], dash=ltypes[j]), subplot=paste0("polar",i+(j-1)*hori))
assign(paste0("trace", i+(j-1)*hori), traceX)
}else{
# assemble trace & assign number
traceX=list(theta=seq(min(dat3$theta_uncut_z)*180/pi,max(dat3$theta_uncut_z)*180/pi, length=100),
r=predict(smooth.spline(dat3$theta_uncut_z, dat3$rho_uncut_z),
seq(min(dat3$theta_uncut_z),max(dat3$theta_uncut_z), length=100))$y,
line=list(color=colors[j], dash=ltypes[j]), subplot=paste0("polar",i+(j-1)*hori), showlegend=FALSE)
assign(paste0("trace", i+(j-1)*hori), traceX)
}
}
}
}
rm(i, j, traceX, dat2, dat3)
# plot assembled traces with assembed layout specifications
p = plot_ly(type='scatterpolar', mode='lines')
dont_plot=c()
p = add_trace(p, theta=trace1$theta, r=trace1$r, line=list(color=trace1$line$color[[1]], dash=trace1$line$dash[[1]]))
for (k in 2:(hori*vert)){
if (exists(paste0("trace",k))){
p = add_trace(p, theta=get(paste0("trace",k))$theta, r=get(paste0("trace",k))$r,
subplot=get(paste0("trace",k))$subplot,
line=list(color=get(paste0("trace",k))$line$color[[1]], dash=get(paste0("trace",k))$line$dash[[1]]))
}else{
dont_plot=c(dont_plot,k)
}
}
# set layout
layout_comp = capture.output(
for (l in 1:(hori*vert)){
if (is.na(match(l, dont_plot))){
if (l==1){
cat(paste0("layout(p, polar=sub_plot",l,", "))
}else if (l<=hori){
cat(paste0("polar",l,"=sub_plot",l,", "))
}else if (l<hori*vert){
cat(paste0("polar",l,"=sub_plot",l,", "))
}else{
cat(paste0("polar",l,"=sub_plot",l,", showlegend=FALSE)"))
}
}
})
p; eval(parse(text=layout_comp))
}else{
cat("Sorry, this layout is not yet implemented in the function. Currently the options are either 2 variables shown horizontally and 1 shown vertically or 1 horizontally and 2 vertically.\n")
cat("Usage: plotly_scatterpolar_multiplot(df, horizontal, vertical, cols2plot, print=TRUE) ->\n where df refers to the data.frame to plot, horizontal & vertical specify the column names to use as grouping variables,\n and cols2plot refers to the 2 columns of values to plot.\n")
cat("Use the c(x, y) notation to specify multiple colums for horizontal and/or vertical and for the cols2plot columns.\n")
}
}
}
df <- read.csv("GAMM_Trombone_data.csv", sep=',', stringsAsFactors = F)
# remove empty column
df$X = NULL
df$tokenPooled <- factor(df$tokenPooled)
df$subject <- factor(df$subject)
df$native_lg <- factor(df$native_lg)
# df$playing_proficiency[df$playing_proficiency == "intermediate"] <- "amateur"
df$playing_proficiency <- factor(df$playing_proficiency, levels = c("amateur","intermediate","semi-professional","professional"))
df$block <- factor(df$block)
df$point <- as.numeric(df$point)
df$note_intensity <- factor(df$note_intensity, levels = c("piano","mezzopiano","mezzoforte","forte"))
dfNotes <- subset(df,df$tokenPooled == "Bb2"|
df$tokenPooled == "Bb3"|
df$tokenPooled == "D4"|
df$tokenPooled == "F3"|
df$tokenPooled == "F4"
)
dfNotes$tokenPooled <- factor(dfNotes$tokenPooled, levels = c("Bb2","F3","Bb3","D4","F4"))
dfNotes <- subset(dfNotes,dfNotes$note_intensity == "forte"|
dfNotes$note_intensity == "mezzoforte"|
dfNotes$note_intensity == "mezzopiano"|
dfNotes$note_intensity == "piano"
)
dfNotes$note_intensity <- factor(dfNotes$note_intensity, levels = c("piano","mezzopiano","mezzoforte","forte"))
levels(dfNotes$tokenPooled)
[1] "Bb2" "F3" "Bb3" "D4" "F4"
levels(dfNotes$note_intensity)
[1] "piano" "mezzopiano" "mezzoforte" "forte"
levels(dfNotes$playing_proficiency)
[1] "amateur" "intermediate" "semi-professional" "professional"
dfVowelsFull <- subset(df,is.na(df$note_intensity))
dfVowelsFull$tokenPooled <- factor(dfVowelsFull$tokenPooled)
levels(dfVowelsFull$tokenPooled)
[1] "a" "ɐ" "ɐː" "ɒ" "e" "ə" "ə#" "ɛ" "ɘ" "F3" "i" "iː" "o" "oː" "ɵː" "u" "ʉː" "ʊ"
# creating a new dataset dfVowels that contains comparable vowels
# in the two languages
dfVowels <- subset(dfVowelsFull,dfVowelsFull$tokenPooled == "ɐ"|
dfVowelsFull$tokenPooled == "ɐː"|
dfVowelsFull$tokenPooled == "a"|
dfVowelsFull$tokenPooled == "e"|
dfVowelsFull$tokenPooled == "i"|
dfVowelsFull$tokenPooled == "iː"|
dfVowelsFull$tokenPooled == "ɛ"|
dfVowelsFull$tokenPooled == "o"|
dfVowelsFull$tokenPooled == "oː"|
dfVowelsFull$tokenPooled == "u"|
dfVowelsFull$tokenPooled == "ʉː")
dfVowels$tokenPooled <- factor(dfVowels$tokenPooled)
levels(dfVowels$tokenPooled)
[1] "a" "ɐ" "ɐː" "e" "ɛ" "i" "iː" "o" "oː" "u" "ʉː"
# creating a new variable TokenPooledNew and changing names of
# vowels in NZE to match those in Tongan.
dfVowels$tokenPooledNew <- dfVowels$tokenPooled
dfVowels$tokenPooledNew <- as.character(dfVowels$tokenPooledNew)
dfVowels$tokenPooledNew[dfVowels$tokenPooledNew == "ɐ"] <- "a"
dfVowels$tokenPooledNew[dfVowels$tokenPooledNew == "ɐː"] <- "a"
dfVowels$tokenPooledNew[dfVowels$tokenPooledNew == "ʉː"] <- "u"
dfVowels$tokenPooledNew[dfVowels$tokenPooledNew == "oː"] <- "o"
dfVowels$tokenPooledNew[dfVowels$tokenPooledNew == "iː"] <- "i"
dfVowels$tokenPooledNew[dfVowels$tokenPooledNew == "e" & dfVowels$native_lg == "NZE"] <- "i"
dfVowels$tokenPooledNew[dfVowels$tokenPooledNew == "ɛ"] <- "e"
dfVowels$tokenPooledNew <- as.factor(dfVowels$tokenPooledNew)
levels(dfVowels$tokenPooledNew)
[1] "a" "e" "i" "o" "u"
dfVowels$speech_preceding_soundNew <- dfVowels$speech_preceding_sound_IPA
dfVowels <- subset(dfVowels, dfVowels$speech_preceding_soundNew != "ɹ" &
dfVowels$speech_preceding_soundNew != "ʒ" &
dfVowels$speech_preceding_soundNew != "ð" &
dfVowels$speech_preceding_soundNew != "N" &
dfVowels$speech_preceding_soundNew != "o" &
dfVowels$speech_preceding_soundNew != "v" &
dfVowels$speech_preceding_soundNew != "w" &
dfVowels$speech_preceding_soundNew != "z"
)
dfVowels$speech_preceding_soundNew <- factor(dfVowels$speech_preceding_soundNew)
levels(dfVowels$speech_preceding_soundNew)
[1] "a" "b" "d" "e" "f" "g" "h" "i" "k" "l" "m" "n" "NULL"
[14] "ŋ" "p" "s" "ʃ" "t" "u" "ʔ"
dfVowels$speech_following_soundNew <- dfVowels$speech_following_sound
dfVowels <- subset(dfVowels, dfVowels$speech_following_soundNew != "ə" &
dfVowels$speech_following_soundNew != "ɫ" &
dfVowels$speech_following_soundNew != "ɹ" &
dfVowels$speech_following_soundNew != "ɾ" &
dfVowels$speech_following_soundNew != "ʒ" &
dfVowels$speech_following_soundNew != "θ" &
dfVowels$speech_following_soundNew != "a" &
dfVowels$speech_following_soundNew != "b" &
dfVowels$speech_following_soundNew != "ð" &
dfVowels$speech_following_soundNew != "g" &
dfVowels$speech_following_soundNew != "i" &
dfVowels$speech_following_soundNew != "o" &
dfVowels$speech_following_soundNew != "u" &
dfVowels$speech_following_soundNew != "e" &
dfVowels$speech_following_soundNew != "w"
)
dfVowels$speech_following_soundNew <- factor(dfVowels$speech_following_soundNew)
levels(dfVowels$speech_following_soundNew)
[1] "4" "5" "approximant_r" "d" "D"
[6] "f" "final_schwa" "glottal_stop" "h" "k"
[11] "l" "m" "n" "N" "NULL"
[16] "p" "s" "S" "t" "T"
[21] "v" "z" "Z"
kable(table(dfNotes$tokenPooled,dfNotes$note_intensity),format="html")
piano | mezzopiano | mezzoforte | forte | |
---|---|---|---|---|
Bb2 | 3000 | 3300 | 115300 | 9700 |
F3 | 7800 | 11800 | 225800 | 17800 |
Bb3 | 9700 | 5400 | 202800 | 13400 |
D4 | 5000 | 1900 | 75300 | 5600 |
F4 | 1200 | 100 | 25500 | 2400 |
kable(table(dfNotes$tokenPooled,dfNotes$native_lg),format="html")
NZE | Tongan | |
---|---|---|
Bb2 | 68700 | 62600 |
F3 | 130300 | 132900 |
Bb3 | 115000 | 116300 |
D4 | 43000 | 44800 |
F4 | 14500 | 14700 |
kable(table(dfNotes$note_intensity,dfNotes$native_lg),format="html")
NZE | Tongan | |
---|---|---|
piano | 16100 | 10600 |
mezzopiano | 14400 | 8100 |
mezzoforte | 314300 | 330400 |
forte | 26700 | 22200 |
kable(table(dfNotes$playing_proficiency,dfNotes$native_lg),format="html")
NZE | Tongan | |
---|---|---|
amateur | 169200 | 205700 |
intermediate | 62900 | 0 |
semi-professional | 44400 | 124700 |
professional | 95000 | 40900 |
kable(table(dfNotes$age_range,dfNotes$native_lg),format="html")
NZE | Tongan | |
---|---|---|
15-20 | 0 | 101700 |
20-25 | 43100 | 36900 |
25-30 | 61400 | 81700 |
30-35 | 126600 | 125300 |
35-40 | 15300 | 0 |
40-45 | 0 | 25700 |
60-65 | 37600 | 0 |
65-70 | 87500 | 0 |
kable(table(dfVowels$tokenPooledNew, dfVowels$native_lg),format="html")
NZE | Tongan | |
---|---|---|
a | 100700 | 98400 |
e | 56500 | 56400 |
i | 91800 | 90400 |
o | 31200 | 70300 |
u | 39100 | 44300 |
kable(table(dfVowels$age_range, dfVowels$native_lg),format="html")
NZE | Tongan | |
---|---|---|
15-20 | 0 | 116400 |
20-25 | 37400 | 36800 |
25-30 | 67300 | 75100 |
30-35 | 106600 | 112900 |
35-40 | 4600 | 0 |
40-45 | 0 | 18600 |
60-65 | 33000 | 0 |
65-70 | 70400 | 0 |
kable(table(dfVowels$speech_preceding_soundNew, dfVowels$native_lg),format="html")
NZE | Tongan | |
---|---|---|
a | 0 | 10400 |
b | 30800 | 0 |
d | 36900 | 0 |
e | 0 | 8000 |
f | 4000 | 5600 |
g | 23400 | 0 |
h | 10300 | 3300 |
i | 0 | 11900 |
k | 39900 | 48900 |
l | 38100 | 52200 |
m | 6600 | 17500 |
n | 21700 | 34500 |
NULL | 10500 | 38300 |
ŋ | 0 | 8000 |
p | 4400 | 20400 |
s | 31800 | 19900 |
ʃ | 21200 | 0 |
t | 39700 | 47400 |
u | 0 | 9100 |
ʔ | 0 | 24400 |
kable(table(dfVowels$speech_following_soundNew, dfVowels$native_lg),format="html")
NZE | Tongan | |
---|---|---|
4 | 400 | 0 |
5 | 100 | 0 |
approximant_r | 300 | 0 |
d | 39600 | 0 |
D | 3900 | 0 |
f | 11200 | 30200 |
final_schwa | 200 | 0 |
glottal_stop | 600 | 22000 |
h | 100 | 14800 |
k | 33600 | 35200 |
l | 0 | 1200 |
m | 27200 | 27200 |
n | 48200 | 40500 |
N | 3800 | 22600 |
NULL | 19900 | 47300 |
p | 19800 | 19300 |
s | 29500 | 25800 |
S | 6100 | 0 |
t | 49100 | 56500 |
T | 7200 | 0 |
v | 9800 | 17200 |
z | 7300 | 0 |
Z | 1400 | 0 |
kable(table(dfVowels$speech_preceding_soundNew, dfVowels$tokenPooledNew),format="html")
a | e | i | o | u | |
---|---|---|---|---|---|
a | 6100 | 900 | 2400 | 800 | 200 |
b | 6700 | 7100 | 9900 | 3700 | 3400 |
d | 14000 | 2900 | 10200 | 2700 | 7100 |
e | 1900 | 1900 | 2600 | 1000 | 600 |
f | 2000 | 2800 | 1900 | 2500 | 400 |
g | 9200 | 2700 | 6500 | 1500 | 3500 |
h | 1700 | 5000 | 3600 | 1600 | 1700 |
i | 2100 | 900 | 2500 | 4700 | 1700 |
k | 30300 | 16000 | 18300 | 17000 | 7200 |
l | 29500 | 14200 | 24700 | 12400 | 9500 |
m | 8100 | 5800 | 6700 | 1800 | 1700 |
n | 16000 | 4800 | 21800 | 7800 | 5800 |
NULL | 9900 | 11200 | 12200 | 7600 | 7900 |
ŋ | 3300 | 0 | 0 | 1300 | 3400 |
p | 5300 | 5400 | 7900 | 4400 | 1800 |
s | 11200 | 9500 | 17800 | 7600 | 5600 |
ʃ | 8700 | 2300 | 5800 | 1900 | 2500 |
t | 22500 | 14100 | 24100 | 15200 | 11200 |
u | 4000 | 1700 | 700 | 1400 | 1300 |
ʔ | 6600 | 3700 | 2600 | 4600 | 6900 |
kable(table(dfVowels$speech_following_soundNew, dfVowels$tokenPooledNew),format="html")
a | e | i | o | u | |
---|---|---|---|---|---|
4 | 0 | 300 | 0 | 100 | 0 |
5 | 0 | 100 | 0 | 0 | 0 |
approximant_r | 100 | 0 | 100 | 100 | 0 |
d | 9500 | 10800 | 10700 | 4500 | 4100 |
D | 2000 | 0 | 1900 | 0 | 0 |
f | 15400 | 5100 | 9200 | 9000 | 2700 |
final_schwa | 0 | 0 | 100 | 100 | 0 |
glottal_stop | 5500 | 5000 | 3400 | 2200 | 6500 |
h | 5700 | 700 | 1800 | 4200 | 2500 |
k | 24000 | 10700 | 20900 | 7200 | 6000 |
l | 100 | 200 | 500 | 200 | 200 |
m | 20600 | 7700 | 13000 | 4500 | 8600 |
n | 20000 | 14500 | 27100 | 16200 | 10900 |
N | 11500 | 4300 | 1700 | 7600 | 1300 |
NULL | 21900 | 5500 | 13400 | 14900 | 11500 |
p | 9900 | 12800 | 9300 | 2200 | 4900 |
s | 13100 | 7800 | 22000 | 5000 | 7400 |
S | 300 | 1600 | 2500 | 900 | 800 |
t | 26000 | 19500 | 32200 | 18200 | 9700 |
T | 2800 | 0 | 1800 | 0 | 2600 |
v | 9800 | 4600 | 6800 | 3700 | 2100 |
z | 900 | 1700 | 3200 | 600 | 900 |
Z | 0 | 0 | 600 | 100 | 700 |
Before running anything, we start by visualising the data
# run multiplot function
plotly_scatterpolar_multiplot(df=dfNotes, horizontal=c("native_lg","note_intensity"), vertical="tokenPooled", cols2plot=c("theta_uncut_z","rho_uncut_z"))
Proceeding to assemble a 8x5 multiplot.
Your plot will show the columns/variables native_lg & note_intensity in the horizontal direction and tokenPooled in the vertical direction.
native_lg will be plotted using the following linestyles: -> NZE: - Tongan: dash
note_intensity will be plotted using the following colors: -> piano: blue - mezzopiano: green - mezzoforte: orange - forte: red
tokenPooled will be shown in the vertical direction from Bb2 (bottom) to F4 (top).
Let’s start with the NZE data. We see that speakers are variable in how they are producing the notes according to their intensities (which is normal).
dfNotesNZE <- subset(dfNotes, dfNotes$native_lg == "NZE")
dfNotesNZE$subject <- factor(dfNotesNZE$subject)
plotly_scatterpolar_multiplot(df=dfNotesNZE, horizontal="subject", vertical=c("tokenPooled","note_intensity"), cols2plot=c("theta_uncut_z","rho_uncut_z"))
Proceeding to assemble a 10x20 multiplot.
Your plot will show the columns/variables tokenPooled & note_intensity in the vertical direction and subject in the horizontal direction.
tokenPooled will be plotted using the following colors: -> Bb2: blue - F3: green - Bb3: orange - D4: red - F4: gray
note_intensity will be plotted using the following linestyles: -> piano: - mezzopiano: dash - mezzoforte: dashdot - forte: dot
subject will be shown in the horizontal direction from S1 (left) to S5 (right).
Moving on to the Tongan data, we see again that speakers are variable in how they are producing the notes according to their intensities (which is normal).
dfNotesTongan <- subset(dfNotes, dfNotes$native_lg == "Tongan")
dfNotesTongan$subject <- factor(dfNotesTongan$subject)
plotly_scatterpolar_multiplot(df=dfNotesTongan, horizontal="subject", vertical=c("tokenPooled","note_intensity"), cols2plot=c("theta_uncut_z","rho_uncut_z"))
Proceeding to assemble a 10x20 multiplot.
Your plot will show the columns/variables tokenPooled & note_intensity in the vertical direction and subject in the horizontal direction.
tokenPooled will be plotted using the following colors: -> Bb2: blue - F3: green - Bb3: orange - D4: red - F4: gray
note_intensity will be plotted using the following linestyles: -> piano: - mezzopiano: dash - mezzoforte: dashdot - forte: dot
subject will be shown in the horizontal direction from S14 (left) to S4 (right).
The two observations on variations by note and intensity (that are within subject) are important. We will create a variable that combines subject, note and intensity. This will allow us later on to use these instead of subject only to model the within subject variation with respect to the two other predictors (note and intensity). We also create a new variable that combines language, note and intensity of the note to be used as a fixed effect and in adjustments.
dfNotes$noteIntenInt <- interaction(dfNotes$tokenPooled, dfNotes$note_intensity)
levels(dfNotes$noteIntenInt)
[1] "Bb2.piano" "F3.piano" "Bb3.piano" "D4.piano" "F4.piano"
[6] "Bb2.mezzopiano" "F3.mezzopiano" "Bb3.mezzopiano" "D4.mezzopiano" "F4.mezzopiano"
[11] "Bb2.mezzoforte" "F3.mezzoforte" "Bb3.mezzoforte" "D4.mezzoforte" "F4.mezzoforte"
[16] "Bb2.forte" "F3.forte" "Bb3.forte" "D4.forte" "F4.forte"
str(dfNotes$noteIntenInt)
Factor w/ 20 levels "Bb2.piano","F3.piano",..: 11 11 11 11 11 11 11 11 11 11 ...
dfNotes$langNoteInt <- interaction(dfNotes$native_lg,
dfNotes$tokenPooled, dfNotes$note_intensity)
levels(dfNotes$langNoteInt)
[1] "NZE.Bb2.piano" "Tongan.Bb2.piano" "NZE.F3.piano"
[4] "Tongan.F3.piano" "NZE.Bb3.piano" "Tongan.Bb3.piano"
[7] "NZE.D4.piano" "Tongan.D4.piano" "NZE.F4.piano"
[10] "Tongan.F4.piano" "NZE.Bb2.mezzopiano" "Tongan.Bb2.mezzopiano"
[13] "NZE.F3.mezzopiano" "Tongan.F3.mezzopiano" "NZE.Bb3.mezzopiano"
[16] "Tongan.Bb3.mezzopiano" "NZE.D4.mezzopiano" "Tongan.D4.mezzopiano"
[19] "NZE.F4.mezzopiano" "Tongan.F4.mezzopiano" "NZE.Bb2.mezzoforte"
[22] "Tongan.Bb2.mezzoforte" "NZE.F3.mezzoforte" "Tongan.F3.mezzoforte"
[25] "NZE.Bb3.mezzoforte" "Tongan.Bb3.mezzoforte" "NZE.D4.mezzoforte"
[28] "Tongan.D4.mezzoforte" "NZE.F4.mezzoforte" "Tongan.F4.mezzoforte"
[31] "NZE.Bb2.forte" "Tongan.Bb2.forte" "NZE.F3.forte"
[34] "Tongan.F3.forte" "NZE.Bb3.forte" "Tongan.Bb3.forte"
[37] "NZE.D4.forte" "Tongan.D4.forte" "NZE.F4.forte"
[40] "Tongan.F4.forte"
str(dfNotes$langNoteInt)
Factor w/ 40 levels "NZE.Bb2.piano",..: 22 22 22 22 22 22 22 22 22 22 ...
We are intersted in the effect of Native Language on the tongue position of musical notes in relation to their intensity. We create three new ordered predictors
dfNotes$native_lg.ord <- as.ordered(dfNotes$native_lg)
contrasts(dfNotes$native_lg.ord) <- "contr.treatment"
dfNotes$tokenPooled.ord <- as.ordered(dfNotes$tokenPooled)
contrasts(dfNotes$tokenPooled.ord) <- "contr.treatment"
dfNotes$note_intensity.ord <- as.ordered(dfNotes$note_intensity)
contrasts(dfNotes$note_intensity.ord) <- "contr.treatment"
dfNotes$langNoteInt.ord <- as.ordered(dfNotes$langNoteInt)
contrasts(dfNotes$langNoteInt.ord) <- "contr.treatment"
dfVowels$native_lg.ord <- as.ordered(dfVowels$native_lg)
contrasts(dfVowels$native_lg.ord) <- "contr.treatment"
dfVowels$tokenPooledNew.ord <- as.ordered(dfVowels$tokenPooledNew)
contrasts(dfVowels$tokenPooledNew.ord) <- "contr.treatment"
We create a new variable (start) when Point of tongue == 1. Our dataset is already ordered by speaker, by note, by intensity and by points of measurements.
dfNotes$start <- dfNotes$points==1
We start by running a model with no random effects. Just to evaluate structure.
if (run_models == TRUE){
mdl.sys.time1 <- system.time(Notes.gam.noAR.noRandom <- bam(rho_uncut_z ~ langNoteInt.ord +
## 1d smooths
s(theta_uncut_z, bs="cr", k=10) +
## 1d smooths * factors
s(theta_uncut_z, k=10, bs="cr", by=langNoteInt.ord),
data=dfNotes,discrete=TRUE,nthreads=ncores))
mdl.sys.time1
# # save model so that it can be reloaded later
saveRDS(Notes.gam.noAR.noRandom, paste0(output_dir,"/Notes.gam.noAR.noRandom.rds"))
capture.output(summary(Notes.gam.noAR.noRandom), file =
paste0(output_dir,"/summary_Notes.gam.noAR.noRandom.txt"))
}else{
# reload model
Notes.gam.noAR.noRandom = readRDS(paste0(output_dir,"/Notes.gam.noAR.noRandom.rds"))
}
summary(Notes.gam.noAR.noRandom)
Family: gaussian
Link function: identity
Formula:
rho_uncut_z ~ langNoteInt.ord + s(theta_uncut_z, bs = "cr", k = 10) +
s(theta_uncut_z, k = 10, bs = "cr", by = langNoteInt.ord)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 213.0172 0.5668 375.837 < 2e-16 ***
langNoteInt.ordTongan.Bb2.piano 7.4726 1.7031 4.388 1.15e-05 ***
langNoteInt.ordNZE.F3.piano 2.4840 0.9487 2.618 0.008838 **
langNoteInt.ordTongan.F3.piano 8.8295 0.9296 9.498 < 2e-16 ***
langNoteInt.ordNZE.Bb3.piano 6.0375 0.8775 6.880 5.99e-12 ***
langNoteInt.ordTongan.Bb3.piano 8.9175 0.9513 9.374 < 2e-16 ***
langNoteInt.ordNZE.D4.piano 7.1371 2.1611 3.302 0.000958 ***
langNoteInt.ordTongan.D4.piano 18.4862 2.1446 8.620 < 2e-16 ***
langNoteInt.ordNZE.F4.piano 14.2002 2.3560 6.027 1.67e-09 ***
langNoteInt.ordTongan.F4.piano 10.4258 1.1362 9.176 < 2e-16 ***
langNoteInt.ordNZE.Bb2.mezzopiano 6.4927 0.5078 12.787 < 2e-16 ***
langNoteInt.ordTongan.Bb2.mezzopiano 4.0760 3.8063 1.071 0.284245
langNoteInt.ordNZE.F3.mezzopiano 2.6786 1.0106 2.650 0.008041 **
langNoteInt.ordTongan.F3.mezzopiano 11.2574 1.6972 6.633 3.29e-11 ***
langNoteInt.ordNZE.Bb3.mezzopiano 6.0516 0.4798 12.612 < 2e-16 ***
langNoteInt.ordTongan.Bb3.mezzopiano 23.5412 3.2381 7.270 3.60e-13 ***
langNoteInt.ordNZE.D4.mezzopiano -0.1294 2.8748 -0.045 0.964084
langNoteInt.ordTongan.D4.mezzopiano 8.0803 3.6105 2.238 0.025224 *
langNoteInt.ordTongan.F4.mezzopiano -5.1305 5.1158 -1.003 0.315916
langNoteInt.ordNZE.Bb2.mezzoforte 0.1050 0.6632 0.158 0.874196
langNoteInt.ordTongan.Bb2.mezzoforte 6.1475 1.3390 4.591 4.41e-06 ***
langNoteInt.ordNZE.F3.mezzoforte 6.0076 0.5984 10.039 < 2e-16 ***
langNoteInt.ordTongan.F3.mezzoforte 10.3537 0.6393 16.195 < 2e-16 ***
langNoteInt.ordNZE.Bb3.mezzoforte 5.3990 0.6021 8.966 < 2e-16 ***
langNoteInt.ordTongan.Bb3.mezzoforte 5.0364 0.7853 6.414 1.42e-10 ***
langNoteInt.ordNZE.D4.mezzoforte 6.2444 0.6859 9.104 < 2e-16 ***
langNoteInt.ordTongan.D4.mezzoforte 7.0215 1.1541 6.084 1.17e-09 ***
langNoteInt.ordNZE.F4.mezzoforte 5.0801 0.8427 6.029 1.65e-09 ***
langNoteInt.ordTongan.F4.mezzoforte 7.7414 1.4961 5.174 2.29e-07 ***
langNoteInt.ordNZE.Bb2.forte 4.4002 0.6970 6.313 2.74e-10 ***
langNoteInt.ordTongan.Bb2.forte 3.8021 1.5454 2.460 0.013882 *
langNoteInt.ordNZE.F3.forte 5.5036 0.6859 8.024 1.02e-15 ***
langNoteInt.ordTongan.F3.forte 5.0509 1.2315 4.101 4.11e-05 ***
langNoteInt.ordNZE.Bb3.forte 5.9310 0.7772 7.631 2.32e-14 ***
langNoteInt.ordTongan.Bb3.forte 6.1954 1.4324 4.325 1.52e-05 ***
langNoteInt.ordNZE.D4.forte 8.6245 2.6400 3.267 0.001087 **
langNoteInt.ordTongan.D4.forte 14.6699 2.0012 7.331 2.29e-13 ***
langNoteInt.ordNZE.F4.forte 10.1427 1.6105 6.298 3.02e-10 ***
langNoteInt.ordTongan.F4.forte 16.6990 3.1356 5.326 1.01e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(theta_uncut_z) 8.578 8.769 442.830 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.piano 4.407 5.330 27.024 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.piano 6.530 7.323 27.087 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F3.piano 4.721 5.668 61.471 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.piano 7.001 7.831 34.162 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.piano 5.352 6.263 93.381 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.piano 6.736 7.424 16.204 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.D4.piano 6.258 6.968 122.810 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F4.piano 4.220 5.098 13.499 3.05e-13 ***
s(theta_uncut_z):langNoteInt.ordTongan.F4.piano 1.972 2.483 91.361 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzopiano 1.124 1.234 2.465 0.0847 .
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzopiano 2.517 3.099 21.589 1.03e-13 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzopiano 6.158 7.009 9.795 2.75e-12 ***
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzopiano 7.492 8.022 113.815 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzopiano 1.013 1.025 0.113 0.7413
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzopiano 6.128 6.790 40.603 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzopiano 3.881 4.560 5.628 5.83e-05 ***
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzopiano 4.965 5.708 111.063 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzopiano 2.999 3.667 21.821 1.07e-15 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzoforte 7.709 8.229 22.253 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzoforte 8.482 8.766 192.150 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzoforte 8.676 8.877 15.192 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzoforte 8.678 8.895 213.719 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzoforte 8.500 8.796 36.025 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzoforte 8.830 8.967 196.997 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzoforte 8.778 8.951 63.919 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzoforte 7.837 8.223 188.242 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F4.mezzoforte 8.471 8.837 44.451 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzoforte 7.355 7.805 132.911 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.forte 5.957 6.918 9.256 2.85e-11 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.forte 7.249 7.840 170.201 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.forte 5.907 6.832 13.291 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F3.forte 7.807 8.330 215.267 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.forte 6.427 7.262 20.115 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.forte 6.997 7.595 167.566 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.forte 6.388 7.108 30.162 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.D4.forte 6.403 7.072 160.842 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F4.forte 3.414 4.182 9.874 3.71e-08 ***
s(theta_uncut_z):langNoteInt.ordTongan.F4.forte 5.480 6.183 54.626 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
R-sq.(adj) = 0.493 Deviance explained = 49.3%
fREML = 3.1342e+06 Scale est. = 270.46 n = 742800
Our second model includes random effects for subject. Given the observed variations between the notes produced by speakers and according to intensity in both languages, we examine two models:
if (run_models == TRUE){
mdl.sys.time5 <- system.time(Notes.gam.noAR.Mod1 <- bam(rho_uncut_z ~ langNoteInt.ord +
## 1d smooths
s(theta_uncut_z, bs="cr", k=10) +
## 1d smooths * factors
s(theta_uncut_z, k=10, bs="cr", by=langNoteInt.ord) +
s(theta_uncut_z, subject, bs="fs", k=10, m=1),
data=dfNotes, discrete=TRUE, nthreads=ncores))
mdl.sys.time5
# save model so that it can be reloaded later
saveRDS(Notes.gam.noAR.Mod1, paste0(output_dir,"/Notes.gam.noAR.Mod1.rds"))
capture.output(summary(Notes.gam.noAR.Mod1), file =
paste0(output_dir,"/summary_Notes.gam.noAR.Mod1.txt"))
}else{
# reload model
Notes.gam.noAR.Mod1 = readRDS(paste0(output_dir,"/Notes.gam.noAR.Mod1.rds"))
}
## Model 2
if (run_models == TRUE){
mdl.sys.time6 <- system.time(Notes.gam.noAR.Mod2 <- bam(rho_uncut_z ~ langNoteInt.ord +
## 1d smooths
s(theta_uncut_z, bs="cr", k=10) +
## 1d smooths * factors
s(theta_uncut_z, k=10, bs="cr", by=langNoteInt.ord) +
## random smooths by subject, note and intensity
s(theta_uncut_z, subject, bs="fs", k=10, m=1, by=noteIntenInt),
data=dfNotes, discrete=TRUE, nthreads=ncores))
mdl.sys.time6
# save model so that it can be reloaded later
saveRDS(Notes.gam.noAR.Mod2, paste0(output_dir,"/Notes.gam.noAR.Mod2.rds"))
capture.output(summary(Notes.gam.noAR.Mod2), file =
paste0(output_dir,"/summary_Notes.gam.noAR.Mod2.txt"))
}else{
# reload model
Notes.gam.noAR.Mod2 = readRDS(paste0(output_dir,"/Notes.gam.noAR.Mod2.rds"))
}
k
gam.check(Notes.gam.noAR.Mod1)
Method: fREML Optimizer: perf chol
$grad
[1] 4.597180e-10 6.341532e-10 1.194125e-10 -7.896097e-10 -4.394556e-10 3.959424e-10
[7] -5.696865e-11 1.404099e-10 -1.336464e-11 3.476179e-10 2.997602e-11 -2.401662e-03
[13] -8.296164e-11 -2.472526e-09 1.191092e-10 3.971712e-10 -7.720669e-11 1.769371e-10
[19] 2.947056e-10 6.129501e-10 9.078249e-11 -2.482232e-10 2.998922e-08 2.000697e-10
[25] -1.664499e-09 -7.270717e-11 2.790864e-10 -7.344969e-11 -4.506138e-10 6.367484e-11
[31] 9.202106e-11 -1.727858e-10 -8.074346e-10 7.524115e-11 1.592025e-09 -1.030509e-11
[37] 9.588619e-10 -2.684120e-11 3.654255e-10 -8.963625e-09 1.274270e-10 -2.002344e-08
$hess
[,1] [,2] [,3] [,4] [,5] [,6]
2.605823e+00 5.012861e-04 5.318245e-03 9.643342e-04 9.327650e-02 3.584340e-03
5.012861e-04 2.192992e+00 -1.341285e-03 6.568124e-03 1.162043e-03 -5.020418e-03
5.318245e-03 -1.341285e-03 2.153807e+00 1.002775e-04 -4.731157e-02 -1.266306e-03
9.643342e-04 6.568124e-03 1.002775e-04 2.372189e+00 -6.452043e-04 -5.359462e-02
9.327650e-02 1.162043e-03 -4.731157e-02 -6.452043e-04 1.453578e+00 -6.429710e-04
3.584340e-03 -5.020418e-03 -1.266306e-03 -5.359462e-02 -6.429710e-04 1.151205e+00
1.124551e-02 6.496255e-04 -1.293983e-02 -9.475523e-04 -1.987892e-02 1.703578e-04
-2.160924e-03 -3.007292e-03 -8.607714e-05 -4.508422e-03 -6.295946e-04 -2.750255e-02
-3.561384e-03 2.115890e-05 -1.940893e-02 -1.019878e-04 -8.350815e-03 -2.247671e-04
1.953489e-03 -5.016340e-03 -1.951715e-03 -9.942705e-03 7.161469e-04 -1.854246e-02
-3.530021e-03 1.910112e-04 1.151904e-01 1.004015e-03 3.859976e-02 1.143434e-03
3.276668e-05 1.372479e-05 -9.359491e-07 -2.121244e-05 4.304682e-06 -7.519772e-05
1.750921e-02 8.374202e-04 -4.415803e-03 -1.288875e-03 -4.123862e-02 8.992806e-04
-5.139993e-03 2.155965e-02 3.087907e-03 -3.015937e-02 -5.036422e-04 -3.788018e-04
1.427977e-02 3.398550e-04 1.211289e-02 4.094691e-04 6.696846e-03 1.641448e-03
3.442201e-03 -5.178372e-03 -1.953005e-03 1.158395e-02 1.932358e-04 7.245857e-03
-8.163562e-03 1.795375e-04 1.131962e-02 -5.704507e-05 -2.803600e-03 2.814824e-04
-2.312779e-03 1.808694e-03 4.268026e-04 -6.332382e-03 -2.964937e-04 -1.506917e-02
-7.177385e-04 -4.180115e-04 5.457187e-05 -2.115630e-04 -1.596727e-04 1.555707e-03
-5.113316e-02 -4.885984e-03 7.638214e-02 6.826474e-03 9.881642e-02 2.242192e-03
2.410296e-02 -2.140135e-02 -6.129948e-03 -8.890876e-03 -3.916885e-03 -1.695663e-02
-2.914458e-01 -3.316918e-03 1.251081e-01 1.124229e-03 2.880843e-01 2.346491e-03
1.105395e-01 3.968861e-02 1.856194e-02 -2.629679e-02 -4.225838e-02 1.563352e-02
[,7] [,8] [,9] [,10] [,11] [,12]
1.124551e-02 -2.160924e-03 -3.561384e-03 1.953489e-03 -3.530021e-03 3.276668e-05
6.496255e-04 -3.007292e-03 2.115890e-05 -5.016340e-03 1.910112e-04 1.372479e-05
-1.293983e-02 -8.607714e-05 -1.940893e-02 -1.951715e-03 1.151904e-01 -9.359491e-07
-9.475523e-04 -4.508422e-03 -1.019878e-04 -9.942705e-03 1.004015e-03 -2.121244e-05
-1.987892e-02 -6.295946e-04 -8.350815e-03 7.161469e-04 3.859976e-02 4.304682e-06
1.703578e-04 -2.750255e-02 -2.247671e-04 -1.854246e-02 1.143434e-03 -7.519772e-05
2.001559e+00 2.478908e-04 -6.692286e-03 2.730831e-04 1.000928e-02 1.731293e-06
2.478908e-04 2.355253e+00 -1.909814e-04 4.697002e-03 -1.187054e-04 -2.043225e-05
-6.692286e-03 -1.909814e-04 1.240432e+00 -1.585636e-04 -2.832318e-02 1.248037e-06
2.730831e-04 4.697002e-03 -1.585636e-04 1.860632e+00 7.202741e-04 6.280270e-06
1.000928e-02 -1.187054e-04 -2.832318e-02 7.202741e-04 1.958161e+00 2.059233e-06
1.731293e-06 -2.043225e-05 1.248037e-06 6.280270e-06 2.059233e-06 2.386540e-03
-5.826161e-02 9.198693e-04 1.525312e-03 4.431826e-04 2.033510e-02 2.118459e-06
-6.210102e-04 7.451712e-03 4.362318e-04 7.517835e-03 4.743696e-05 -4.449718e-05
-2.460104e-02 3.152826e-04 -5.821206e-02 2.817653e-04 -2.002687e-01 5.916435e-06
2.826211e-04 1.918360e-04 -2.686261e-04 -1.232852e-03 2.351721e-04 6.897814e-07
-2.049026e-03 4.153310e-05 -2.077156e-02 1.784596e-04 -4.280206e-02 6.722659e-07
8.381883e-05 -1.089470e-02 -1.928575e-05 6.913276e-03 -2.762632e-04 -2.753721e-05
-1.672066e-04 1.973802e-03 -3.020979e-05 8.422714e-04 -6.741772e-05 3.560547e-05
5.189056e-02 5.451869e-04 4.982341e-03 -2.334708e-03 -1.993118e-01 -5.813571e-06
-3.526735e-03 2.697949e-02 -1.876196e-03 -5.024370e-02 1.498921e-03 -4.530682e-05
3.670964e-02 2.526583e-03 -2.039448e-02 -2.221923e-03 -1.406984e-01 -1.177906e-05
-3.501503e-03 1.207420e-02 -2.070318e-03 8.388635e-03 -1.386570e-02 -7.340560e-05
[,13] [,14] [,15] [,16] [,17] [,18]
1.750921e-02 -5.139993e-03 1.427977e-02 3.442201e-03 -8.163562e-03 -2.312779e-03
8.374202e-04 2.155965e-02 3.398550e-04 -5.178372e-03 1.795375e-04 1.808694e-03
-4.415803e-03 3.087907e-03 1.211289e-02 -1.953005e-03 1.131962e-02 4.268026e-04
-1.288875e-03 -3.015937e-02 4.094691e-04 1.158395e-02 -5.704507e-05 -6.332382e-03
-4.123862e-02 -5.036422e-04 6.696846e-03 1.932358e-04 -2.803600e-03 -2.964937e-04
8.992806e-04 -3.788018e-04 1.641448e-03 7.245857e-03 2.814824e-04 -1.506917e-02
-5.826161e-02 -6.210102e-04 -2.460104e-02 2.826211e-04 -2.049026e-03 8.381883e-05
9.198693e-04 7.451712e-03 3.152826e-04 1.918360e-04 4.153310e-05 -1.089470e-02
1.525312e-03 4.362318e-04 -5.821206e-02 -2.686261e-04 -2.077156e-02 -1.928575e-05
4.431826e-04 7.517835e-03 2.817653e-04 -1.232852e-03 1.784596e-04 6.913276e-03
2.033510e-02 4.743696e-05 -2.002687e-01 2.351721e-04 -4.280206e-02 -2.762632e-04
2.118459e-06 -4.449718e-05 5.916435e-06 6.897814e-07 6.722659e-07 -2.753721e-05
1.851815e+00 -9.090741e-04 -3.430274e-02 4.064845e-04 8.457589e-03 1.366917e-04
-9.090741e-04 1.454382e+00 1.256797e-03 1.911629e-02 -1.780102e-04 -1.880340e-03
-3.430274e-02 1.256797e-03 1.873324e+00 -4.896715e-04 -6.062616e-02 5.770607e-05
4.064845e-04 1.911629e-02 -4.896715e-04 1.890224e+00 1.432312e-04 1.082619e-03
8.457589e-03 -1.780102e-04 -6.062616e-02 1.432312e-04 1.921398e+00 -1.762012e-05
1.366917e-04 -1.880340e-03 5.770607e-05 1.082619e-03 -1.762012e-05 1.781030e+00
-4.161393e-04 3.278134e-03 -3.566567e-04 -1.990091e-04 -3.602391e-05 -2.225433e-03
3.316679e-02 7.126852e-03 -1.207792e-01 -3.470945e-03 5.371893e-03 -1.498070e-04
-5.008181e-03 4.649701e-02 -7.216575e-03 -1.771996e-02 -4.947747e-04 5.352350e-02
6.907925e-02 1.350858e-03 -8.372983e-02 -5.998502e-04 -3.719846e-02 1.081107e-03
-2.110858e-03 -1.111350e-01 -1.428449e-02 3.861536e-02 -1.244212e-03 9.540621e-03
[,19] [,20] [,21] [,22] [,23] [,24]
-7.177385e-04 -5.113316e-02 2.410296e-02 -2.914458e-01 0.1105394775 1.863044e-01
-4.180115e-04 -4.885984e-03 -2.140135e-02 -3.316918e-03 0.0396886058 4.750001e-03
5.457187e-05 7.638214e-02 -6.129948e-03 1.251081e-01 0.0185619352 -2.553086e-03
-2.115630e-04 6.826474e-03 -8.890876e-03 1.124229e-03 -0.0262967891 -4.144312e-03
-1.596727e-04 9.881642e-02 -3.916885e-03 2.880843e-01 -0.0422583833 -2.578566e-01
1.555707e-03 2.242192e-03 -1.695663e-02 2.346491e-03 0.0156335216 -1.089849e-03
-1.672066e-04 5.189056e-02 -3.526735e-03 3.670964e-02 -0.0035015031 -5.941672e-02
1.973802e-03 5.451869e-04 2.697949e-02 2.526583e-03 0.0120742033 -9.792391e-04
-3.020979e-05 4.982341e-03 -1.876196e-03 -2.039448e-02 -0.0020703182 -2.866675e-02
8.422714e-04 -2.334708e-03 -5.024370e-02 -2.221923e-03 0.0083886348 3.133895e-03
-6.741772e-05 -1.993118e-01 1.498921e-03 -1.406984e-01 -0.0138656964 7.430220e-02
3.560547e-05 -5.813571e-06 -4.530682e-05 -1.177906e-05 -0.0000734056 1.123796e-05
-4.161393e-04 3.316679e-02 -5.008181e-03 6.907925e-02 -0.0021108582 -1.120088e-01
3.278134e-03 7.126852e-03 4.649701e-02 1.350858e-03 -0.1111349849 -5.112802e-03
-3.566567e-04 -1.207792e-01 -7.216575e-03 -8.372983e-02 -0.0142844890 4.546169e-02
-1.990091e-04 -3.470945e-03 -1.771996e-02 -5.998502e-04 0.0386153594 2.574431e-03
-3.602391e-05 5.371893e-03 -4.947747e-04 -3.719846e-02 -0.0012442123 -1.943718e-02
-2.225433e-03 -1.498070e-04 5.352350e-02 1.081107e-03 0.0095406208 -6.256886e-04
1.425163e+00 1.307782e-04 2.476317e-02 2.297252e-04 0.0121864611 -5.196789e-04
1.307782e-04 2.118300e+00 1.098788e-02 -3.037775e-01 0.0293737281 3.713034e-01
2.476317e-02 1.098788e-02 1.970729e+00 8.219763e-03 0.0090400875 -1.070062e-02
2.297252e-04 -3.037775e-01 8.219763e-03 1.437187e+00 0.1346754463 4.824060e-01
1.218646e-02 2.937373e-02 9.040088e-03 1.346754e-01 2.0540735595 -9.799389e-02
[,25] [,26] [,27] [,28] [,29] [,30]
-0.0109200321 9.424059e-02 -1.443619e-02 5.691162e-02 -2.463889e-04 -1.640267e-02
0.0124615679 1.866912e-03 2.160027e-02 1.043388e-03 7.155162e-03 9.803022e-04
0.0021120257 -5.463668e-03 8.540198e-05 -9.989298e-03 2.827651e-03 5.520732e-02
0.0632387105 -1.202336e-03 3.864184e-02 -6.472053e-04 -3.077838e-02 -1.726245e-03
0.0017202681 -1.239712e-01 -4.951594e-04 -9.230165e-02 -1.924702e-03 3.567010e-02
0.0766916309 -4.289512e-04 3.987772e-02 -5.750278e-04 -2.862443e-02 1.385764e-03
0.0007769706 -2.100504e-02 -7.513207e-05 -8.069038e-03 -9.689961e-04 -3.441119e-02
-0.0441389939 -5.801406e-04 -8.299130e-04 -5.378681e-04 -3.550867e-03 1.102922e-03
0.0003516007 -4.750658e-03 -5.744607e-04 -2.745752e-03 1.452595e-04 3.109046e-04
0.0621633229 1.378810e-03 5.313239e-02 7.894934e-04 -1.088709e-03 3.431238e-04
-0.0009002990 2.833726e-02 -2.756187e-03 1.655355e-02 -1.375262e-04 -4.514281e-02
-0.0001276604 4.844118e-06 -4.239892e-04 2.413802e-06 -3.658916e-06 3.570340e-06
0.0019441917 -4.153693e-02 -1.373462e-03 -1.510895e-02 -1.123951e-03 -1.022002e-01
-0.0305868910 -1.852941e-03 -4.021388e-02 -1.111598e-03 -2.140134e-02 -7.759210e-04
0.0012840525 1.525776e-02 -4.461264e-03 9.917581e-03 3.231305e-04 -6.865081e-02
-0.0009931109 9.634109e-04 -1.151789e-02 5.594816e-04 1.231708e-02 4.106165e-04
-0.0001904536 -8.620991e-04 -5.088863e-04 1.421052e-04 -2.291423e-04 9.837426e-04
-0.0133393819 -3.839397e-04 -6.689243e-02 -2.918784e-04 -4.566778e-03 4.306393e-04
0.0081582262 -1.975529e-04 -1.612569e-02 -5.654399e-05 5.302072e-04 -4.180651e-04
0.0001193108 1.350013e-01 -8.460544e-03 7.272871e-02 9.057195e-03 -3.973988e-02
0.1931569170 -3.274669e-03 2.152602e-01 -8.714242e-04 -6.158915e-03 -8.613381e-03
-0.0040593269 2.753084e-01 8.748913e-04 2.039639e-01 5.650859e-03 -1.152506e-01
-0.0537739092 -4.901030e-02 1.879801e-02 -2.949261e-02 -4.532730e-02 1.121624e-02
[,31] [,32] [,33] [,34] [,35] [,36]
1.059369e-02 -1.333259e-02 5.897999e-03 -1.093860e-02 1.853938e-02 1.915607e-03
-2.690077e-04 1.347504e-03 -5.250485e-03 -1.137380e-03 -9.923597e-03 -6.723875e-04
1.419763e-03 1.166352e-01 3.965550e-03 4.837698e-02 -1.861190e-04 -9.781191e-02
-3.174394e-02 -1.537879e-03 -7.034565e-03 1.765196e-03 -1.096471e-04 -1.423215e-04
-2.994202e-03 1.110578e-02 5.786229e-04 1.021890e-02 2.511200e-03 -3.543226e-02
-3.605867e-02 3.870685e-04 5.545969e-03 -6.409174e-04 9.184798e-03 -7.738774e-04
-1.949715e-03 -1.880933e-02 -5.601822e-04 4.259786e-02 -8.558434e-05 -1.312259e-02
-2.446119e-04 3.873156e-04 3.794879e-03 -6.083196e-04 4.229298e-02 4.049169e-05
-1.735069e-04 -1.548547e-02 1.090919e-03 9.936337e-03 9.613387e-04 -1.379674e-02
-7.356313e-03 1.158998e-03 -7.006485e-03 -3.564043e-04 -2.408564e-02 -1.034261e-03
6.685078e-04 -3.849861e-02 9.702982e-04 -1.692960e-02 1.886471e-03 7.423005e-02
2.504571e-05 5.893864e-07 9.473749e-05 -3.763200e-06 -2.127863e-05 -9.301557e-07
-2.790053e-03 -6.854218e-02 -7.098751e-04 7.644030e-02 -1.319401e-03 -3.138178e-02
-1.588186e-03 -2.716598e-03 2.769055e-03 8.335987e-04 2.564745e-02 1.452863e-03
-7.741032e-04 3.594905e-02 3.237069e-03 8.863383e-02 2.584819e-03 4.581512e-02
8.458165e-03 1.450234e-03 9.869051e-03 -3.970545e-04 3.343685e-04 -9.859736e-04
-2.250131e-04 -1.458794e-02 3.192754e-05 7.107722e-03 3.657848e-04 8.528148e-03
2.723050e-04 -1.567021e-04 3.220751e-02 -3.301834e-04 2.527442e-02 1.894823e-04
-4.007053e-03 -1.922369e-04 2.770360e-03 3.110580e-04 -8.917428e-03 -1.299010e-05
1.242231e-02 -3.656499e-03 9.530481e-03 -1.440387e-01 -5.685523e-04 2.835918e-02
-2.023581e-02 5.503400e-04 -7.417148e-02 8.334404e-03 -4.894286e-03 -2.996339e-03
7.701753e-03 -1.245110e-01 -2.059872e-03 -3.908017e-02 -8.834257e-03 7.787371e-02
7.077793e-03 -4.403908e-03 -1.931575e-02 9.252135e-04 4.375022e-02 1.078930e-02
[,37] [,38] [,39] [,40] [,41] [,42]
-1.978689e-03 -2.097860e-04 -1.031141e-02 -2.985702e-01 2.134990e-04 -3.328111e+00
-2.528599e-03 -8.089858e-04 -5.971001e-03 -6.887900e-03 -1.677578e-03 -3.144996e+00
3.233495e-04 -8.118942e-02 -9.598916e-05 9.727858e-02 8.799713e-03 -2.685404e+00
7.281175e-03 1.738891e-04 5.526787e-03 2.789436e-02 1.153067e-03 -3.018486e+00
-7.660370e-05 -2.473419e-02 -1.467088e-03 4.470283e-02 -6.537484e-03 -3.539809e+00
-6.211941e-03 -5.168141e-05 2.055156e-02 -4.287527e-03 -2.157283e-03 -2.379551e+00
1.508139e-04 -9.644774e-03 -5.428751e-04 3.613257e-04 -1.516333e-03 -3.292778e+00
-1.421211e-02 3.815129e-04 7.534758e-03 2.356229e-03 2.549408e-04 -2.788538e+00
-9.370279e-06 -1.059826e-02 -4.812508e-04 7.773987e-03 2.780245e-05 -1.853104e+00
1.436896e-02 -1.036918e-03 -7.175085e-03 -9.955920e-03 -1.517894e-03 -2.422667e+00
-5.565677e-04 4.261505e-02 -5.997492e-04 -5.602651e-02 -5.953180e-03 -2.276551e+00
-1.418142e-05 -2.264579e-07 2.599112e-04 8.088634e-05 -2.684443e-06 -1.623705e-03
-2.046961e-05 -2.411149e-02 -5.636199e-04 1.327395e-02 -5.138883e-03 -3.115953e+00
1.981786e-02 1.819897e-03 1.269015e-02 -8.407391e-04 -1.017179e-02 -2.769772e+00
-4.160925e-04 -1.114804e-02 -2.073318e-03 -3.954180e-03 -5.762824e-03 -2.400317e+00
-4.288054e-03 -1.117677e-03 -6.778227e-04 1.381986e-02 7.402344e-05 -3.132712e+00
-2.982804e-05 -5.836321e-04 -1.987138e-04 -7.342678e-03 -9.380168e-05 -2.033496e+00
-2.133482e-02 2.723796e-04 1.468471e-02 3.985723e-03 1.118045e-04 -2.069745e+00
-7.149188e-03 -1.123335e-04 -9.363734e-03 1.181004e-04 2.738036e-04 -1.662068e+00
-2.048167e-03 -4.382315e-03 1.663099e-03 1.119849e-01 4.693282e-03 -3.031820e+00
8.758692e-02 -3.884546e-03 -4.406886e-02 -4.738562e-02 3.884010e-03 -2.603059e+00
2.600781e-04 2.285161e-02 4.033810e-03 -2.819951e-03 1.026599e-02 -3.289092e+00
5.852510e-02 1.269887e-02 1.292290e-02 1.141696e-01 2.354994e-02 -3.385242e+00
[ reached getOption("max.print") -- omitted 19 rows ]
Model rank = 590 / 590
Basis dimension (k) checking results. Low p-value (k-index<1) may
indicate that k is too low, especially if edf is close to k'.
k' edf k-index p-value
s(theta_uncut_z) 9.00 7.66 1.02 0.93
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.piano 9.00 7.29 1.02 0.93
s(theta_uncut_z):langNoteInt.ordNZE.F3.piano 9.00 6.37 1.02 0.95
s(theta_uncut_z):langNoteInt.ordTongan.F3.piano 9.00 7.04 1.02 0.92
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.piano 9.00 8.08 1.02 0.94
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.piano 9.00 5.76 1.02 0.91
s(theta_uncut_z):langNoteInt.ordNZE.D4.piano 9.00 7.59 1.02 0.92
s(theta_uncut_z):langNoteInt.ordTongan.D4.piano 9.00 6.58 1.02 0.94
s(theta_uncut_z):langNoteInt.ordNZE.F4.piano 9.00 4.71 1.02 0.89
s(theta_uncut_z):langNoteInt.ordTongan.F4.piano 9.00 5.85 1.02 0.93
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzopiano 9.00 5.55 1.02 0.92
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzopiano 9.00 1.01 1.02 0.92
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzopiano 9.00 7.23 1.02 0.96
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzopiano 9.00 6.54 1.02 0.90
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzopiano 9.00 5.80 1.02 0.91
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzopiano 9.00 7.27 1.02 0.91
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzopiano 9.00 5.07 1.02 0.96
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzopiano 9.00 5.14 1.02 0.93
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzopiano 9.00 4.32 1.02 0.95
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzoforte 9.00 7.06 1.02 0.92
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzoforte 9.00 6.21 1.02 0.92
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzoforte 9.00 7.58 1.02 0.93
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzoforte 9.00 7.77 1.02 0.91
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzoforte 9.00 8.21 1.02 0.95
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzoforte 9.00 6.82 1.02 0.91
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzoforte 9.00 8.83 1.02 0.90
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzoforte 9.00 2.92 1.02 0.93
s(theta_uncut_z):langNoteInt.ordNZE.F4.mezzoforte 9.00 8.81 1.02 0.93
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzoforte 9.00 7.79 1.02 0.92
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.forte 9.00 8.04 1.02 0.92
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.forte 9.00 7.24 1.02 0.92
s(theta_uncut_z):langNoteInt.ordNZE.F3.forte 9.00 7.01 1.02 0.96
s(theta_uncut_z):langNoteInt.ordTongan.F3.forte 9.00 5.58 1.02 0.95
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.forte 9.00 7.38 1.02 0.94
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.forte 9.00 4.95 1.02 0.93
s(theta_uncut_z):langNoteInt.ordNZE.D4.forte 9.00 6.38 1.02 0.93
s(theta_uncut_z):langNoteInt.ordTongan.D4.forte 9.00 6.05 1.02 0.94
s(theta_uncut_z):langNoteInt.ordNZE.F4.forte 9.00 5.47 1.02 0.94
s(theta_uncut_z):langNoteInt.ordTongan.F4.forte 9.00 2.53 1.02 0.89
s(theta_uncut_z,subject) 200.00 183.48 1.02 0.92
gam.check(Notes.gam.noAR.Mod2)
Method: fREML Optimizer: perf chol
$grad
[1] -5.222272e-10 8.350765e-12 -1.231396e-10 -9.292633e-11 1.811995e-11 -5.204726e-11
[7] -2.396273e-03 -1.588668e-03 1.092700e-10 -2.696555e-03 -4.656371e-03 -3.161904e-11
[13] -7.747108e-04 -1.405542e-12 -1.321252e-03 -2.320477e-11 -3.048507e-03 -2.795972e-04
[19] 3.805001e-11 -5.218573e-03 -4.260883e-03 -2.468364e-04 2.313252e-10 5.363745e-10
[25] -1.447102e-10 1.140523e-10 2.561795e-11 -6.216494e-11 -2.303289e-03 -1.954304e-03
[31] -4.756062e-11 -3.355731e-04 6.134826e-11 8.658185e-12 1.446976e-11 7.443729e-11
[37] -8.418866e-11 -2.753393e-03 -3.874406e-11 -3.331856e-09 -2.475824e-03 -1.514877e-11
[43] -2.442762e-05 -1.058709e-11 -6.909762e-11 -7.964474e-11 3.163019e-05 5.464074e-11
[49] -1.688094e-12 6.773426e-11 3.899170e-11 7.136691e-11 -1.316147e-11 8.218137e-11
[55] 7.227330e-11 -1.309122e-10 -2.919032e-03 -6.818727e-04 -6.394885e-14 -3.251444e-10
[61] -6.520207e-11 -1.413596e-09 -1.934790e-10 -3.347367e-10 2.191847e-10 -1.819132e-10
[67] -1.343290e-10 -3.437748e-10 -1.449276e-10 -1.353300e-10 1.212830e-10 -5.768186e-11
[73] 2.577392e-03 -2.322054e-10 -4.619860e-11 9.106316e-11 2.079813e-03 2.257821e-10
[79] -1.168684e-03 2.734014e-07
$hess
[,1] [,2] [,3] [,4] [,5] [,6]
3.739219e+00 2.150094e-02 1.233462e-02 2.895253e-02 -1.273032e-02 2.400762e-02
2.150094e-02 2.639166e-01 -8.111032e-03 -1.233008e-02 -3.178739e-03 -1.116114e-02
1.233462e-02 -8.111032e-03 2.951862e-01 -1.433907e-02 -3.212881e-04 -9.926526e-03
2.895253e-02 -1.233008e-02 -1.433907e-02 9.323236e-01 3.690898e-03 -1.701150e-02
-1.273032e-02 -3.178739e-03 -3.212881e-04 3.690898e-03 1.716922e-01 4.167569e-03
2.400762e-02 -1.116114e-02 -9.926526e-03 -1.701150e-02 4.167569e-03 7.920162e-01
-4.565461e-05 1.584773e-05 2.004673e-05 3.093920e-05 -1.012116e-05 2.672589e-05
3.515328e-04 -8.877418e-05 -1.705543e-04 -2.317190e-04 8.670706e-05 -1.830336e-04
-1.092927e-02 3.354776e-03 7.709000e-03 1.351940e-02 -9.841460e-03 1.242516e-02
4.234221e-05 -1.072672e-05 -2.471389e-05 -3.432032e-05 1.498256e-05 -2.788293e-05
-2.599818e-04 1.426588e-04 1.749421e-04 2.048318e-04 3.980359e-06 1.528377e-04
8.629746e-03 -3.450466e-03 -3.935068e-03 -7.164342e-03 3.019521e-03 -6.788055e-03
[,7] [,8] [,9] [,10] [,11] [,12]
-4.565461e-05 3.515328e-04 -1.092927e-02 4.234221e-05 -2.599818e-04 8.629746e-03
1.584773e-05 -8.877418e-05 3.354776e-03 -1.072672e-05 1.426588e-04 -3.450466e-03
2.004673e-05 -1.705543e-04 7.709000e-03 -2.471389e-05 1.749421e-04 -3.935068e-03
3.093920e-05 -2.317190e-04 1.351940e-02 -3.432032e-05 2.048318e-04 -7.164342e-03
-1.012116e-05 8.670706e-05 -9.841460e-03 1.498256e-05 3.980359e-06 3.019521e-03
2.672589e-05 -1.830336e-04 1.242516e-02 -2.788293e-05 1.528377e-04 -6.788055e-03
2.390279e-03 3.583597e-07 -2.570318e-05 4.082966e-08 -3.590105e-07 1.198904e-05
3.583597e-07 1.629841e-03 1.884914e-04 -4.980448e-07 2.174345e-06 -8.669557e-05
-2.570318e-05 1.884914e-04 5.074544e-01 2.966495e-05 -1.106578e-04 6.514558e-03
4.082966e-08 -4.980448e-07 2.966495e-05 2.689582e-03 2.272947e-07 -1.414858e-05
-3.590105e-07 2.174345e-06 -1.106578e-04 2.272947e-07 4.634628e-03 5.769053e-05
1.198904e-05 -8.669557e-05 6.514558e-03 -1.414858e-05 5.769053e-05 1.451856e-01
[,13] [,14] [,15] [,16] [,17] [,18]
-3.094108e-04 -2.592338e-03 -5.450309e-05 2.237123e-02 -2.253035e-05 9.127725e-05
6.073118e-05 -3.549889e-03 2.923942e-05 -9.369437e-03 7.490036e-06 1.040034e-06
2.091152e-04 5.121692e-03 6.080866e-05 -7.050686e-03 8.125874e-06 -4.791532e-05
2.749158e-04 -4.659774e-03 7.740101e-05 -1.125168e-02 1.097623e-05 -6.471130e-05
-1.608471e-04 1.177553e-02 -2.677789e-05 1.250315e-03 -1.611147e-06 4.646551e-05
2.100436e-04 -1.009772e-02 6.134533e-05 -9.714236e-03 8.607872e-06 -4.919592e-05
-5.241099e-07 1.085912e-05 -1.399502e-07 1.585450e-05 -1.837240e-08 1.118429e-07
3.925781e-06 -4.355060e-05 9.958679e-07 -1.105098e-04 1.196100e-07 -1.065258e-06
-2.811214e-04 1.279642e-02 -6.920117e-05 5.465505e-03 -6.282922e-06 7.214447e-05
5.434709e-07 -1.081008e-05 1.395288e-07 -1.421217e-05 1.313144e-08 -1.784474e-07
-2.994892e-06 -4.081463e-05 -8.854351e-07 1.134384e-04 -1.341655e-07 5.211065e-07
1.058399e-04 -5.324920e-03 2.913120e-05 -3.477986e-03 3.243601e-06 -2.838238e-05
[,19] [,20] [,21] [,22] [,23] [,24]
-3.274723e-03 1.866758e-04 7.331886e-05 -4.956315e-05 3.453877e-02 1.067170e-01
-1.744747e-03 4.614511e-05 -1.885602e-05 4.337098e-06 -6.139318e-03 -4.498531e-04
3.249535e-03 1.055323e-04 -2.122462e-05 7.599894e-06 2.689770e-03 9.750410e-03
6.895522e-03 1.018102e-04 -7.467281e-05 1.071937e-05 -5.142913e-03 6.459458e-03
-5.004158e-03 -2.982802e-05 5.879582e-05 -8.256877e-06 5.860890e-03 5.551644e-03
6.912837e-03 6.081338e-05 -8.370276e-05 9.405360e-06 -9.307623e-03 5.824547e-03
-1.573624e-05 -1.930258e-07 9.791086e-08 -2.242368e-08 1.279898e-05 -9.309202e-06
1.119332e-04 1.272449e-06 -1.018538e-06 1.501242e-07 -2.496786e-05 7.179764e-05
-9.749873e-03 -9.127035e-05 8.959306e-05 -1.318590e-05 9.252928e-03 -6.982865e-03
2.104726e-05 1.542482e-07 -2.305786e-07 2.072170e-08 -1.106031e-05 9.652775e-06
-3.546355e-05 -1.675260e-06 -4.758647e-09 -1.479145e-07 1.179655e-05 -7.907256e-05
4.581427e-03 2.558805e-05 -4.497993e-05 4.676267e-06 -4.621483e-03 3.420841e-03
[,25] [,26] [,27] [,28] [,29] [,30]
1.226104e-02 -6.054072e-03 1.643114e-02 -2.336169e-02 2.900606e-04 3.654734e-05
-1.682313e-03 3.712714e-03 -1.464032e-03 -2.567522e-03 -6.991736e-05 -8.048525e-06
-3.298002e-03 1.081638e-02 3.254692e-03 -4.507587e-03 -2.146523e-04 -2.835420e-05
-4.412362e-03 1.621142e-02 -7.211024e-03 4.369636e-03 -3.292289e-04 -3.471046e-05
-1.277315e-03 -1.160769e-02 1.311938e-02 -1.344791e-02 2.213250e-04 1.737693e-05
-5.606369e-03 1.393800e-02 -1.111116e-02 7.325124e-03 -2.897145e-04 -2.550622e-05
9.632156e-06 -2.980039e-05 1.486656e-05 -1.323412e-05 4.965884e-07 4.105754e-08
-3.379778e-05 2.314273e-04 -1.010155e-04 8.768583e-05 -4.820771e-06 -5.304050e-07
5.612630e-03 -1.918872e-02 1.350425e-02 -1.159121e-02 3.712965e-04 3.135690e-05
-1.181121e-05 3.578607e-05 -1.960720e-05 1.647650e-05 -8.965100e-07 -1.000342e-07
4.532836e-05 -1.484116e-04 -3.353955e-05 4.663180e-05 2.213937e-06 2.420304e-07
-3.199759e-03 7.253036e-03 -6.152937e-03 4.805620e-03 -1.535832e-04 -1.290980e-05
[,31] [,32] [,33] [,34] [,35] [,36]
1.526930e-02 -4.219910e-05 3.282684e-02 -3.853697e-02 3.472859e-03 -1.741884e-02
-1.163835e-02 1.950299e-05 -9.134113e-03 1.444622e-02 -6.039480e-03 5.337883e-03
-4.511609e-03 3.489681e-05 2.769865e-03 1.221816e-02 2.444394e-03 8.534030e-03
-1.205271e-02 4.142425e-05 -8.787064e-03 1.924898e-02 -4.714296e-03 1.237418e-02
5.957920e-03 -1.045021e-05 1.175864e-02 -2.029823e-03 8.086089e-03 -5.363043e-03
-1.331080e-02 3.062368e-05 -1.241362e-02 1.710445e-02 -7.323821e-03 1.023444e-02
1.757851e-05 -7.299742e-08 1.382844e-05 -3.117616e-05 7.245068e-06 -2.143790e-05
-9.925022e-05 5.175822e-07 -7.095231e-05 1.989527e-04 -2.995267e-05 1.585958e-04
1.043426e-02 -3.186293e-05 1.027197e-02 -1.149384e-02 6.981138e-03 -1.088182e-02
-1.459439e-05 6.643862e-08 -1.056781e-05 2.593994e-05 -4.512623e-06 2.266273e-05
9.173466e-05 -5.282637e-07 3.386642e-06 -2.070257e-04 -4.669255e-06 -1.255515e-04
-5.058320e-03 1.339188e-05 -4.925844e-03 6.864367e-03 -2.798981e-03 4.731649e-03
[,37] [,38] [,39] [,40] [,41] [,42]
3.300158e-03 -2.440536e-04 1.515509e-02 3.249768e-02 7.883717e-05 5.197862e-02
2.447627e-03 4.014184e-05 -5.076922e-03 5.956120e-01 -1.721228e-04 -1.898407e-02
-2.131251e-03 1.323539e-04 -6.210848e-03 -3.462442e-02 -3.113297e-05 2.221233e-01
-4.455107e-03 2.111527e-04 -8.843505e-03 -3.452407e-02 -3.304677e-05 1.057075e-01
9.160424e-03 -1.489599e-04 2.395000e-03 1.895220e-02 3.495076e-06 -1.086118e-02
-3.856131e-03 1.811441e-04 -7.195901e-03 -2.011649e-02 -2.112066e-05 -1.271708e-02
8.125858e-06 -4.129716e-07 1.319244e-05 5.051300e-05 4.415289e-08 2.123373e-05
-9.589611e-05 3.017278e-06 -1.064404e-04 -5.598689e-04 -4.016588e-07 -1.751272e-04
9.106574e-03 -2.395732e-04 6.053812e-03 3.235601e-02 1.547460e-05 -2.679755e-03
-1.680303e-05 4.398085e-07 -1.576195e-05 -9.106365e-05 -5.228602e-08 -1.840287e-05
1.049036e-05 -1.887959e-06 8.759181e-05 3.785424e-04 4.103956e-07 2.652843e-04
-2.593381e-03 9.470925e-05 -3.036827e-03 -1.045297e-02 -7.138049e-06 -2.545782e-03
[,43] [,44] [,45] [,46] [,47] [,48]
2.635989e-05 -1.481265e-02 -1.837017e-02 -1.114633e-02 8.260741e-06 -3.126815e-02
-4.521647e-06 -8.644738e-03 -1.017492e-03 9.211840e-03 -1.877284e-06 2.173448e-03
1.966612e-04 -6.185919e-03 -3.253473e-03 -2.433562e-03 -3.058417e-06 -1.681805e-04
-8.170723e-05 -3.512804e-03 -1.269106e-03 -2.028655e-03 -2.435522e-06 7.144570e-03
-3.364442e-06 2.576325e-01 1.399548e-01 8.109595e-03 -1.811051e-06 -1.097688e-02
-3.082946e-06 2.809239e-01 -2.758261e-02 -4.746043e-04 -1.178611e-06 9.668171e-03
6.216872e-09 2.834935e-07 1.079971e-06 -1.442796e-03 -4.318859e-07 -1.782087e-05
-4.989199e-08 1.724867e-05 -4.829399e-06 1.548122e-03 -1.746650e-06 8.565269e-05
-1.001166e-06 -7.478541e-03 -9.639794e-04 8.992834e-03 -3.506411e-07 3.781570e-01
-4.961488e-09 5.137608e-06 -2.785202e-07 -3.043866e-05 -3.041573e-09 -2.124152e-03
7.138113e-08 8.793660e-05 3.457937e-05 -3.682892e-05 3.822189e-08 -3.102375e-05
-7.281557e-07 5.770568e-04 -5.645545e-05 -2.673023e-03 -2.322994e-07 4.609268e-03
[,49] [,50] [,51] [,52] [,53] [,54]
1.590416e-03 -6.037523e-02 3.407396e-03 -6.528217e-03 4.872454e-03 1.920957e-03
-5.190489e-04 2.364491e-02 -1.061469e-03 -2.346540e-03 -9.508350e-04 2.269802e-04
-8.308846e-04 1.725201e-02 3.694330e-04 -1.568377e-03 -2.006578e-03 7.160268e-03
-1.026293e-03 2.359367e-02 1.106531e-03 5.286455e-03 -1.476019e-03 1.004500e-02
-9.283287e-05 7.410302e-03 -3.606302e-03 -1.142598e-02 -8.763141e-04 -3.299802e-03
-7.837396e-04 1.972909e-02 1.044938e-03 9.191425e-03 -5.715688e-04 9.406625e-03
1.682437e-06 -3.583193e-05 -2.447212e-06 -2.026220e-05 1.778281e-06 -2.525148e-05
-1.289709e-05 1.854512e-04 2.593271e-05 6.491624e-05 -1.839957e-05 1.537252e-04
-2.413037e-03 -3.516757e-03 -3.372920e-03 -1.530203e-02 1.106421e-05 -1.358519e-02
1.454577e-05 9.286968e-06 4.641634e-06 1.062393e-05 -2.229721e-06 2.532938e-05
1.163699e-05 -4.011102e-04 -2.134259e-04 -1.071105e-05 2.558746e-05 -1.147918e-04
-3.689114e-04 2.059533e-01 -3.182110e-02 5.671549e-03 -1.174260e-04 6.179868e-03
[,55] [,56] [,57] [,58] [,59] [,60]
1.010091e-02 -1.091533e-02 8.952351e-05 5.837364e-06 5.681035e-27 -4.799675e-02
1.579218e-03 1.303786e-02 -2.750875e-05 -3.477619e-06 -3.309502e-28 1.442764e-03
3.813152e-03 -2.633467e-03 -3.376736e-05 1.851428e-07 4.129027e-27 2.586508e-03
1.778430e-03 -1.499573e-03 -4.256115e-05 4.000026e-06 5.240981e-27 -3.043317e-02
3.197103e-03 1.011468e-02 4.450944e-06 -4.996000e-07 -5.157100e-27 4.287587e-02
4.079453e-04 4.500366e-05 -3.162064e-05 5.689790e-06 4.002079e-27 -4.339336e-02
-2.001546e-06 6.555842e-06 6.182609e-08 -1.305771e-08 -9.491574e-30 5.719921e-05
1.461834e-05 -1.167955e-04 -4.887573e-07 5.995590e-08 8.595399e-29 -4.185080e-04
2.994104e-04 1.123870e-02 2.177431e-05 -6.505493e-06 -7.465953e-27 5.634868e-02
1.408804e-06 -2.760286e-05 -6.502173e-08 1.650455e-08 1.425973e-29 -9.434677e-05
-4.847511e-05 -2.955410e-05 4.852547e-07 5.749122e-09 -4.538535e-29 -1.127599e-04
-4.304391e-05 -2.776498e-03 -1.186896e-05 4.498253e-06 2.318982e-27 -2.535919e-02
[,61] [,62] [,63] [,64] [,65] [,66]
-4.424785e-03 -1.811129e-01 1.299360e-03 -1.212064e-01 -7.598785e-03 -7.596663e-02
1.909691e-03 1.064722e-02 1.335177e-03 -1.345293e-03 6.707868e-04 -5.383923e-03
-2.698422e-04 1.213013e-02 -3.768402e-04 -3.084354e-03 -1.704748e-03 -2.553358e-03
-4.323269e-04 2.623169e-02 -4.880348e-04 -1.112692e-03 3.399878e-04 -2.498967e-03
3.773048e-03 -2.996179e-02 2.581496e-03 -6.572909e-03 -1.681865e-03 -6.982900e-03
-1.073934e-04 2.069269e-02 1.379867e-04 -3.669756e-03 1.383797e-03 -4.596559e-03
1.176689e-06 -4.808208e-05 8.658448e-07 3.587242e-06 -1.119748e-06 2.047761e-06
-2.474975e-05 3.918896e-04 -2.194312e-05 2.963869e-05 4.326119e-08 2.418376e-05
3.083527e-03 -2.584579e-02 1.523899e-03 5.949873e-03 -9.692417e-04 1.829603e-03
-4.526544e-06 5.028637e-05 -3.249005e-06 -2.163515e-06 3.618646e-07 1.021648e-06
-6.088773e-06 -2.456567e-04 -1.713093e-06 2.700462e-05 1.501671e-05 3.058999e-05
-3.944749e-04 8.808158e-03 -9.715874e-05 -2.655210e-03 6.662207e-04 -1.982237e-03
[,67] [,68] [,69] [,70] [,71] [,72]
-4.140214e-02 -5.408217e-02 -3.471658e-02 4.463672e-02 1.425549e-02 -9.823463e-02
1.147488e-03 -6.849389e-03 1.034123e-03 5.427021e-03 6.423612e-04 3.141403e-02
-4.779388e-03 -7.901484e-03 -5.139484e-03 -6.790491e-03 5.745022e-03 2.210017e-02
6.232373e-04 -2.035537e-02 3.520483e-04 -1.393202e-02 3.489781e-03 3.978696e-02
-5.624905e-03 1.269645e-02 -6.673477e-03 1.991099e-02 1.154685e-03 -7.279067e-03
2.677773e-03 -2.539507e-02 2.276156e-03 -1.109447e-02 1.260406e-03 3.649793e-02
-2.560926e-06 3.429463e-05 -1.982027e-06 1.769843e-05 -5.203371e-06 -7.184623e-05
9.414633e-06 -2.281397e-04 7.263905e-06 -2.627127e-04 5.014505e-05 4.212495e-04
-1.756778e-03 2.974359e-02 -2.044903e-03 1.731120e-02 -2.506116e-03 -2.639375e-02
1.714324e-06 -5.231244e-05 1.189123e-06 -4.826423e-05 7.232527e-06 5.063540e-05
4.069185e-05 7.682282e-05 4.509627e-05 1.050162e-06 -6.672325e-05 -4.470010e-04
1.273785e-03 -1.378734e-02 1.025419e-03 -6.402921e-03 6.152634e-04 1.518484e-02
[,73] [,74] [,75] [,76] [,77] [,78]
3.583007e-05 -1.166339e-01 -1.247084e-02 -2.492670e-03 1.741338e-05 1.918727e-02
-1.586354e-06 1.173269e-02 1.607155e-04 1.113173e-02 4.068661e-08 -9.383989e-03
1.862070e-06 2.940639e-03 -2.438003e-03 1.252470e-02 5.656715e-06 2.744075e-03
8.309517e-08 1.459837e-02 -1.855806e-04 1.532413e-02 1.435221e-06 1.349165e-02
1.433563e-06 -6.431046e-03 -2.802059e-03 2.500803e-04 -1.785988e-06 -2.382155e-02
-2.330525e-07 1.462702e-02 7.623114e-04 1.296754e-02 -1.930749e-06 1.729869e-02
-2.521855e-10 -2.317073e-05 -4.353767e-07 -2.765917e-05 -1.003544e-09 -4.042186e-05
3.121772e-10 1.515550e-04 -1.005874e-06 1.587208e-04 3.411741e-08 2.478111e-04
-1.100606e-06 -5.428721e-03 -8.499488e-04 -1.194704e-02 -2.648436e-06 -3.438186e-02
7.673594e-10 1.762437e-05 1.484798e-07 2.288596e-05 4.307353e-09 4.807871e-05
-9.342239e-09 -8.918991e-05 2.315934e-05 -2.069970e-04 -6.800161e-08 -3.114856e-05
1.676069e-07 5.418989e-03 3.917517e-04 5.661248e-03 -1.209708e-06 1.244319e-02
[,79] [,80]
1.356053e-05 -3.835982e+00
3.912791e-06 -8.400919e-01
-3.421644e-06 -5.901800e-01
-6.489829e-06 -1.083965e+00
7.424382e-06 -7.473124e-01
-5.507864e-06 -1.151671e+00
1.300291e-08 -4.895556e-04
-1.335029e-07 -5.232824e-03
9.404771e-06 -7.930655e-01
-2.364314e-08 -2.109711e-04
1.982545e-08 -3.152078e-03
-3.989904e-06 -4.183449e-01
[ reached getOption("max.print") -- omitted 68 rows ]
Model rank = 4390 / 4390
Basis dimension (k) checking results. Low p-value (k-index<1) may
indicate that k is too low, especially if edf is close to k'.
k' edf k-index p-value
s(theta_uncut_z) 9.00e+00 8.67e+00 1 0.35
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.piano 9.00e+00 2.68e+00 1 0.38
s(theta_uncut_z):langNoteInt.ordNZE.F3.piano 9.00e+00 2.18e+00 1 0.36
s(theta_uncut_z):langNoteInt.ordTongan.F3.piano 9.00e+00 3.17e+00 1 0.34
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.piano 9.00e+00 2.49e+00 1 0.35
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.piano 9.00e+00 3.30e+00 1 0.37
s(theta_uncut_z):langNoteInt.ordNZE.D4.piano 9.00e+00 1.01e+00 1 0.39
s(theta_uncut_z):langNoteInt.ordTongan.D4.piano 9.00e+00 1.01e+00 1 0.35
s(theta_uncut_z):langNoteInt.ordNZE.F4.piano 9.00e+00 2.59e+00 1 0.39
s(theta_uncut_z):langNoteInt.ordTongan.F4.piano 9.00e+00 1.01e+00 1 0.39
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzopiano 9.00e+00 1.02e+00 1 0.36
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzopiano 9.00e+00 1.84e+00 1 0.36
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzopiano 9.00e+00 1.01e+00 1 0.34
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzopiano 9.00e+00 5.87e+00 1 0.39
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzopiano 9.00e+00 1.01e+00 1 0.41
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzopiano 9.00e+00 4.21e+00 1 0.35
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzopiano 9.00e+00 1.01e+00 1 0.34
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzopiano 9.00e+00 1.01e+00 1 0.30
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzopiano 9.00e+00 4.18e+00 1 0.39
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzoforte 9.00e+00 1.02e+00 1 0.40
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzoforte 9.00e+00 1.02e+00 1 0.36
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzoforte 9.00e+00 1.00e+00 1 0.34
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzoforte 9.00e+00 6.82e+00 1 0.41
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzoforte 9.00e+00 5.19e+00 1 0.35
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzoforte 9.00e+00 4.98e+00 1 0.39
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzoforte 9.00e+00 3.38e+00 1 0.41
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzoforte 9.00e+00 3.98e+00 1 0.38
s(theta_uncut_z):langNoteInt.ordNZE.F4.mezzoforte 9.00e+00 3.76e+00 1 0.38
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzoforte 9.00e+00 1.03e+00 1 0.41
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.forte 9.00e+00 1.00e+00 1 0.35
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.forte 9.00e+00 4.61e+00 1 0.33
s(theta_uncut_z):langNoteInt.ordNZE.F3.forte 9.00e+00 1.00e+00 1 0.38
s(theta_uncut_z):langNoteInt.ordTongan.F3.forte 9.00e+00 5.72e+00 1 0.31
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.forte 9.00e+00 3.34e+00 1 0.41
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.forte 9.00e+00 6.21e+00 1 0.34
s(theta_uncut_z):langNoteInt.ordNZE.D4.forte 9.00e+00 1.94e+00 1 0.38
s(theta_uncut_z):langNoteInt.ordTongan.D4.forte 9.00e+00 3.09e+00 1 0.41
s(theta_uncut_z):langNoteInt.ordNZE.F4.forte 9.00e+00 1.02e+00 1 0.38
s(theta_uncut_z):langNoteInt.ordTongan.F4.forte 9.00e+00 1.68e+00 1 0.40
s(theta_uncut_z,subject):noteIntenIntBb2.piano 2.00e+02 8.66e+01 1 0.35
s(theta_uncut_z,subject):noteIntenIntF3.piano 2.00e+02 1.18e+02 1 0.40
s(theta_uncut_z,subject):noteIntenIntBb3.piano 2.00e+02 1.25e+02 1 0.28
s(theta_uncut_z,subject):noteIntenIntD4.piano 2.00e+02 1.21e+02 1 0.40
s(theta_uncut_z,subject):noteIntenIntF4.piano 2.00e+02 5.48e+01 1 0.38
s(theta_uncut_z,subject):noteIntenIntBb2.mezzopiano 2.00e+02 3.32e+01 1 0.36
s(theta_uncut_z,subject):noteIntenIntF3.mezzopiano 2.00e+02 1.24e+02 1 0.39
s(theta_uncut_z,subject):noteIntenIntBb3.mezzopiano 2.00e+02 1.11e+02 1 0.35
s(theta_uncut_z,subject):noteIntenIntD4.mezzopiano 2.00e+02 2.48e+01 1 0.35
s(theta_uncut_z,subject):noteIntenIntF4.mezzopiano 2.00e+02 5.81e-03 1 0.42
s(theta_uncut_z,subject):noteIntenIntBb2.mezzoforte 2.00e+02 1.71e+02 1 0.34
s(theta_uncut_z,subject):noteIntenIntF3.mezzoforte 2.00e+02 1.74e+02 1 0.39
s(theta_uncut_z,subject):noteIntenIntBb3.mezzoforte 2.00e+02 1.71e+02 1 0.34
s(theta_uncut_z,subject):noteIntenIntD4.mezzoforte 2.00e+02 1.59e+02 1 0.35
s(theta_uncut_z,subject):noteIntenIntF4.mezzoforte 2.00e+02 1.45e+02 1 0.36
s(theta_uncut_z,subject):noteIntenIntBb2.forte 2.00e+02 1.28e+02 1 0.38
s(theta_uncut_z,subject):noteIntenIntF3.forte 2.00e+02 1.38e+02 1 0.34
s(theta_uncut_z,subject):noteIntenIntBb3.forte 2.00e+02 1.33e+02 1 0.39
s(theta_uncut_z,subject):noteIntenIntD4.forte 2.00e+02 1.26e+02 1 0.40
s(theta_uncut_z,subject):noteIntenIntF4.forte 2.00e+02 9.38e+01 1 0.34
summary(Notes.gam.noAR.Mod1)
Family: gaussian
Link function: identity
Formula:
rho_uncut_z ~ langNoteInt.ord + s(theta_uncut_z, bs = "cr", k = 10) +
s(theta_uncut_z, k = 10, bs = "cr", by = langNoteInt.ord) +
s(theta_uncut_z, subject, bs = "fs", k = 10, m = 1)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 220.0141 11.5001 19.131 < 2e-16 ***
langNoteInt.ordTongan.Bb2.piano -9.9031 15.8093 -0.626 0.53105
langNoteInt.ordNZE.F3.piano 2.0675 0.7197 2.873 0.00407 **
langNoteInt.ordTongan.F3.piano -9.3024 15.6670 -0.594 0.55267
langNoteInt.ordNZE.Bb3.piano 7.2213 0.7308 9.881 < 2e-16 ***
langNoteInt.ordTongan.Bb3.piano -10.3189 15.6615 -0.659 0.50998
langNoteInt.ordNZE.D4.piano 10.3209 1.8874 5.468 4.55e-08 ***
langNoteInt.ordTongan.D4.piano -4.9010 15.7111 -0.312 0.75508
langNoteInt.ordNZE.F4.piano 11.2321 1.6297 6.892 5.51e-12 ***
langNoteInt.ordTongan.F4.piano -9.0475 15.7260 -0.575 0.56507
langNoteInt.ordNZE.Bb2.mezzopiano 3.6730 0.6970 5.270 1.37e-07 ***
langNoteInt.ordTongan.Bb2.mezzopiano -13.5918 15.7118 -0.865 0.38700
langNoteInt.ordNZE.F3.mezzopiano 2.3798 0.8886 2.678 0.00740 **
langNoteInt.ordTongan.F3.mezzopiano -10.3496 15.6643 -0.661 0.50880
langNoteInt.ordNZE.Bb3.mezzopiano 5.3348 0.6835 7.805 5.93e-15 ***
langNoteInt.ordTongan.Bb3.mezzopiano -0.8983 15.9532 -0.056 0.95509
langNoteInt.ordNZE.D4.mezzopiano -0.6941 3.2263 -0.215 0.82966
langNoteInt.ordTongan.D4.mezzopiano -12.6210 15.8136 -0.798 0.42481
langNoteInt.ordTongan.F4.mezzopiano -23.0377 16.5419 -1.393 0.16371
langNoteInt.ordNZE.Bb2.mezzoforte 1.4546 0.6074 2.395 0.01662 *
langNoteInt.ordTongan.Bb2.mezzoforte -9.8525 15.6534 -0.629 0.52908
langNoteInt.ordNZE.F3.mezzoforte 3.6283 0.5923 6.125 9.05e-10 ***
langNoteInt.ordTongan.F3.mezzoforte -9.3077 15.6503 -0.595 0.55203
langNoteInt.ordNZE.Bb3.mezzoforte 5.0614 0.5947 8.511 < 2e-16 ***
langNoteInt.ordTongan.Bb3.mezzoforte -10.2151 15.6512 -0.653 0.51397
langNoteInt.ordNZE.D4.mezzoforte 6.4908 0.6300 10.303 < 2e-16 ***
langNoteInt.ordTongan.D4.mezzoforte -10.3672 15.6563 -0.662 0.50786
langNoteInt.ordNZE.F4.mezzoforte 5.9797 0.7026 8.511 < 2e-16 ***
langNoteInt.ordTongan.F4.mezzoforte -12.1222 15.6971 -0.772 0.43996
langNoteInt.ordNZE.Bb2.forte 3.1020 0.6642 4.670 3.01e-06 ***
langNoteInt.ordTongan.Bb2.forte -13.0803 15.6747 -0.834 0.40401
langNoteInt.ordNZE.F3.forte 4.7461 0.6481 7.323 2.42e-13 ***
langNoteInt.ordTongan.F3.forte -10.8924 15.6571 -0.696 0.48663
langNoteInt.ordNZE.Bb3.forte 5.8687 0.6985 8.402 < 2e-16 ***
langNoteInt.ordTongan.Bb3.forte -11.7036 15.6622 -0.747 0.45491
langNoteInt.ordNZE.D4.forte 8.7341 1.6006 5.457 4.85e-08 ***
langNoteInt.ordTongan.D4.forte -7.8214 15.6859 -0.499 0.61804
langNoteInt.ordNZE.F4.forte 8.1765 2.0798 3.931 8.44e-05 ***
langNoteInt.ordTongan.F4.forte -7.5539 15.6778 -0.482 0.62993
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(theta_uncut_z) 7.656 8.023 6.950 4.27e-09 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.piano 7.290 7.827 35.268 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.piano 6.371 7.164 24.797 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F3.piano 7.037 7.749 10.500 2.22e-13 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.piano 8.080 8.662 14.929 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.piano 5.759 6.615 3.364 0.00103 **
s(theta_uncut_z):langNoteInt.ordNZE.D4.piano 7.586 7.941 21.841 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.D4.piano 6.577 7.241 20.466 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F4.piano 4.706 5.592 16.916 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F4.piano 5.845 6.653 10.761 1.20e-11 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzopiano 5.553 6.454 17.323 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzopiano 1.008 1.015 5.890 0.01487 *
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzopiano 7.232 7.780 15.365 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzopiano 6.540 7.178 8.459 9.59e-10 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzopiano 5.801 6.727 8.880 1.92e-10 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzopiano 7.265 7.756 9.457 1.50e-12 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzopiano 5.067 5.623 30.802 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzopiano 5.139 5.846 15.784 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzopiano 4.324 5.084 18.183 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzoforte 7.064 7.670 16.778 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzoforte 6.206 6.869 6.801 7.04e-08 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzoforte 7.578 8.117 16.954 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzoforte 7.770 8.285 14.297 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzoforte 8.206 8.584 28.224 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzoforte 6.816 7.394 8.443 1.31e-10 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzoforte 8.833 8.955 47.709 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzoforte 2.918 3.387 2.833 0.02789 *
s(theta_uncut_z):langNoteInt.ordNZE.F4.mezzoforte 8.813 8.966 35.696 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzoforte 7.788 8.040 41.574 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.forte 8.042 8.609 21.858 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.forte 7.245 7.831 27.993 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.forte 7.006 7.728 36.225 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.F3.forte 5.579 6.418 7.946 8.84e-09 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.forte 7.378 8.047 28.265 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.forte 4.945 5.795 5.432 1.25e-05 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.forte 6.382 7.100 40.090 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.D4.forte 6.046 6.764 17.447 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.F4.forte 5.465 6.143 12.386 2.50e-14 ***
s(theta_uncut_z):langNoteInt.ordTongan.F4.forte 2.532 3.114 3.041 0.02435 *
s(theta_uncut_z,subject) 183.480 198.000 7575.846 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
R-sq.(adj) = 0.832 Deviance explained = 83.2%
fREML = 2.7247e+06 Scale est. = 89.598 n = 742800
summary(Notes.gam.noAR.Mod2)
Family: gaussian
Link function: identity
Formula:
rho_uncut_z ~ langNoteInt.ord + s(theta_uncut_z, bs = "cr", k = 10) +
s(theta_uncut_z, k = 10, bs = "cr", by = langNoteInt.ord) +
s(theta_uncut_z, subject, bs = "fs", k = 10, m = 1, by = noteIntenInt)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 208.01898 3.84870 54.049 < 2e-16 ***
langNoteInt.ordTongan.Bb2.piano 7.54672 5.74105 1.315 0.18867
langNoteInt.ordNZE.F3.piano 4.02764 5.42078 0.743 0.45748
langNoteInt.ordTongan.F3.piano 6.93585 5.38919 1.287 0.19810
langNoteInt.ordNZE.Bb3.piano 14.05159 6.91265 2.033 0.04208 *
langNoteInt.ordTongan.Bb3.piano 4.30408 6.88054 0.626 0.53162
langNoteInt.ordNZE.D4.piano 9.84484 6.17110 1.595 0.11064
langNoteInt.ordTongan.D4.piano 11.01255 6.19898 1.777 0.07565 .
langNoteInt.ordNZE.F4.piano 16.26831 5.72894 2.840 0.00452 **
langNoteInt.ordTongan.F4.piano 14.44407 5.66381 2.550 0.01077 *
langNoteInt.ordNZE.Bb2.mezzopiano 7.98477 7.06301 1.131 0.25826
langNoteInt.ordTongan.Bb2.mezzopiano 6.69424 10.45428 0.640 0.52196
langNoteInt.ordNZE.F3.mezzopiano 11.10212 5.50585 2.016 0.04376 *
langNoteInt.ordTongan.F3.mezzopiano 9.69187 5.48745 1.766 0.07736 .
langNoteInt.ordNZE.Bb3.mezzopiano 11.99878 6.85456 1.750 0.08004 .
langNoteInt.ordTongan.Bb3.mezzopiano -0.04365 7.19182 -0.006 0.99516
langNoteInt.ordNZE.D4.mezzopiano 7.20483 12.88237 0.559 0.57597
langNoteInt.ordTongan.D4.mezzopiano 20.82488 8.40065 2.479 0.01318 *
langNoteInt.ordTongan.F4.mezzopiano -0.81442 13.56072 -0.060 0.95211
langNoteInt.ordNZE.Bb2.mezzoforte 6.10145 7.60843 0.802 0.42259
langNoteInt.ordTongan.Bb2.mezzoforte 10.12249 7.59045 1.334 0.18234
langNoteInt.ordNZE.F3.mezzoforte 12.86554 8.79113 1.463 0.14334
langNoteInt.ordTongan.F3.mezzoforte 9.71283 9.29607 1.045 0.29610
langNoteInt.ordNZE.Bb3.mezzoforte 12.23200 9.04619 1.352 0.17632
langNoteInt.ordTongan.Bb3.mezzoforte 5.96677 9.14190 0.653 0.51396
langNoteInt.ordNZE.D4.mezzoforte 15.61654 6.94413 2.249 0.02452 *
langNoteInt.ordTongan.D4.mezzoforte 7.74809 7.02910 1.102 0.27034
langNoteInt.ordNZE.F4.mezzoforte 9.54996 6.58711 1.450 0.14712
langNoteInt.ordTongan.F4.mezzoforte 5.85110 6.58902 0.888 0.37454
langNoteInt.ordNZE.Bb2.forte 3.97016 5.61254 0.707 0.47933
langNoteInt.ordTongan.Bb2.forte 3.48826 6.06286 0.575 0.56506
langNoteInt.ordNZE.F3.forte 11.80956 4.97293 2.375 0.01756 *
langNoteInt.ordTongan.F3.forte 8.09523 5.26203 1.538 0.12395
langNoteInt.ordNZE.Bb3.forte 14.04910 5.93719 2.366 0.01797 *
langNoteInt.ordTongan.Bb3.forte 6.83202 6.20956 1.100 0.27123
langNoteInt.ordNZE.D4.forte 14.55603 5.86757 2.481 0.01311 *
langNoteInt.ordTongan.D4.forte 8.32015 6.00647 1.385 0.16599
langNoteInt.ordNZE.F4.forte 13.72840 5.82409 2.357 0.01841 *
langNoteInt.ordTongan.F4.forte 5.31625 6.28208 0.846 0.39741
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(theta_uncut_z) 8.672e+00 8.795 124.695 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.piano 2.680e+00 2.842 2.526 0.074545 .
s(theta_uncut_z):langNoteInt.ordNZE.F3.piano 2.180e+00 2.303 1.336 0.286047
s(theta_uncut_z):langNoteInt.ordTongan.F3.piano 3.168e+00 3.370 3.205 0.016257 *
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.piano 2.495e+00 2.652 0.446 0.609886
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.piano 3.303e+00 3.520 3.313 0.013339 *
s(theta_uncut_z):langNoteInt.ordNZE.D4.piano 1.006e+00 1.007 2.006 0.156395
s(theta_uncut_z):langNoteInt.ordTongan.D4.piano 1.014e+00 1.015 6.000 0.014200 *
s(theta_uncut_z):langNoteInt.ordNZE.F4.piano 2.586e+00 2.769 2.021 0.088555 .
s(theta_uncut_z):langNoteInt.ordTongan.F4.piano 1.006e+00 1.007 2.702 0.099877 .
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzopiano 1.016e+00 1.017 4.971 0.025596 *
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzopiano 1.837e+00 1.964 3.222 0.036920 *
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzopiano 1.014e+00 1.016 1.492 0.224093
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzopiano 5.875e+00 6.220 5.182 2.54e-05 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzopiano 1.007e+00 1.008 1.116 0.291994
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzopiano 4.209e+00 4.467 5.476 0.000378 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzopiano 1.007e+00 1.007 0.190 0.665001
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzopiano 1.007e+00 1.008 3.961 0.046260 *
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzopiano 4.181e+00 4.936 23.183 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzoforte 1.016e+00 1.021 0.675 0.414308
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzoforte 1.022e+00 1.027 3.039 0.080044 .
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzoforte 1.002e+00 1.002 0.223 0.637699
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzoforte 6.817e+00 7.337 3.664 0.000605 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzoforte 5.186e+00 5.894 1.039 0.392773
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzoforte 4.984e+00 5.547 1.800 0.074241 .
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzoforte 3.381e+00 3.810 2.094 0.084827 .
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzoforte 3.979e+00 4.352 2.714 0.036509 *
s(theta_uncut_z):langNoteInt.ordNZE.F4.mezzoforte 3.755e+00 4.078 1.127 0.374094
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzoforte 1.032e+00 1.036 7.035 0.007601 **
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.forte 1.005e+00 1.005 0.804 0.369561
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.forte 4.610e+00 4.922 5.088 0.000243 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.forte 1.002e+00 1.002 1.365 0.243097
s(theta_uncut_z):langNoteInt.ordTongan.F3.forte 5.717e+00 6.084 3.729 0.001246 **
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.forte 3.341e+00 3.571 2.456 0.039868 *
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.forte 6.215e+00 6.542 4.419 0.000280 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.forte 1.938e+00 2.025 2.395 0.090963 .
s(theta_uncut_z):langNoteInt.ordTongan.D4.forte 3.089e+00 3.271 2.845 0.033453 *
s(theta_uncut_z):langNoteInt.ordNZE.F4.forte 1.016e+00 1.018 1.594 0.207858
s(theta_uncut_z):langNoteInt.ordTongan.F4.forte 1.676e+00 1.748 4.899 0.019808 *
s(theta_uncut_z,subject):noteIntenIntBb2.piano 8.660e+01 147.000 49.325 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF3.piano 1.182e+02 187.000 92.516 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb3.piano 1.246e+02 186.000 115.287 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntD4.piano 1.208e+02 188.000 75.218 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF4.piano 5.479e+01 118.000 22.931 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb2.mezzopiano 3.319e+01 58.000 81.579 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF3.mezzopiano 1.243e+02 188.000 167.108 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb3.mezzopiano 1.110e+02 187.000 70.930 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntD4.mezzopiano 2.482e+01 47.000 89.478 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF4.mezzopiano 5.814e-03 9.000 0.000 0.180312
s(theta_uncut_z,subject):noteIntenIntBb2.mezzoforte 1.711e+02 200.000 1389.565 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF3.mezzoforte 1.742e+02 198.000 2877.405 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb3.mezzoforte 1.715e+02 200.000 2729.417 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntD4.mezzoforte 1.594e+02 199.000 1191.110 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF4.mezzoforte 1.452e+02 199.000 451.923 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb2.forte 1.280e+02 188.000 108.302 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF3.forte 1.385e+02 197.000 248.953 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb3.forte 1.332e+02 198.000 208.773 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntD4.forte 1.262e+02 198.000 88.992 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF4.forte 9.380e+01 168.000 43.950 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
R-sq.(adj) = 0.861 Deviance explained = 86.1%
fREML = 2.6589e+06 Scale est. = 74.134 n = 742800
So far, our second model Notes.gam.noAR.Mod2
that takes into account the random effect structure of by speaker, by note and by intensity accounted for 86.1% of the variance in the data. It showed some differences between the two languages in terms of how tongue contours are different depending on the note and its intensity. We next need to check the autocorrelation in the residuals and acocunt for these.
As we see below, the autocorrelation in the residuals is massive. We need to check whether this is on all predictors or on specific ones.
acf_resid(Notes.gam.noAR.Mod2,main = "Average ACF No.AR",cex.lab=1.5,cex.axis=1.5)
We finally run our final model that takes into account the autocorrelations in the risiduals
Rho
We use the following to get an estimate of the rho
to be included later on in our model
rho_est <- start_value_rho(Notes.gam.noAR.Mod2)
rho_est
[1] 0.9770577
if (run_models == TRUE){
mdl.sys.time6 <- system.time(Notes.gam.AR.Mod2 <- bam(rho_uncut_z ~ langNoteInt.ord +
## 1d smooths
s(theta_uncut_z, bs="cr", k=10) +
## 1d smooths * factors
s(theta_uncut_z, k=10, bs="cr", by=langNoteInt.ord) +
## random smooths by subject, note and intensity
s(theta_uncut_z, subject, bs="fs", k=10, m=1,
by=noteIntenInt),
data=dfNotes,AR.start=dfNotes$start,
rho=rho_est, discrete=TRUE, nthreads=ncores))
mdl.sys.time6
# save model so that it can be reloaded later
saveRDS(Notes.gam.AR.Mod2, paste0(output_dir,"/Notes.gam.AR.Mod2.rds"))
capture.output(summary(Notes.gam.AR.Mod2), file =
paste0(output_dir,"/summary_Notes.gam.AR.Mod2.txt"))
}else{
# reload model
Notes.gam.AR.Mod2 = readRDS(paste0(output_dir,"/Notes.gam.AR.Mod2.rds"))
}
acf_resid(Notes.gam.AR.Mod2,main = "Average ACF AR", cex.lab=1.5, cex.axis=1.5)
summary(Notes.gam.AR.Mod2)
Family: gaussian
Link function: identity
Formula:
rho_uncut_z ~ langNoteInt.ord + s(theta_uncut_z, bs = "cr", k = 10) +
s(theta_uncut_z, k = 10, bs = "cr", by = langNoteInt.ord) +
s(theta_uncut_z, subject, bs = "fs", k = 10, m = 1, by = noteIntenInt)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 208.5297 5.1929 40.157 < 2e-16 ***
langNoteInt.ordTongan.Bb2.piano 5.7461 7.5982 0.756 0.44951
langNoteInt.ordNZE.F3.piano 2.7598 6.3210 0.437 0.66240
langNoteInt.ordTongan.F3.piano 4.9391 6.4963 0.760 0.44707
langNoteInt.ordNZE.Bb3.piano 10.1666 7.4838 1.358 0.17431
langNoteInt.ordTongan.Bb3.piano 1.3756 7.7532 0.177 0.85918
langNoteInt.ordNZE.D4.piano 5.9943 7.7973 0.769 0.44203
langNoteInt.ordTongan.D4.piano 3.2696 7.7748 0.421 0.67409
langNoteInt.ordNZE.F4.piano 11.3212 7.4149 1.527 0.12680
langNoteInt.ordTongan.F4.piano 8.9149 7.3554 1.212 0.22550
langNoteInt.ordNZE.Bb2.mezzopiano 2.2355 8.3557 0.268 0.78906
langNoteInt.ordTongan.Bb2.mezzopiano -1.2011 12.5009 -0.096 0.92346
langNoteInt.ordNZE.F3.mezzopiano 5.5038 8.2090 0.670 0.50257
langNoteInt.ordTongan.F3.mezzopiano 1.5723 8.0063 0.196 0.84431
langNoteInt.ordNZE.Bb3.mezzopiano 8.4158 7.9947 1.053 0.29249
langNoteInt.ordTongan.Bb3.mezzopiano 1.5906 8.0432 0.198 0.84324
langNoteInt.ordNZE.D4.mezzopiano 1.2078 11.7024 0.103 0.91779
langNoteInt.ordTongan.D4.mezzopiano 15.2717 8.5842 1.779 0.07523 .
langNoteInt.ordTongan.F4.mezzopiano -2.8141 10.4186 -0.270 0.78708
langNoteInt.ordNZE.Bb2.mezzoforte 2.1800 8.1746 0.267 0.78971
langNoteInt.ordTongan.Bb2.mezzoforte 4.3604 8.1593 0.534 0.59306
langNoteInt.ordNZE.F3.mezzoforte 12.9677 17.3100 0.749 0.45377
langNoteInt.ordTongan.F3.mezzoforte -9.0879 17.4460 -0.521 0.60242
langNoteInt.ordNZE.Bb3.mezzoforte 21.1206 8.0329 2.629 0.00856 **
langNoteInt.ordTongan.Bb3.mezzoforte 3.9376 8.1256 0.485 0.62797
langNoteInt.ordNZE.D4.mezzoforte 20.5862 8.2622 2.492 0.01272 *
langNoteInt.ordTongan.D4.mezzoforte 7.0268 8.3811 0.838 0.40181
langNoteInt.ordNZE.F4.mezzoforte 11.7620 6.9821 1.685 0.09207 .
langNoteInt.ordTongan.F4.mezzoforte 1.3537 7.1839 0.188 0.85053
langNoteInt.ordNZE.Bb2.forte 2.2826 7.2333 0.316 0.75233
langNoteInt.ordTongan.Bb2.forte 1.2167 7.5663 0.161 0.87225
langNoteInt.ordNZE.F3.forte 9.2558 7.1718 1.291 0.19685
langNoteInt.ordTongan.F3.forte 5.6065 7.2610 0.772 0.44003
langNoteInt.ordNZE.Bb3.forte 12.2867 6.8755 1.787 0.07393 .
langNoteInt.ordTongan.Bb3.forte 7.1173 6.9315 1.027 0.30451
langNoteInt.ordNZE.D4.forte 9.7201 7.6617 1.269 0.20456
langNoteInt.ordTongan.D4.forte 8.0273 7.6695 1.047 0.29527
langNoteInt.ordNZE.F4.forte 10.7750 6.8925 1.563 0.11798
langNoteInt.ordTongan.F4.forte 0.9717 7.3024 0.133 0.89414
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(theta_uncut_z) 8.89208 8.934 179.641 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.piano 1.05657 1.068 7.273 0.006511 **
s(theta_uncut_z):langNoteInt.ordNZE.F3.piano 1.02064 1.026 0.874 0.343937
s(theta_uncut_z):langNoteInt.ordTongan.F3.piano 4.91246 5.412 3.585 0.002145 **
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.piano 1.01948 1.027 0.109 0.751566
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.piano 4.29449 4.829 4.182 0.001167 **
s(theta_uncut_z):langNoteInt.ordNZE.D4.piano 1.01221 1.014 1.919 0.165399
s(theta_uncut_z):langNoteInt.ordTongan.D4.piano 2.65733 2.873 5.688 0.001260 **
s(theta_uncut_z):langNoteInt.ordNZE.F4.piano 3.77367 4.142 1.107 0.395074
s(theta_uncut_z):langNoteInt.ordTongan.F4.piano 1.01182 1.014 3.976 0.046151 *
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzopiano 1.01773 1.022 1.840 0.173802
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzopiano 4.60731 4.906 3.739 0.003906 **
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzopiano 3.63215 4.121 0.291 0.889135
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzopiano 5.90150 6.423 5.518 6.74e-06 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzopiano 1.00711 1.009 0.464 0.498633
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzopiano 4.90630 5.283 4.675 0.000196 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzopiano 1.01001 1.013 0.909 0.340842
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzopiano 1.40989 1.467 5.604 0.014736 *
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzopiano 5.24063 6.028 23.670 < 2e-16 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.mezzoforte 1.00423 1.007 0.582 0.444998
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.mezzoforte 1.00124 1.002 13.781 0.000204 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.mezzoforte 6.88004 7.545 4.291 9.49e-05 ***
s(theta_uncut_z):langNoteInt.ordTongan.F3.mezzoforte 6.67813 7.430 3.892 0.010532 *
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.mezzoforte 1.00395 1.007 0.344 0.561286
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.mezzoforte 1.00096 1.002 10.457 0.001216 **
s(theta_uncut_z):langNoteInt.ordNZE.D4.mezzoforte 1.00063 1.001 0.795 0.372832
s(theta_uncut_z):langNoteInt.ordTongan.D4.mezzoforte 1.00326 1.005 6.495 0.010750 *
s(theta_uncut_z):langNoteInt.ordNZE.F4.mezzoforte 1.00931 1.013 2.046 0.153106
s(theta_uncut_z):langNoteInt.ordTongan.F4.mezzoforte 3.50924 3.975 4.303 0.001666 **
s(theta_uncut_z):langNoteInt.ordNZE.Bb2.forte 2.69411 3.181 1.630 0.163113
s(theta_uncut_z):langNoteInt.ordTongan.Bb2.forte 5.32949 5.851 5.439 2.22e-05 ***
s(theta_uncut_z):langNoteInt.ordNZE.F3.forte 5.38738 6.098 0.866 0.514672
s(theta_uncut_z):langNoteInt.ordTongan.F3.forte 7.15532 7.634 5.717 2.92e-07 ***
s(theta_uncut_z):langNoteInt.ordNZE.Bb3.forte 6.85022 7.404 3.356 0.003461 **
s(theta_uncut_z):langNoteInt.ordTongan.Bb3.forte 5.77196 6.246 4.625 8.16e-05 ***
s(theta_uncut_z):langNoteInt.ordNZE.D4.forte 4.02487 4.433 1.489 0.229501
s(theta_uncut_z):langNoteInt.ordTongan.D4.forte 5.33783 5.756 4.104 0.001461 **
s(theta_uncut_z):langNoteInt.ordNZE.F4.forte 1.01874 1.021 1.214 0.271640
s(theta_uncut_z):langNoteInt.ordTongan.F4.forte 1.90475 2.014 5.554 0.004046 **
s(theta_uncut_z,subject):noteIntenIntBb2.piano 109.29624 149.000 24.077 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF3.piano 139.58881 188.000 44.333 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb3.piano 144.71619 190.000 60.600 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntD4.piano 138.04856 190.000 40.983 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF4.piano 70.55049 118.000 10.032 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb2.mezzopiano 38.69254 59.000 28.475 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF3.mezzopiano 145.11477 190.000 74.337 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb3.mezzopiano 128.75921 189.000 34.134 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntD4.mezzopiano 28.90230 47.000 28.839 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF4.mezzopiano 0.01025 9.000 0.001 0.344630
s(theta_uncut_z,subject):noteIntenIntBb2.mezzoforte 183.98586 198.000 790.892 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF3.mezzoforte 188.26352 199.000 1524.348 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb3.mezzoforte 186.25424 198.000 1474.416 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntD4.mezzoforte 181.07227 198.000 609.675 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF4.mezzoforte 163.33833 200.000 199.277 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb2.forte 147.48222 190.000 57.413 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF3.forte 157.57852 200.000 108.622 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntBb3.forte 153.15114 200.000 79.316 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntD4.forte 143.04055 200.000 39.678 < 2e-16 ***
s(theta_uncut_z,subject):noteIntenIntF4.forte 113.17115 168.000 20.944 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
R-sq.(adj) = 0.855 Deviance explained = 85.4%
fREML = 6.7861e+05 Scale est. = 7.6401 n = 742800