Instantly share code, notes, and snippets.

# alansmithy/.block

Last active Feb 11, 2019
Anscombe's Quartet with simple-statistics and d3js v4 -

## Anscombe's Quartet

I use Frank Anscombe's quartet alot when teaching data visualisation courses: Despite the arrival of the brilliant Datasaurus Dozen, it's still a powerful illustration of the drawback of relying solely on basic descriptive statistics to summarise data. The data in all 4 of the graphs in the quartet are virtually indentical when using standard descriptive methods - the graphs reveal the truth. Looking at your data before analysing it is something that Anscombe was passionate about:

"Most kinds of statistical calculation rest on assumptions about the behaviour of the data. Those assumptions may be false, and then the calculations may be misleading. We ought always to try to check whether the assumptions are reasonably correct; and if they are wrong we ought to be able to perceive in what ways they are wrong. Graphs are very valuable for these purposes."

Frank Anscombe, Graphs in Statistical Analysis (1973)

I became increasingly embarassed that I kept using screengrabs from Wikipedia in my course slides, so I decided to create my own version using d3js and simple-statistics, now updated to use d3js v4 and simple-statistics v4.1.

seriesname x y series 1 10 8.04 series 1 8 6.95 series 1 13 7.58 series 1 9 8.81 series 1 11 8.33 series 1 14 9.96 series 1 6 7.24 series 1 4 4.26 series 1 12 10.84 series 1 7 4.82 series 1 5 5.68 series 2 10 9.14 series 2 8 8.14 series 2 13 8.74 series 2 9 8.77 series 2 11 9.26 series 2 14 8.1 series 2 6 6.13 series 2 4 3.1 series 2 12 9.13 series 2 7 7.26 series 2 5 4.74 series 3 10 7.46 series 3 8 6.77 series 3 13 12.74 series 3 9 7.11 series 3 11 7.81 series 3 14 8.84 series 3 6 6.08 series 3 4 5.39 series 3 12 8.15 series 3 7 6.42 series 3 5 5.73 series 4 8 6.58 series 4 8 5.76 series 4 8 7.71 series 4 8 8.84 series 4 8 8.47 series 4 8 7.04 series 4 8 5.25 series 4 19 12.5 series 4 8 5.56 series 4 8 7.91 series 4 8 6.89