Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

It's (US) football season now, and arguments over Strength of Schedule and the iniquity of zebras are heard across the land.

This is Matthew Colley's elegant method of calculating a probability-like ranking from the results of contests. I won't go into the mathematical details or properties of the method - there is a paper at Colley's site which gives that.

Colley uses this method to rank all Division-1A teams as part of the "computer" segment of the all-important BCS ratings. It is distinguished by its simplicity and lack of mystery tweaks.

The magnificent PDL module is ideal for carrying out these calculations. Here, I've applied them to intra-conference games only, to get a current conference ranking. The data is hard-coded in this simple version, with enough information in comments to let you replace it with your own favorite conference's results. It is more flexible and convenient to get the data by a database query or by web scraping.

#!/usr/bin/perl # -*-EPerl-*- use PDL; my @becteams = ( 'Pittsburgh', 'Louisville', 'Rutgers', 'West Virginia', 'South Florida', 'Connecticut', 'Syracuse', 'Cincinnati' ); # $C is the Colley Matrix. It depends only on the schedule # of games already played. Rows and columns are indexed in # the same order, by teams. The diagonal elements are the # number of games played plus two. Off-diagonals are zero # for no game yet played for the indexed teams, or minus one # for a game played. It contains nothing about the result of # the games. It's obviously a symmetric matrix. my $C = pdl([ # UP UL RU WV SF CT SU UC [ 5, 0,-1, 0, 0, 0,-1,-1], # Pittsburgh [ 0, 4, 0, 0, 0, 0,-1,-1], # Louisville [-1, 0, 4, 0,-1, 0, 0, 0], # Rutgers [ 0, 0, 0, 4, 0,-1,-1, 0], # West Virginia [ 0, 0,-1, 0, 5,-1, 0,-1], # South Florida [ 0, 0, 0,-1,-1, 4, 0, 0], # Connecticut [-1,-1, 0,-1, 0, 0, 5, 0], # Syracuse [-1,-1, 0, 0,-1, 0, 0, 5] # Cincinnati ]); # $wl is a column vector containing win and loss information. # For each team in the same order as $C is indexed, the value # is numerically 1 + (wins - losses)/2. my $wl = pdl([[ 3/2],[ 2 ],[ 2 ],[ 2 ],[ 1/2],[ 0 ],[-1/2],[ 1/2]]); # Pitt UL Rut WVU USF UConn SU Cincy my $c = $C->inv; my $r = $c x $wl; my %rating; @rating{@becteams} = list $r; { my $ct = 1; for (sort {$rating{$b}<=>$rating{$a}} keys %rating) { my $out = pack 'A4 A20 A6', $ct++, $_, sprintf '%5.4f', $ratin +g{$_}; print $out, $/; } } __END__ 1 Rutgers 0.7443 2 Louisville 0.6779 3 West Virginia 0.6339 4 Pittsburgh 0.5912 5 Cincinnati 0.4310 6 South Florida 0.3861 7 Syracuse 0.2806 8 Connecticut 0.2550

Congratulations to Rutgers, their higher rating for the same record as Louisville and West Virginia comes from having beaten tougher teams so far. In the Big East everybody plays everybody, so that advantage will level off by the end of the season. A conference which is too large to allow all-pairs play admits more interesting use of this method.

After Compline,
Zaxo


In reply to Sports Conference Rankings, Colley Matrix Style by Zaxo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (8)
    As of 2014-07-24 11:19 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (160 votes), past polls