Duration analysis

load(file='data/dur.Rda')
dur.lmer=lmer(VR_dur~(1+Context|speaker)+(1|prompt)+(1|Block)+Context, data=dur)
dur.lmer2=lmer(VR_dur~(1+Context|speaker)+(1|prompt)+(1|Block)+Context+Vowel, data=dur)
anova(dur.lmer, dur.lmer2)
## refitting model(s) with ML (instead of REML)
## Data: dur
## Models:
## dur.lmer: VR_dur ~ (1 + Context | speaker) + (1 | prompt) + (1 | Block) + 
## dur.lmer:     Context
## dur.lmer2: VR_dur ~ (1 + Context | speaker) + (1 | prompt) + (1 | Block) + 
## dur.lmer2:     Context + Vowel
##           Df    AIC    BIC  logLik deviance  Chisq Chi Df Pr(>Chisq)  
## dur.lmer  23 4674.4 4771.2 -2314.2   4628.4                           
## dur.lmer2 24 4672.7 4773.8 -2312.4   4624.7 3.6797      1    0.05508 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(dur.lmer2)
## Linear mixed model fit by REML ['lmerMod']
## Formula: VR_dur ~ (1 + Context | speaker) + (1 | prompt) + (1 | Block) +  
##     Context + Vowel
##    Data: dur
## 
## REML criterion at convergence: 4584.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3491 -0.6533 -0.0161  0.5855  3.1056 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr                   
##  prompt   (Intercept)  271.81  16.487                          
##  speaker  (Intercept) 1376.63  37.103                          
##           ContextVr#C  823.96  28.705   -0.91                  
##           ContextVr#r   63.67   7.979   -0.86  0.90            
##           ContextVr#V  677.76  26.034   -0.95  0.96  0.89      
##           ContextVrV   882.90  29.714   -0.82  0.80  0.62  0.90
##  Block    (Intercept)   90.32   9.503                          
##  Residual              515.11  22.696                          
## Number of obs: 498, groups:  prompt, 10; speaker, 9; Block, 6
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)   243.48      18.37  13.256
## ContextVr#C  -100.60      19.33  -5.204
## ContextVr#r   -18.43      17.01  -1.083
## ContextVr#V   -81.38      18.91  -4.304
## ContextVrV   -116.97      19.50  -5.998
## Vowelei       -15.45      10.62  -1.455
## 
## Correlation of Fixed Effects:
##             (Intr) CntV#C CntxV# CntV#V CntxVV
## ContextVr#C -0.702                            
## ContextVr#r -0.542  0.499                     
## ContextVr#V -0.700  0.604  0.503              
## ContextVrV  -0.674  0.576  0.475  0.593       
## Vowelei     -0.289  0.000  0.000  0.000  0.000
ef <- as.data.frame(effect("Context", dur.lmer2))

ef$Context = factor(ef$Context)
ef$Context = factor(ef$Context, levels=c("Vr#C","Vr#V","VrV","V#rV", "Vr#r"))

  plot1 <- ggplot(ef, aes(x=Context, y=fit)) + geom_point(size=2) + 
  geom_errorbar(aes(ymin=lower, ymax=upper, width=0.2))+
  scale_x_discrete('')+
  scale_y_continuous('Duration (ms)', limits=c(80,280))+
  ggtitle('/ar/ duration')+
  theme_bw()+ theme(text = element_text(size=12) )


cluster=subset(dur, Context=='Vr#r'|Context=='V#rV'|Context=='Vr#C')

durC.lmer=lmer(cluster_dur~(1+Context|speaker)+(1|prompt)+Context, data=cluster)
durC.lmer2=lmer(cluster_dur~(1+Context|speaker)+(1|prompt)+Context+Vowel, data=cluster)
anova(durC.lmer, durC.lmer2)
## refitting model(s) with ML (instead of REML)
## Data: cluster
## Models:
## durC.lmer: cluster_dur ~ (1 + Context | speaker) + (1 | prompt) + Context
## durC.lmer2: cluster_dur ~ (1 + Context | speaker) + (1 | prompt) + Context + 
## durC.lmer2:     Vowel
##            Df    AIC    BIC  logLik deviance  Chisq Chi Df Pr(>Chisq)  
## durC.lmer  11 2923.4 2964.1 -1450.7   2901.4                           
## durC.lmer2 12 2920.5 2964.9 -1448.3   2896.5 4.8641      1    0.02742 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(durC.lmer2)
## Linear mixed model fit by REML ['lmerMod']
## Formula: cluster_dur ~ (1 + Context | speaker) + (1 | prompt) + Context +  
##     Vowel
##    Data: cluster
## 
## REML criterion at convergence: 2868.5
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.56888 -0.61924 -0.02242  0.59365  2.74929 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr       
##  speaker  (Intercept) 1345.01  36.67               
##           ContextVr#C  500.04  22.36    -0.73      
##           ContextVr#r   50.56   7.11    -0.96  0.89
##  prompt   (Intercept)  374.33  19.35               
##  Residual              815.20  28.55               
## Number of obs: 298, groups:  speaker, 9; prompt, 6
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)   250.63      20.25  12.379
## ContextVr#C   -16.75      21.13  -0.793
## ContextVr#r   -18.35      19.91  -0.922
## Vowelei       -28.55      16.14  -1.769
## 
## Correlation of Fixed Effects:
##             (Intr) CntV#C CntxV#
## ContextVr#C -0.612              
## ContextVr#r -0.554  0.502       
## Vowelei     -0.399  0.000  0.000
ef2 <- as.data.frame(effect("Context", durC.lmer2))

