#!/usr/bin/perl


@team_list = ( "BAL", "BOS", "CHW", "CLE", "DET", "KCR", "LAA", "MIN", "NYY", "OAK", "SEA", "TBD", "TEX", "TOR");

foreach $team (@team_list) {

  # first, use residuals from starting 9 OPS prediction
  $file = sprintf "team_%3s.out", $team;
  $cmd = "awk '{ print \$12 }' $file | stats ";
  $ret = `$cmd`;
  chomp($ret);
  @words = split(/\s+/, $ret);
  $mean = $words[8];
  $stdev = $words[11];

  # now use residuals from overall team OPS
  $cmd = "awk '{ print \$13 }' $file | stats ";
  $ret = `$cmd`;
  chomp($ret);
  @words = split(/\s+/, $ret);
  $overall_mean = $words[8];
  $overall_stdev = $words[11];



  printf " %4s  %6.1f %6.1f = %7.3f   %6.1f %6.1f = %7.3f \n", 
      $team, $mean, $stdev, $mean/$stdev, $overall_mean, $overall_stdev, 
      $overall_mean/$overall_stdev;

}

exit 0;

