eights - nurmi-labs/blogger GitHub Wiki

eights

The data file.

Source: http://lib.stat.cmu.edu/DASL/Datafiles/Crews.html (dead link)

J.B. Miller's code uses pylab, a procedural interface to the matplotlib object-oriented plotting library; omitting the shell output, here's the similar code using pyplot instead.

bash-4.3$ awk '{ if (NR > 0) sum += $1 } END { print sum / 18 }' < crews.tsv
181.417
bash-4.3$ cat test.hs
import Statistics.Sample
import Data.Vector

cambridge = fromList [188.5, 183, 194.5, 185, 214, 203.5, 186, 178.5, 109]

main = do
    print $ mean cambridge
bash-4.3$ runghc test.hs
182.44444444444446
bash-4.3$ R -q
> oxford <- c(186, 184.5, 204, 184.5, 195.5, 202.5, 174, 183, 109.5)
> oxford.mean <- mean(oxford)
> print(oxford.mean)
[1] 180.3889
> q()
Save workspace image? [y/n/c]: n
bash-4.3$ tclsh
% set oxford [list 186 184.5 204 184.5 195.5 202.5 174 183 109.5]
186 184.5 204 184.5 195.5 202.5 174 183 109.5
% package require math::statistics
1.5.0
% puts [::math::statistics::mean $oxford]
180.38888888888889
% exit
bash-4.3$ 

To run the Haskell code you'll need the statistics and vector packages.
To run the Tcl code you'll need to install tcllib.