ef2$Context = factor(ef2$Context)
ef2$Context = factor(ef2$Context, levels=c("Vr#C", "V#rV","Vr#r"))

plot2=ggplot(ef2, aes(x=Context, y=fit)) + geom_point(size=2) + 
  geom_errorbar(aes(ymin=lower, ymax=upper, width=0.2))+
  scale_x_discrete('')+
  scale_y_continuous('Duration (ms)', limits=c(80,290))+
  ggtitle('/ar(+C)/ duration')+
  theme_bw()+ theme(text = element_text(size=12) )

cairo_pdf(file='/Users/mfuxjps2/Google Drive/Strycharczuk_Sebregts2015/paper/resubmission2/Figure3.pdf',
          width=5, height=3)
ggplot2.multiplot(plot1, plot2, cols=2)
dev.off()
## quartz_off_screen 
##                 2

SS-ANOVA plots

load(file='data/spline_data.Rda')
## [1] "origin is -6.3134948421863, 129.270607"
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   85.71   93.88  103.10  104.10  113.10  128.00 
##        X             word          ss.Fit        ss.cart.SE    
##  Min.   :0.06673   V#rV:1000   Min.   :19.97   Min.   :0.1260  
##  1st Qu.:0.72297   Vr#C:1000   1st Qu.:23.65   1st Qu.:0.1553  
##  Median :1.37920   Vr#r:1000   Median :32.86   Median :0.1668  
##  Mean   :1.37920   Vr#V:1000   Mean   :31.39   Mean   :0.1711  
##  3rd Qu.:2.03543   VrV :1000   3rd Qu.:37.54   3rd Qu.:0.1770  
##  Max.   :2.69166               Max.   :42.03   Max.   :0.4039  
##  ss.upper.CI.X     ss.upper.CI.Y   ss.lower.CI.X     ss.lower.CI.Y  
##  Min.   :0.06673   Min.   :20.52   Min.   :0.06673   Min.   :19.42  
##  1st Qu.:0.72297   1st Qu.:23.99   1st Qu.:0.72297   1st Qu.:23.35  
##  Median :1.37920   Median :33.20   Median :1.37920   Median :32.54  
##  Mean   :1.37920   Mean   :31.72   Mean   :1.37920   Mean   :31.05  
##  3rd Qu.:2.03543   3rd Qu.:37.86   3rd Qu.:2.03543   3rd Qu.:37.22  
##  Max.   :2.69166   Max.   :42.37   Max.   :2.69166   Max.   :41.69

## [1] "origin is -45.3875629565217, 131.92923"
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   87.99   94.05   99.88  103.30  111.00  130.60 
##        X             word          ss.Fit        ss.cart.SE    
##  Min.   :0.08621   V#rV:1000   Min.   :15.55   Min.   :0.1616  
##  1st Qu.:0.65208   Vr#C:1000   1st Qu.:24.75   1st Qu.:0.1929  
##  Median :1.21796   Vr#r:1000   Median :29.64   Median :0.2066  
##  Mean   :1.21796   Vr#V:1000   Mean   :31.69   Mean   :0.2136  
##  3rd Qu.:1.78383   VrV :1000   3rd Qu.:40.38   3rd Qu.:0.2189  
##  Max.   :2.34971               Max.   :47.79   Max.   :0.5466  
##  ss.upper.CI.X     ss.upper.CI.Y   ss.lower.CI.X     ss.lower.CI.Y  
##  Min.   :0.08621   Min.   :16.46   Min.   :0.08621   Min.   :14.64  
##  1st Qu.:0.65208   1st Qu.:25.09   1st Qu.:0.65208   1st Qu.:24.41  
##  Median :1.21796   Median :30.02   Median :1.21796   Median :29.25  
##  Mean   :1.21796   Mean   :32.11   Mean   :1.21796   Mean   :31.27  
##  3rd Qu.:1.78383   3rd Qu.:40.74   3rd Qu.:1.78383   3rd Qu.:40.01  
##  Max.   :2.34971   Max.   :48.22   Max.   :2.34971   Max.   :47.37