Leader of Birmingham.pm [pm.org] and a CPAN author [cpan.org]. Co-organised YAPC::Europe in 2006 and the 2009 QA Hackathon, responsible for the YAPC Conference Surveys [yapc-surveys.org] and the QA Hackathon [qa-hackathon.org] websites. Also the current caretaker for the CPAN Testers websites and data stores.
If you really want to find out more, buy me a Guinness
Links:
Memoirs of a Roadie [missbarbell.co.uk]
[pm.org]
CPAN Testers Reports [cpantesters.org]
YAPC Conference Surveys [yapc-surveys.org]
QA Hackathon [qa-hackathon.org]
Nicole asked me to calculate the expected height for Ethne, which was 161cm (5'4"). However, there are percentile readings that are a bit difficult to calculate, so I turned to Perl for the answer.
#!/usr/bin/perl -w
use strict;
use Getopt::Long;
my ($opt_m,$opt_f,$opt_s);
my %options = (
'mother|m=f' => \$opt_m,
'father|f=f' => \$opt_f,
'sex|s=s' => \$opt_s,
);
GetOptions(%options);
usage() unless($opt_m && $opt_f && $opt_s);
$opt_s = lc $opt_s;
usage() unless($opt_s eq 'm' or $opt_s eq 'f');
my ($MPH,$cent,$offset) = (177,10.0,7); # male
if($opt_s eq 'f') { ($MPH,$cent,$offset) = (164,8.5,-7) }
my %centiles = ( 50 => $MPH );
my $centile = $cent / 41;
for(1..49) { $centiles{$_} = $MPH - ((50 - $_) * $centile); }
for(51..99) { $centiles{$_} = $MPH + (($_ - 50) * $centile); }
my $mph = (($opt_m + $opt_f) / 2) + $offset;
printf "(a) %3.2f cm\n", $opt_f;
printf "(b) %3.2f cm\n", $opt_m;
printf "(c) %3.2f cm\n", $opt_m + $opt_f;
printf "(d) %3.2f cm\n", ($opt_m + $opt_f) / 2;
printf "(e) %3.2f cm (MPH) (f) %s centile\n",$mph,centile($mph);
printf "(g) %s centile - %s centile (TCR)\n",
centile($mph+$cent),centile($mph-$cent);
print <<HERE;
Notes:
(a) = father's height
(b) = mother's height
(c) = sum of (a) and (b)
(d) = (c) / 2
HERE
printf "(e) = (d) %s 7 cm (MPH)\n",($opt_s eq 'f' ? '-' : '+');
printf "(f) = MPC - nearest centile to (e)\n";
printf "(g) = TCR (MPH +/- %3.2f cm)\n",$cent;
print <<HERE;
1) MPH = mid-parental height
2) MPC = mid-parental centile
3) TCR = target centile range
HERE
sub centile {
my $c = shift;
my $i = 1;
while($i <= 99 && $c > $centiles{$i}) { $i++ }
return '100th' if($i >= 99); # backout now!
my $r = ($c - $centiles{$i}) > ($centiles{$i+1} - $c) ? $i+1 : $i;
my $m = $r % 10;
sprintf "%d%s", int($r), ($m == 1 && $r != 11 ? 'st':
$m == 2 && $r != 12 ? 'nd':
$m == 3 && $r != 13 ? 'rd' : 'th');
}
sub usage {
print <<HERE;
Usage: $0 --mother=153 --father=186 --sex=m|f
--mother mother's height in centimetres
--father father's height in centimetres
--sex (m)ale or (f)emale
HERE
exit;
}
The calculations are different for boys and girls, but thankfully we still have DanDan's to hand.
Seeing as both my brother and I are taller than our parents, I wonder if these figures change with any known regularity. Or is it a finger in the air job.
Mid-Parental Height 0 Comments More | Login | Reply /