| 119168 | random = r; |
| 119169 | } |
| 119170 | function bootstrapCI(array, samples, alpha, f) { |
| 119171 | if (!array.length) return [ |
| 119172 | undefined, |
| 119173 | undefined |
| 119174 | ]; |
| 119175 | const values = Float64Array.from(numbers(array, f)), n = values.length, m = samples; |
| 119176 | let a, i, j, mu; |
| 119177 | for(j = 0, mu = Array(m); j < m; ++j){ |
| 119178 | for(a = 0, i = 0; i < n; ++i)a += values[~~(random() * n)]; |
| 119179 | mu[j] = a / n; |
| 119180 | } |
| 119181 | mu.sort((0, _d3Array.ascending)); |
| 119182 | return [ |
| 119183 | (0, _d3Array.quantile)(mu, alpha / 2), |
| 119184 | (0, _d3Array.quantile)(mu, 1 - alpha / 2) |
| 119185 | ]; |
| 119186 | } |
| 119187 | // Dot density binning for dot plot construction. |
| 119188 | // Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. |
| 119189 | // https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf |