6 die "Usage: $0 <s> <t>\nW(AA), W(Aa) and W(aa) is 1-s, 1, 1-t respectively.\n" if @ARGV<2;
10 my ($w11,$w12,$w22) = (1-$s, 1, 1-$t);
11 my ($AA,$Aa,$aa) = (0.50, 0.40, 0.10);
16 my $avgW = $p*$p*$w11 + 2*$p*$q*$w12 + $q*$q*$w22;
18 print "GT: ($AA,$Aa,$aa) => ($p,$q)\nFit: ($s,$t) => ($w11,$w12,$w22), $avgW\n";
20 for my $i ( 1 .. 2 ) {
21 my $avgW = $p*$p*$w11 + 2*$p*$q*$w12 + $q*$q*$w22;
22 my $np = ( $p*$p*$w11 + $p*$q*$w12 ) / $avgW;
23 my $nq = ( $p*$q*$w12 + $q*$q*$w22 ) / $avgW;
24 $AA = $p*$p; $Aa = 2*$p*$q; $aa = $q*$q;
25 print "$i\t-> ($np, $nq) ",$np+$nq,"\t($AA,$Aa,$aa)\tavg(w)=$avgW\n";