IQAPI Official Algorithm

Full Algorithm

\[\mathbf{score} = \left[\left( \frac{\mathrm{std} (\overline{QuaffPtsScored}) - \mathrm{std} (\overline{QuaffPtsLost}) + 2\times\mathrm{std}(win\%)}{4} - |lowest| + \mathbf{SWIM} \right)\times \left( \mathrm{std}(\frac{2*opp\_w\% + opp\_opp\_w\%}{3}) - |lowest| \right) \right] \\ \times \begin{cases} \frac{\sqrt{Games}}{2.25} &\text{if } Games < 5 \\ 1 &\text{if } Games \geq 5 \end{cases} \times \begin{cases} 1/3 &\text{if } Opponents = 1 \\ 2/3 &\text{if } Opponents = 2 \\ 1 &\text{if } Opponents \geq 3 \end{cases} \times \begin{cases} 0.5 &\text{if } Events = 1 \\ 1 &\text{if } Events \geq 2 \end{cases}\]

The Breakdown

To Calculate SWIM

\[ \mathbf{P} = QuaffPoints_\mathrm{winner} - QuaffPoints_\mathrm{loser} \]
P is essentially point differential, without the final snitch of the game. If a game goes into overtime, the regulation-time snitch gets counted as if it were quaffle points.
\[ \mathbf{P_{adj}} = \mathrm{min}(\mathbf{P},80) + \sqrt{\mathrm{max}(\mathbf{P}-80,0)} \]
Adjusted P is a way of diminishing the returns on teams running up the score. If the differential score is over 80 points, then every 10 points after 80 is really the square root of those points. So if P is less than 80, say 50. Then min(50,80) = 50 and \( \sqrt{\mathrm{max}(50-80,0)} \rightarrow \sqrt{\mathrm{max}(-30,0)} \rightarrow \sqrt{0} = 0 \). So 50+0 =50 points. If the differential were, say, 100, then min(100,80) = 80, and \( \sqrt{\mathrm{max}(100-80,0)} \rightarrow \sqrt{\mathrm{max}(20,0)} \rightarrow \sqrt{20} \). So Adjusted P becomes 80 + sqrt(20) at that point. Any points above 80 are square-rooted to discourage running up the score.
\[ \mathbf{SWIM} = \mathbf{P_{adj}}+ \left[ \begin{cases} 30 & \text{if winner caught snitch}\\ 0 & \text{else } \end{cases} \times \begin{cases} e^{-0.033\times(\mathbf{P_{adj}}-20)} & \text{if } \mathbf{P_{adj}} \geq 30 \\ 1 & \text{if } \mathbf{P_{adj}} \lt 30 \end{cases} \right] \]
SWIM or Snitch When It Matters is simply P adjusted, if the winner did not catch the snitch. If the winner did catch the snitch, and the game was close enough to go either-way depending on who caught it (P of less than 30) then it includes all 30 points from the snatch. The snitch mattered for that victory. However, if the winner was ahead by 30 or more points, meaning the snitch was not the deciding factor in the victory, then only a portion of those snitch points are awarded (respective to how big the point gap was). SWIM becomes negative for the team that lost.

Calculate Performance Metric

