PAD Charts
All charts/Distributions

Reaction times, rested or not

density: a smooth curve per group over one axis, the medians dashed.

1 The data distribution/reaction.php php
<?php

  // Reaction times in milliseconds of 150 trials rested and 150 after a night without
  // sleep, from a fixed seed: the tired ones slower and more spread, with a long tail of
  // lapses - two bell curves of their own, drawn as densities over one axis.

  mt_srand ( 11 );

  $bell = fn ( $mean, $sd ) => $mean + $sd * sqrt ( -2 * log ( max ( 1e-9, mt_rand () / mt_getrandmax () ) ) ) * cos ( 2 * M_PI * mt_rand () / mt_getrandmax () );

  $trials = [];

  for ( $i = 0; $i < 150; $i++ )
    $trials [] = [ 'group' => 'Rested', 'ms' => round ( $bell ( 285, 32 ) ) ];

  for ( $i = 0; $i < 150; $i++ )
    $trials [] = [ 'group' => 'Sleep-deprived', 'ms' => round ( $i % 6 ? $bell ( 340, 45 ) : $bell ( 480, 60 ) ) ];

?>
2 The chart tag distribution/reaction.pad pad
{chart 'density', data='trials', label='group', value='ms', title='Reaction time in ms, rested and after a sleepless night', width=640, height=320}
3 The result inline SVG · no JavaScript
Reaction time in ms, rested and after a sleepless night Rested: 150 values, median 288.5, quartiles 272.25 – 309.75, range 212 – 373; Sleep-deprived: 150 values, median 356, quartiles 314 – 401, range 213 – 572 Rested Sleep-deprived 100 200 300 400 500 600 700 Rested: 150 values, median 288.5, quartiles 272.25 – 309.75, range 212 – 373 Rested: median 288.5 Sleep-deprived: 150 values, median 356, quartiles 314 – 401, range 213 – 572 Sleep-deprived: median 356