forked from melsod/OCSWinter2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resubmit_analysis.Rmd
648 lines (516 loc) · 21 KB
/
resubmit_analysis.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
---
title: "Acoustic Analysis"
output: pdf_document
---
```{r include=F}
# will need the private_metadata from the authors
library(plyr)
library(here)
library(tidyverse)
library(ggplot2)
library(readxl)
library(pander)
library(mice)
library(mitml)
library(lme4)
# read in the private metat data
d<-read.csv(here::here("private_metadata.csv"))
### same code as in pre-experiment to make unique IDs ###
# remove the - sign. It causes problems later
d$corpus<-revalue(d$corpus, c("Casillas-Yeli"="CasillasYeli"))
#add a column called with a unique id (the original child id pasted together with the corpus)
d <- d %>% mutate(unique_id = paste0(child_ID, corpus))
#get rid of data from the warlaumont corpus
d <- d %>% filter(corpus != c("Warlaumont"))
#make a new column with the language
d <- d %>% mutate(language = ifelse(corpus == "Seedlings",
"English",
"Non-English"))
#make a categorical age variable based on 07, 8-18, and 19-36 groupings
d <- d %>% mutate(age_groups = ifelse(age_mo_round <= 7,
"0-7",
ifelse(age_mo_round <= 18,
"8-18",
"19-36")))
#make grouping variable for age-language question
d <- d %>% mutate(age_language = paste0(age_groups, language))
#keep only canonical and non-canonical
d <- d %>% filter(Answer %in% c("Canonical", "Non-canonical"))
#### end copy of pre-experiment code #####
metadata<-d
##### TRIAL DATA #####
# get data before exclusions
library(here)
d <- read.csv(here::here("data","trial_data.csv"))
library(ggplot2)
# refactor the group so the order is correct in the graphs
d$stim_ageGroup<-factor(d$stim_ageGroup,levels = c("0-7","8-18","19-36"))
# attatch baby data to trial data
d$stim_age<-rep(0,nrow(d))
for(i in 1:nrow(d)){
baby_data<-subset(metadata,metadata$clip_ID==d$clipID[i])
d$stim_age[i]<-baby_data$age_mo_round # age in months
d$age_error[i]<-min(c(abs(d$stim_age[i]-7.5),abs(d$stim_age[i]-18.5))) #absolute difference between age and closest cut off
}
# read in the results from the acoustic analysis on all audio files (including some excluded from the experiment)
audio_data <- read_excel("BabbleAcoustic/Acoustic_characteristics_dataset_age_language.xlsx")
audio_data2<- read_excel("BabbleAcoustic/Acoustic_characteristics_dataset_sex.xlsx",)
colnames(audio_data2)<-colnames(audio_data)
# combine into one dataset
audio_data<-rbind(audio_data,audio_data2)
# read in the age_language stimuli (as a string)
age_lang_stimuli_string<-paste(readLines("stimuli/age_language_test_stimuli.js"),collapse="")
# pull out the audio file names from the string (get a list of all audio files actually used)
age_lang_audio_file_list<-str_sub(string = age_lang_stimuli_string,start = str_locate_all(age_lang_stimuli_string,".wav")[[1]][,1]-10,end = str_locate_all(age_lang_stimuli_string,".wav")[[1]][,2])
# read in the sex stimuli (as a string)
sex_stimuli_string<-paste(readLines("stimuli/sex_test_stimuli.js"),collapse="")
# pull out the audio file names from the string (get a list of all audio files actually used)
sex_audio_file_list<-str_sub(string = sex_stimuli_string,start = str_locate_all(sex_stimuli_string,".wav")[[1]][,1]-10,end = str_locate_all(sex_stimuli_string,".wav")[[1]][,2])
# make list of stimuli actually used
audio_files_used<-c(age_lang_audio_file_list,sex_audio_file_list)
# confirm that all the used audio files are in the audio_data
#all(audio_files_used%in%paste0("0",audio_data$Filename,".wav"))
# attach the babies unique ID to the audio_data dataframe, and other data
for(i in 1:nrow(audio_data)){
baby_data<-subset(metadata,metadata$clip_ID==paste0("0",audio_data$Filename[i],".wav"))
audio_data$stim_ID[i]<-baby_data$unique_id
audio_data$age_mo_round[i]<-baby_data$age_mo_round
audio_data$gender[i]<-baby_data$child_gender
audio_data$corpus[i]<-baby_data$corpus
audio_data$language[i]<-baby_data$language
audio_data$age_group[i]<-baby_data$age_groups
}
# make better column names
colnames(audio_data)<-c("Filename","duration","textgrdlabel","f0","f1","f2","intens","stim_ID","age_mo_round","gender","corpus","language","age_group")
# confirm data in the right format
audio_data$f0<-as.numeric(audio_data$f0)
audio_data$f1<-as.numeric(audio_data$f1)
audio_data$f2<-as.numeric(audio_data$f2)
audio_data$intens<-as.numeric(audio_data$intens)
audio_data$duration<-as.numeric(audio_data$duration)
audio_data$age_mo_round<-as.numeric(audio_data$age_mo_round)
#audio_data$Filename<-as.factor(audio_data$Filename)
audio_data$stim_ID<-as.factor(audio_data$stim_ID)
audio_data$gender<-as.factor(audio_data$gender)
audio_data$corpus<-as.factor(audio_data$corpus)
audio_data$language<-as.factor(audio_data$language)
audio_data$age_group<-as.factor(audio_data$age_group)
# subset to the audio data for the age_lang questions
age_lang_sub_audio<-subset(audio_data,paste0("0",audio_data$Filename,".wav")%in%age_lang_audio_file_list)
# remove duplicates (because some files were used in both age_lang and sex)
age_lang_sub_audio<-age_lang_sub_audio[!duplicated(age_lang_sub_audio$Filename),]
# subset to the audio data for the sex questions
sex_sub_audio<-subset(audio_data,paste0("0",audio_data$Filename,".wav")%in%sex_audio_file_list)
# remove duplicates (because some files were used in both age_lang and sex)
sex_sub_audio<-sex_sub_audio[!duplicated(sex_sub_audio$Filename),]
```
This document responds to questions raised by reviewers during the review process. You will need to get the private metadata csv file from the BabbleCor authors (and our data) in order to reproduce these results.
This document reads in the results of an acoustic analysis and examines whether there are statistical differences on any of the f0, f1, f2, intensity, or duration measurements between the groups of babies as divided by the factors analyzed in the study.
We first analyze the data with list-wise deletion for missing cases (when one of the acoustic features could not be calculated), and then test two methods of multiple imputation (random sample from observed values and predictive mean matching).
As can be seen below, there are no statistically significant differences on any of the measurements (for either the Age/Language stimuli or the Sex stimuli) in any of the different methods of analysis. It seems unlikely that differences in participants judgements were based on these acoustic features.
Note: the duration of audio clips does not reflect the duration of the original infant vocalizations. The BabbleCor clips were edited to be approximately ~400ms (under ~500ms).
\newpage
# List-wise Deletion
## Analysis of the Sex Stimuli
### f0 midpoint analysis
```{r}
par(mfrow = c(1,2))
boxplot(f0~gender,data = sex_sub_audio,
main="f0 Gender Anlysis (Raw Data)",
ylim = c(min(sex_sub_audio$f0,na.rm = T),
max(sex_sub_audio$f0,na.rm = T)),
cex.main=0.75)
boxplot(f0~gender,data = aggregate(f0~gender*stim_ID,data = sex_sub_audio,mean),
ylim = c(min(sex_sub_audio$f0,na.rm = T),
max(sex_sub_audio$f0,na.rm = T)),
main = "f0 Gender Analysis (Participant Averages)",
cex.main=0.75)
pander(summary(aov(f0~gender+Error(stim_ID), data = sex_sub_audio))[[1]])
```
\newpage
### f1 midpoint analysis
```{r}
par(mfrow = c(1,2))
boxplot(f1~gender,data = sex_sub_audio,main="f1 Gender Anlysis (Raw Data)",
ylim = c(min(sex_sub_audio$f1,na.rm = T),
max(sex_sub_audio$f1,na.rm = T)),
cex.main=0.75)
boxplot(f1~gender,data = aggregate(f1~gender*stim_ID,data = sex_sub_audio,mean),
ylim = c(min(sex_sub_audio$f1,na.rm = T),
max(sex_sub_audio$f1,na.rm = T)),
main = "f1 Gender Analysis (Participant Averages)",
cex.main=0.75)
pander(summary(aov(f1~gender+Error(stim_ID), data = sex_sub_audio))[[1]])
```
\newpage
### f2 midpoint analysis
```{r}
par(mfrow = c(1,2))
boxplot(f2~gender,data = sex_sub_audio,main="f2 Gender Anlysis (Raw Data)",
ylim = c(min(sex_sub_audio$f2,na.rm = T),
max(sex_sub_audio$f2,na.rm = T)),
cex.main=0.75)
boxplot(f2~gender,data = aggregate(f2~gender*stim_ID,data = sex_sub_audio,mean),
ylim = c(min(sex_sub_audio$f2,na.rm = T),
max(sex_sub_audio$f2,na.rm = T)),
main = "f2 Gender Analysis (Participant Averages)",
cex.main=0.75)
pander(summary(aov(f2~gender+Error(stim_ID), data = sex_sub_audio))[[1]])
```
\newpage
### intensity analysis
```{r}
par(mfrow = c(1,2))
boxplot(intens~gender,data = sex_sub_audio,
main="intensity Gender Anlysis (Raw Data)",
ylim = c(min(sex_sub_audio$intens,na.rm = T),
max(sex_sub_audio$intens,na.rm = T)),
cex.main=0.75)
boxplot(intens~gender,data = aggregate(intens~gender*stim_ID,data = sex_sub_audio,mean),
ylim = c(min(sex_sub_audio$intens,na.rm = T),
max(sex_sub_audio$intens,na.rm = T)),
main = "intensity Gender Analysis (Participant Averages)",
cex.main=0.75)
pander(summary(aov(intens~gender+Error(stim_ID), data = sex_sub_audio))[[1]])
```
\newpage
### duration midpoint analysis
```{r}
par(mfrow = c(1,2))
boxplot(duration~gender,data = sex_sub_audio,
main="duration Gender Anlysis (Raw Data)",
ylim = c(min(sex_sub_audio$duration,na.rm = T),
max(sex_sub_audio$duration,na.rm = T)),
cex.main=0.75)
boxplot(duration~gender,data = aggregate(duration~gender*stim_ID,data = sex_sub_audio,mean),
ylim = c(min(sex_sub_audio$duration,na.rm = T),
max(sex_sub_audio$duration,na.rm = T)),
main = "duration Gender Analysis (Participant Averages)",
cex.main=0.75)
pander(summary(aov(duration~gender+Error(stim_ID), data = sex_sub_audio))[[1]])
```
\newpage
## Analysis of the Age/Language Stimuli
### f0 midpoint analysis
```{r}
par(mfrow = c(1,2),mar=c(10,4,1,1))
boxplot(f0~age_group*language,data = age_lang_sub_audio,
main="f0 Gender Anlysis (Raw Data)",
ylim = c(min(age_lang_sub_audio$f0,na.rm = T),
max(age_lang_sub_audio$f0,na.rm = T)),
cex.main=0.75,
las=2,
xlab = "")
boxplot(f0~age_group*language,
data = aggregate(f0~age_group*language*stim_ID,data = age_lang_sub_audio,mean),
ylim = c(min(age_lang_sub_audio$f0,na.rm = T),
max(age_lang_sub_audio$f0,na.rm = T)),
main = "f0 Gender Analysis (Participant Averages)",
cex.main=0.75,
las=2,
xlab = "")
pander(summary(aov(f0~age_group*language+Error(stim_ID), data = age_lang_sub_audio))[[1]])
```
\newpage
### f1 midpoint analysis
```{r}
par(mfrow = c(1,2),mar=c(10,4,1,1))
boxplot(f1~age_group*language,data = age_lang_sub_audio,
main="f1 Gender Anlysis (Raw Data)",
ylim = c(min(age_lang_sub_audio$f1,na.rm = T),
max(age_lang_sub_audio$f1,na.rm = T)),
cex.main=0.75,
las=2,
xlab = "")
boxplot(f1~age_group*language,
data = aggregate(f1~age_group*language*stim_ID,data = age_lang_sub_audio,mean),
ylim = c(min(age_lang_sub_audio$f1,na.rm = T),
max(age_lang_sub_audio$f1,na.rm = T)),
main = "f1 Gender Analysis (Participant Averages)",
cex.main=0.75,
las=2,
xlab = "")
pander(summary(aov(f1~age_group*language+Error(stim_ID), data = age_lang_sub_audio))[[1]])
```
\newpage
### f2 midpoint analysis
```{r}
par(mfrow = c(1,2),mar=c(10,4,1,1))
boxplot(f2~age_group*language,data = age_lang_sub_audio,
main="f2 Gender Anlysis (Raw Data)",
ylim = c(min(age_lang_sub_audio$f2,na.rm = T),
max(age_lang_sub_audio$f2,na.rm = T)),
cex.main=0.75,
las=2,
xlab = "")
boxplot(f2~age_group*language,
data = aggregate(f2~age_group*language*stim_ID,data = age_lang_sub_audio,mean),
ylim = c(min(age_lang_sub_audio$f2,na.rm = T),
max(age_lang_sub_audio$f2,na.rm = T)),
main = "f2 Gender Analysis (Participant Averages)",
cex.main=0.75,
las=2,
xlab = "")
pander(summary(aov(f2~age_group*language+Error(stim_ID), data = age_lang_sub_audio))[[1]])
```
\newpage
### intensity analysis
```{r}
par(mfrow = c(1,2),mar=c(10,4,1,1))
boxplot(intens~age_group*language,data = age_lang_sub_audio,
main="intensity Gender Anlysis (Raw Data)",
ylim = c(min(age_lang_sub_audio$intens,na.rm = T),
max(age_lang_sub_audio$intens,na.rm = T)),
cex.main=0.75,
las=2,
xlab = "")
boxplot(intens~age_group*language,
data = aggregate(intens~age_group*language*stim_ID,data = age_lang_sub_audio,mean),
ylim = c(min(age_lang_sub_audio$intens,na.rm = T),
max(age_lang_sub_audio$intens,na.rm = T)),
main = "intensity Gender Analysis (Participant Averages)",
cex.main=0.75,
las=2,
xlab = "")
pander(summary(aov(intens~age_group*language+Error(stim_ID), data = age_lang_sub_audio))[[1]])
```
\newpage
### duration midpoint analysis
```{r}
par(mfrow = c(1,2),mar=c(10,4,1,1))
boxplot(duration~age_group*language,
data = age_lang_sub_audio,
main="duration Gender Anlysis (Raw Data)",
ylim = c(min(age_lang_sub_audio$duration,na.rm = T),
max(age_lang_sub_audio$duration,na.rm = T)),
cex.main=0.75,
las=2,
xlab = "")
boxplot(duration~age_group*language,
data = aggregate(duration~age_group*language*stim_ID,data = age_lang_sub_audio,mean),
ylim = c(min(age_lang_sub_audio$duration,na.rm = T),
max(age_lang_sub_audio$duration,na.rm = T)),
main = "duration Gender Analysis (Participant Averages)",
cex.main=0.75,
las=2,
xlab = "")
pander(summary(aov(duration~age_group*language+Error(stim_ID), data = age_lang_sub_audio))[[1]])
```
\newpage
# Multiple Imputation (Sample Observed Values)
## Analysis of the Sex Stimuli
```{r, include=FALSE}
# Fill in empty data by random sample from observed values
MI<-mice(data = sex_sub_audio[,c("duration","f0","f1","f2","intens",
"stim_ID","age_mo_round","gender",
"corpus","language","age_group")],
method = "sample",maxit = 10) # specifying columns for consistency with age/language stimuli analysis where there were problems with the Filename column
MI_List<-mids2mitml.list(MI)
```
### f0 midpoint analysis
```{r}
fit1<-with(MI_List,lmer(f0~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f0~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
### f1 midpoint analysis
```{r}
fit1<-with(MI_List,lmer(f1~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f1~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
### f2 midpoint analysis
```{r}
fit1<-with(MI_List,lmer(f2~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f2~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
### intensity analysis
```{r}
fit1<-with(MI_List,lmer(intens~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(intens~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
### duration midpoint analysis
```{r}
fit1<-with(MI_List,lmer(duration~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(duration~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
## Analysis of the Age/Langurage Stimuli
```{r, include=FALSE}
# Fill in empty data by random sample from observed values
MI<-mice(data = age_lang_sub_audio[,c("duration","f0","f1","f2","intens",
"stim_ID","age_mo_round","gender",
"corpus","language","age_group")],
method = "sample",maxit = 10) # the Filename column causes the program to stall so specify all the other columns (expect textgrdlabel because it holds no possible interest)
MI_List<-mids2mitml.list(MI)
```
### f0 midpoint analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(f0~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f0~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(f0~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(f0~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```
\newpage
### f1 midpoint analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(f1~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f1~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(f1~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(f1~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```
\newpage
### f2 midpoint analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(f2~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f2~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(f2~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(f2~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```
\newpage
### intensity analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(intens~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(intens~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(intens~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(intens~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```
\newpage
### duration midpoint analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(duration~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(duration~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(duration~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(duration~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```
\newpage
# Multiple Imputation (Predictive Mean Matching)
## Analysis of the Sex Stimuli
```{r, include=FALSE}
# Fill in empty data by predictive mean matching
MI<-mice(data = sex_sub_audio[,c("duration","f0","f1","f2","intens",
"stim_ID","age_mo_round","gender",
"corpus","language","age_group")],
method = "pmm",maxit = 10) # specifying columns for consistency with age/language stimuli analysis where there were problems with the Filename column
MI_List<-mids2mitml.list(MI)
```
### f0 midpoint analysis
```{r}
fit1<-with(MI_List,lmer(f0~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f0~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
### f1 midpoint analysis
```{r}
fit1<-with(MI_List,lmer(f1~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f1~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
### f2 midpoint analysis
```{r}
fit1<-with(MI_List,lmer(f2~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f2~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
### intensity analysis
```{r}
fit1<-with(MI_List,lmer(intens~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(intens~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
### duration midpoint analysis
```{r}
fit1<-with(MI_List,lmer(duration~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(duration~1+gender+(1|stim_ID)))
testModels(fit2,fit1)
```
\newpage
## Analysis of the Age/Langurage Stimuli
```{r, include=FALSE}
# Fill in empty data by predictive mean matching
MI<-mice(data = age_lang_sub_audio[,c("duration","f0","f1","f2","intens",
"stim_ID","age_mo_round","gender",
"corpus","language","age_group")],
method = "pmm",maxit = 10) # the Filename column causes the program to stall so specify all the other columns (expect textgrdlabel because it holds no possible interest)
MI_List<-mids2mitml.list(MI)
```
### f0 midpoint analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(f0~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f0~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(f0~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(f0~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```
\newpage
### f1 midpoint analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(f1~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f1~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(f1~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(f1~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```
\newpage
### f2 midpoint analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(f2~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(f2~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(f2~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(f2~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```
\newpage
### intensity analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(intens~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(intens~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(intens~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(intens~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```
\newpage
### duration midpoint analysis
```{r, message=FALSE}
fit1<-with(MI_List,lmer(duration~1+(1|stim_ID)))
fit2<-with(MI_List,lmer(duration~1+age_group+(1|stim_ID)))
fit3<-with(MI_List,lmer(duration~1+age_group+language+(1|stim_ID)))
fit4<-with(MI_List,lmer(duration~1+age_group*language+(1|stim_ID)))
testModels(fit2,fit1)
testModels(fit3,fit2)
testModels(fit4,fit3)
```