\[ \mathbf{Strength of Schedule (SoS)} = \frac{2*opp\_w\% + opp\_opp\_w\%}{3} \]
Strength of Schedule is the average win percentages of your opponents and your opponents' opponents. Your direct opponents are weighted to be more important to your score than your transitive opponents.
\[ \mathbf{Unicorn} = \frac{\mathrm{std} (\overline{QuaffPtsScored}) - \mathrm{std} (\overline{QuaffPtsLost}) + 2*\mathrm{std}(Win\%)}{4} \]
Unicorn is the measurement of the skills of a team. Three factors are added together and averaged to make this score. Each factor is individually standardized to compare how different or similar your score in those areas are to everyone else's. The first metric is the average of all offensive points scored by your team, standardized against everyone else's average. Then subtracted by the standardized average of points allowed by your team across all games. Finally, the actual winning percentage of the team is doubled and added in (this weights the winning percentage higher). These are averaged over 4 instead of 3 to account for the weighting factor of Win%
\[ \mathbf{\mathrm{std}(Unicorn)_{scaled}} = \mathrm{std}(\mathbf{Unicorn}) + |\mathrm{std}(\mathbf{Unicorn})_{lowest}| \]
Scaled std(Unicorn) is calculated by adding the absolute value of the lowest value to everyone's std(Unicorn). Therefore the team with the lowest value will end up with 0, and everyone's score above that becomes a positive number, but all shifted by the same amount
\[ \mathbf{\mathrm{std}(\overline{SWIM})_{scaled}} = \mathrm{std}(\overline{\mathbf{SWIM}}) + |\mathrm{std}(\overline{\mathbf{SWIM}})_{lowest}| \]
Scaled std(SWIM) is calculated by adding the absolute value of the lowest value to everyone's std(SWIM). Therefore the team with the lowest value will end up with 0, and everyone's score above that becomes a positive number, but all shifted by the same amount. This is done so that SoS times this value will always be detrimental when there are low SoS values (small SoS times a negative number would be beneficial to the team).
\[ \mathbf{performance_{raw}} = \left( \mathbf{\mathrm{std}(Unicorn)_{scaled}} + \mathbf{\mathrm{std}(\overline{SWIM})_{scaled}}\right)\times\mathbf{SoS} \]
Raw Performance is measured by scaled Unicorn added to scaled SWIM times SoS. SWIM is being weighted by the relative difficulty of opponents to prevent inflation in consistently playing unsuccessful teams.
\[ \mathbf{performance_{scaled}} = \mathbf{performance_{raw}} + |\mathbf{performance_{lowest}}| \]
Performance is then simply shifted to give the lowest-scoring team a score of 0 (lowest + |lowest| = 0), and every other team a positive number, increasing as the difference from the lowest team. This is done, because the Raw Performance metric results in numbers ranging typically from -4 to positive 4. Numbers are shifted to be all positive so that the impending modifier/penalty multiplications are fairly applied (otherwise teams on either side of 0 can never pass one another in the rankings).

Calculate Penalties/Modifiers

\[ \mathbf{GamePenalty} = \begin{cases} \frac{\sqrt{Games}}{2.25} &\text{if } Games < 5 \\ 1 &\text{if } Games \geq 5 \end{cases} \]
The Game Penalty is a penalty for playing less than 5 games in a single season. It does not matter whether the games for this requirement are part of a tournament or not. A game always counts as 1 game.
\[ \mathbf{OppPenalty} = \begin{cases} 1/3 &\text{if } Opponents = 1 \\ 2/3 &\text{if } Opponents = 2 \\ 1 &\text{if } Opponents \geq 3 \end{cases} \]
The Opponents Penalty penalizes teams that do not play more than unique 2 opponents in a season. The penalty is linear with the amount of teams played. Any amount of teams 3 or above simply results in no penalty. Your score is cut into a third for only playing one team, two thirds for two teams. Full credit otherwise.
\[ \mathbf{EventPenalty} = \begin{cases} 0.5 &\text{if } Events = 1 \\ 1 &\text{if } Events \geq 2 \end{cases} \]
The Event Penalty discourages playing all games at once. Playing a series of games in a tournament only amounts to 1 event. Playing two tournaments in a season accounts for two events. Every regular season game outside of tournaments (e.g. dual meets) count as an event each. Just playing 1 game against another school in a head-to-head matchup counts as 1 event.
\[ \mathbf{modifiers} = \mathbf{GamePenalty} \times \mathbf{OppPenalty} \times \mathbf{EventPenalty} \]
The modifiers metric is the combination of each penalty. Having only 1 event and only playing two teams (assuming you played 5 games) is a half of two thirds = one sixth = 0.1666.. If you satisfied all the requirements in the penalties this number will be 1. This number can be as low as 0.074

Put it all together

\[ \mathbf{finalScore} = \mathbf{performance_{scaled}} \times \mathbf{modifiers} \]
Your team's Final Score is your scaled performance times combined penalties.

Where:

std = standard deviation

Games is the number of officially ranked games played in the current season

Opponents is the number of unique opponents faced in the current season

Events is the number of Events attended. Tournaments count as 1 event. So 5 games in 1 tournament is just 1 event. Regular season games a.k.a. dual meets are also 1 event each. Two dual meets = two events. Even if they are on the same day.