Eigenranking
(15 pts)
Use an eigenvalue analysis to rank your favorite team’s conference in your favorite season. The conference should have at least 4 teams but, as you’ll be entering a matrix by hand, I recommend that it not be too large. Be sure to include the source of your data and all the code you use to produce your answer. You might double check to make sure that your code runs when copied from our forum into a Jupyter notebook.
No favorite team?!!? Well, one good source is Pro Football Reference. For example, the Cleveland Brown's best season in my lifetime was 1986. I can examine that year on Pro Football Reference's summary of 1986. I'm not a particular big NFL fan (because my team is no good) but it's nice because it's broken into such small divisions, all of which are fair game. Looking at the AFC Central that year, I see that it was composed of the following teams:
- Cleveland Browns
- Cincinnati Bengals
- Pittsburgh Steelers
- Houston Oilers
Following the links for each team, I can find the total number of points they scored against each other to get the following matrix:
$$\left(\begin{matrix}
0 & 47 & 64 & 23 \\
33 & 0 & 33 & 59 \\
55 & 52 & 0 & 43 \\
30 & 60 & 26 & 0
\end{matrix}\right).$$
Now, I can proceed with my analysis.
Comments
My favorite team is the Carolina Panthers, so I decided to look at their 2015 Season (15-1 record). Their division (NFC South) consists of the following teams:
Looking at each time those teams played each other and recording the sum of the scores, we find the following matrix:
$$\begin{pmatrix}
0 & 51 & 68 & 75 \\
20 & 0 & 38 & 39 \\
60 & 51 & 0 & 43 \\
33 & 46 & 43 & 0
\end{pmatrix}$$
To start our analysis, we first need to import the necessary libraries:
We can then enter the above matrix into Python, and call it M. We will also create a list of each team in the NFC South, ordered by the rank of their overall record on the season
Then, from using the code found in EigenRankings, we input the following code to solve for our eigenvalues:
We then find the absolute value of each eigen value, and use the
argsort
command to order them properly:This tells us that, within the division, the NFC South would ranked in the following manner:
This can also be expressed by using the code
We can then use
[vec[i] for i in ranking]
to find the strength of each team within the divisionI think it's interesting to see that while Atlanta had the second best record overall, they statistically were the worst team in the division. However, we we juts take a look at their divisional records, we find that they would be ordered
Which follows closer to what we found in the above analysis. This would then get into the strengths of each team's overall schedule which would involve a 32x32 matrix, and would be a little more hairy.
Not having a favorite team, I simply chose the the 2019 NFL AFC North season; the teams are:
1) Baltimore Ravens
2) Pittsburgh Steelers
3) Cleveland Browns
4) Cincinnati Bengals
Creating a matrix corresponding to the sum of the points earned against one another gives us,
$$
\begin{pmatrix}
0 & 54 & 56 & 72 \\
33 & 0 & 27 & 43 \\
55 & 34 & 0 & 50 \\
30 & 13 & 52 & 0
\end{pmatrix}
$$
Import libraries,
Create matrix and list of teams,
Determine eigenvalues/vectors and print eigenvalues,
$$
[ 128.68530542+0.j , -48.45547934+5.80447665j , -48.45547934-5.80447665j , -31.77434673+0.j ]
$$
Determine order of the absolute values for each eigenvalue,
$$[0, 2, 1, 3]$$
List teams in the same order,
$$[ Baltimore, Cleveland, Pittsburgh, Cincinnati ]$$
Determine relative strengths according to the eigenvector,
$$
[0.6260993289458243,
0.5309009843399298,
0.4061133811064022,
0.4015167453628903]
$$
I chose to do an eigneranking for the 2007 NFL AFC East. The teams in the AFC East are
In 2007, New England went undefeated at 16-0, and the other teams were significantly less fortunate with records of 7-9, 4-12, and 1-15, in the same order listed above. Using the scores of these teams I created the matrix
$$
M=
\begin{bmatrix}
0 & 94 & 58 & 77 \\
17 & 0 & 30 & 51 \\
24 & 17 & 0 & 71 \\
35 & 27 & 41 & 0
\end{bmatrix}
$$
This matrix keeps the same ordering where each row represents the team that scored the points and each column are the points that were scored against the other team. I put this in python.
Then I used
eig
to calculate the eigenvalues and eigenvectors.The first eigenvalues will be used to rank the teams since its positive and has no imaginary component.
I created a new vector to hold the first eigenvector and used
argsort
to rank the teams' strength.
Finally the number representing each team's strength is given by
@PrinceHumperdinck That's great! I did make one change by adding a link that points directly at the season in question. Thus, to get:
I entered
@Opie and @joshua Your responses look really good - I'm so close to pushing that button! It'd be nice to have a reference to the data that you used. My response to PrinceHumberdinck shows how to do that.
For no reason in particular, I chose to study the 2012 AFC South.
The teams in this division are the Houston Texans, the Indianapolis Colts, the Tennessee Titans, and the Jacksonville Jaguars. Why a team from Indianapolis is in the South division is beyond me. I'm not in charge.
I imported the necessary libraries, set up a list with the team names and matrix with values for how many points each team scored against the others. Each row contains the points scored by each team. Each column contains points conceded.
Next, I used the
eig()
function to determine the eigenvalues for this matrix. Recall that each eigenvalue will be associated with the given team. We will also just examine the absolute value of each one.Next I used
argsort()
to sort the entries, and thenreverse
to switch the order, so the best performing team is listed in the 0th position.Finally, to examine each team's rank:
I'm from the Illinois. So I did my thing about the 1969 49ers: 1969 NFL Costal
I set up my matrix as a # of points by these teams (left to right and up to down):
LA Rams, Baltimore Colts, ATL Falcons, San Fran:
(Side note: Didn't know Bal had the Colts at one point)
$$\begin{pmatrix}
0 & 34 & 55 & 68 \\
33 & 0 & 34 & 38 \\
13 & 20 & 0 & 45 \\
51 & 44 & 19 & 0
\end{pmatrix}$$
What this looked liked in Java:
Using Java to solve for the eigenvalues:
Assigning Teams to their respected eigenvalues and sorting those eigenvalues:
The "s" strength of the eigenvalue:
Of note: our teams LA, Bal, ATL, and SF placed for the season as 4th, 9th, 10th, 13th, respectively. SF did second best in our list, but placed the lowest. Taking a quick look at their games through the entire season, its evident that they had no trouble putting points on the board, but ended it all with 4 wins 8 losses and 2 ties.
In terms of just these 4 teams: SF had the second most points between them, but tied for least wins with ATL. Therefore, this particular method is a better representation of a team's ability to score points rather than a win; many more factors need to be accounted for in the matrix formulation to make this a more accurate model.
@dan Love it! Love the pic! Love the coastal! Just love it!
Not sure what "the Illinois" has to do with it (anti-coastal?) but it's great.
I decided to rank the NFC West from 1984, which included the 49er's, the Rams, the Saints, and the Falcons. I gathered the wins and losses from the link below:
https://www.pro-football-reference.com/years/1984/
The result (using the order shown above from top to bottom) gave the following matrix:
$$
A = \left(
\begin{array}{cccc}
0 & 33 & 30 & 14 \\
0 & 0 & 28 & 28 \\
20 & 10 & 0 & 281 \\
5 & 30 & 36 & 0 \\
\end{array}
\right).
$$
In this matrix, each entry represents the amount of points scored by a team described by a row against a different team in a column. It can be noted that the diagonal is all 0's as a team cannot score against itself. The first step will be calculating the eigenvalues of the matrix:
After running eig(), the following results were generated:
At this point, the command argsort will be used to rank the eigenvalues.
The output, ranking gives the following:
This is the ranking of each row based on the eigenvalues calculated earlier. The next step is to substitute in the names of each team and to check the relative strengths of the rankings based on their eigenvectors:
Which gives the outputs:
I've grown up watching the NYJ, never watching them win. So decided to go back to 1968, when they beat the Raiders in the Super Bowl 16-7.
This is the matrix corresponding to the AFL - East division in 1968 which had the teams ranked from high to low - NYJ, Houston Oilers, Miami Dolphins, Boston Patriots, Buffalo Bills.
\begin{pmatrix}
0 & 46 & 66 & 95 & 60 \\
21 & 0 & 31 & 61 & 65 \\
24 & 34 & 0 & 72 & 35 \\
45 & 17 & 17 & 0 & 34\\
58 & 13 & 31 & 13 & 0
\end{pmatrix}
Started by loading in the correct libraries
Then creating the matrix
To find the eigen values we use
which produced
In order to get these ranked we use the follow code,
To get an easy read,
This is only slightly off from their original rankings, with the swap of the Bills and Patriots
and for the strength of the values we have
I'm not much of a sports fan, so I chose to analyze an NFL division. The small division sizes, relatively small number of games played, and the uniform distribution of games within the division makes this analyses easier as compared to other sports. I picked the NFC East division since my dad is a New York Giants (or as he would say, New Jersey Giants) fan. And I went with the the 2011 Season, since that was the last time the Giants won the Super Bowl, which had that totally absurd and hilarious touchdown at the end.
In order to use eigen-rankings to analyse the data, I first had to add up all the points that each team in the division scored against every other team in the division. The teams are indexed in the following order: New York Giants, Philadelphia Eagles, Dallas Cowboys, and Washington Redskins, which resulted in the matrix,
$$M=\begin{pmatrix}
0&39&68&24\\
33&0&54&54\\
48&14&0&45\\
51&23&40&0\end{pmatrix}.$$
From here, I went over to Python to compute the eigenvalues and eigenvectors of the matrix.
First, I imported the appropriate libraries,
and entered my matrix,
Next, I setup the index for the teams,
Then, I calculated the the eigenvalues and eigenvectors,
which give the following approximate eigenvalues:
$$121, -46.6+17.8i, -46.6-17.8i, \text{and} -27.9.$$
Using the
argsort()
function, and applying the team index to the result,the eigen-ranking for the division is found to be,
Laslty, by reordering the eigenvector used for the ranking,
we find each teams approximate strength according the eigen-ranking,
.
I know nothing of football. While I do throw a Super-Bowl part every year, it's purely for the opportunity to grill out and watch the flashy half-time show. That said, my brother patiently explained to me about conferences and divisions. I went with a highlight season from his favorite childhood team, NFC East of 1995 champs Dallas Cowboys:
Tallying regular season points scored into a matrix, where the Cowboys are team 0, and the Cardinals team 5 (across both axis), we get:
$$M =
\begin{pmatrix}
0 & 51 & 40 & 56 & 71\\
32 & 0 & 51 & 45 & 52\\
51 & 41 & 0 & 28 & 47\\
20 & 33 & 44 & 0 & 37\\
33 & 39 & 31 & 27 & 0
\end{pmatrix}
$$
While the Cowboys went on to win the playoffs, what would an eigen-ranking tell us about relative team strength during the regular season?
First, lets setup our environment in python:
And import our team roster and season data:
We then process our matrix into eigen-values and eigen-vectors:
Extract our dominant eigen-vector, and sort our data based on overall eigen-values:
This gives us an overall ranking of:
By points points scored, this tells us that the Cowboys maintained a significant margin against the other teams in the '95 NFCE. Interestingly, team rankings appear to be [roughly] evenly stratified. This is likely due to football's scheme of translating a single major scoring event (touchdown) into 6 points, and rewarding minor strategic advancement with fewer (1-3) points.
I've never been a huge football fan but I hail from western Pennsylvania so I guess my team would have to be the Steelers. I chose to analyze the 1975 AFC Central division, consisting of the following teams.
Using the same order as above, I constructed the matrix
$$
M =
\begin{bmatrix}
0 & 47 & 44 & 38\\
52 & 0 & 20 & 23\\
38 & 61 & 0 & 28\\
65 & 73 & 56 & 0
\end{bmatrix}
$$
to represent the points scored by each team.
Utilizing python
I found the dominant eigenvalue to be in the $0^{th}$ index. Therefore, the eigenvector that effectively ranks these teams should be the $0^{th}$ column of
evec
.