Speech data sets typically contain multiple repetitions of the same speech sound, each sampled at multiple time points. The samples within a given repetition are thus not independent and smoothing procedures should take this into account. One way of doing this with generalized additive models (gams) is via a random effect. However, random effects are not included when performing smoothing with ggplot2 using default options. This gist illustrates some tricks for incuding random effects in ggplot smoothing.
The methods below have been used in the following papers: