# NOT RUN {
estimateVTL(NA)
estimateVTL(500)
estimateVTL(c(600, 1850, 3100))
estimateVTL(formants = list(f1 = 600, f2 = 1650, f3 = 2400))
# Missing values are OK
estimateVTL(c(600, 1850, 3100, NA, 5000))
# For moving formants, frequencies are averaged over time,
# i.e. this is identical to c(600, 1650, 2400)
estimateVTL(formants = list(f1 = c(500, 700), f2 = 1650, f3 = c(2200, 2600)))
# Note that VTL estimates based on the commonly reported 'meanDispersion'
# depend only on the first and last formant
estimateVTL(c(500, 1400, 2800, 4100), method = 'meanDispersion')
estimateVTL(c(500, 1100, 2300, 4100), method = 'meanDispersion') # identical
# ...but
estimateVTL(c(500, 1400, 2800, 4100), method = 'meanFormant')
estimateVTL(c(500, 1100, 2300, 4100), method = 'meanFormant') # much longer
# }
# NOT RUN {
# Compare the results produced by the three methods
nIter = 1000
out = data.frame(meanFormant = rep(NA, nIter), meanDispersion = NA, regression = NA)
for (i in 1:nIter) {
# generate a random formant configuration
f = runif(1, 300, 900) + (1:6) * rnorm(6, 1000, 200)
out$meanFormant[i] = estimateVTL(f, method = 'meanFormant')
out$meanDispersion[i] = estimateVTL(f, method = 'meanDispersion')
out$regression[i] = estimateVTL(f, method = 'regression')
}
pairs(out)
cor(out)
# 'meanDispersion' is pretty different, while 'meanFormant' and 'regression'
# give broadly comparable results
# }
Run the code above in your browser using DataLab