Tuesday, February 25, 2014

LCS and Momentum Revised

After getting some helpful comments on reddit, it turns out my methodology may have been lacking. This is what CaptCarmine said:

I actually think you have skewed results becuase of the differing level of skills of teams in Both leauges, if you have a 2-3 win streak it can be because you have dodged a stronger team for a couple of games
Excellent point indeed. I assumed a win percentage equal to the current record of the team with the streak, I did not take in to account the opponent's record. So I went back to the data and tried to make CaptCarmine happy.

Summary

While the data has slightly more noise, the results are still quite similar -- momentum does not seem to make the teams more likely (in aggregate) to win games than if they don't have a streak. What is clear is that teams with longer streaks generally have better records (and a higher expected chance of winning).

Actual vs. Expected Winning Percentages by Streak
With one win, teams marginally outperformed their expectation, but the longer the winning streak, the less likely it seems to be that it contributes to a win. Loss streaks are much less clear. Momentum in the negative direction may carry more weight.

Method

I summed up the games and wins of each team and their opponent on a streak. I summed up the totals so that we have a bigger data set to work with.

Caveats

Teams who both have streaks are currently included, which means that if two teams have winning (or losing) streaks, one is bound to break theirs no matter what.

Thursday, February 20, 2014

Does Momentum Increase Win % in the LCS?

The announcers love talking about momentum. If a team is coming from a win or two, the announcers comment on their 'momentum' as if it will have an impact on the outcome of their current match.

Will it?

Summary

It doesn't look like it. While individual teams may display streaky behavior, on the whole, teams underperform their previous record the bigger the streak is for both wins and losses.


Method

Using the stats from lolesports for the 2013 LCS (both spring and summer, NA and EU), I looked at a team's current streak coming in to the game, their record coming in to that game, and the outcome of the game.

The 'Actual' bars in the above chart is the LCS record for teams with a streak of that type. The 'Expected' is the average record (win %) for teams with a streak of that type going in to the game. If teams with a 2-game win streak win at a rate of 57.2% up to that point, with momentum we would expect them to do even better. On the flip side, teams with a losing streak of 4+ games only have a 29.4% win rate coming in to that game, yet they win over 50% of their games.

Caveats

To increase sample size I looked at the LCS as a whole. Individual teams may show momentum, but on the whole the LCS doesn't. I also used win percentage rather than raw totals of games played (won and lost) meaning that the record of a team that is 1-0 is weighted as heavily as a team that's 9-0 for the average, this may have an impact on the results.

Sunday, February 16, 2014

Gathering Match Data

I gathered all the match data for the NA and EU LCS, Promotion Tournaments, and Playoffs using the following jQuery:

$ = jQuery;
var clipboard = [''];
week = $('.current-week').text();
var gametitle = $(location).attr('href').split("/");
$('.inset.row.toggle-hide.ng-scope').each( function() {
    // Get Link
    var href = $(this).find('.match-link').attr('href').split("/");
    var link = href.pop();

    // Get Time
    var time = $(this).find('.program-time.region-hide.na-time.ng-binding').text() 

    // Get Teams
    var teamA = $(this).find('.team-name').eq(0).text();
    var teamB = $(this).find('.team-name').eq(1).text();

    // Get Winner
    if ($(this).find('.team-1.winner').length == 1) 
      {
        var resultA = 1;
        var resultB = 0;
      }
    else
      {
        var resultA = 0;
        var resultB = 1;      
      } 

    // Get Percentages
    var winA = $(this).find('.pds-feedback-per').eq(0).text();
    var winB = $(this).find('.pds-feedback-per').eq(1).text();

    // Set Header
    var header = gametitle[3] + ',' + gametitle[4] + ',' + gametitle[5] + ',' + week + ',' + link + ',' + time + ','

    // Print to Log
    var output = header + 'blue,' + $.trim(teamA) + ',' + resultA + ',' + winA + String.fromCharCode(13) + ',' + header + 'red,' + $.trim(teamB) + ',' + resultB + ',' + winB + String.fromCharCode(13);
    clipboard.push(output);
})
copy(clipboard);

This code will work in Chrome (where the 'copy' command is usable) and for any page. If you haven't voted on the matches, it will not return the fan vote percentage. You also need to wait for the page to completely load or else it will spit out an error. This can likely be automated using phantomjs or the equivalent, but I just did it manually as there are only something like 44 different pages to go through which is easier than setting up the test environment for the time being.

Times should not be trusted, they seem to be auto-adjusted, and there is no base datetime information to grab to confirm. That information can be grabbed from the individual match pages, but that is a different can of worms.

$ = jQuery;
var clipboard = [''];
week = $('.current-week').text();
$('.inset.row.toggle-hide.ng-scope').each( function() {
    // Get Link
    var href = $(this).find('.match-link').attr('href').split("/");
    var link = href.pop();

    // Get Time
    var time = $(this).find('.program-time.region-hide.na-time.ng-binding').text() 

    // Get Teams
    var teamA = $(this).find('.team-name').eq(0).text();
    var teamB = $(this).find('.team-name').eq(1).text();

    // Get Winner
    if ($(this).find('.team-1.winner').length == 1) 
      {
        var winner = 'W, L'
      }
    else
      {
        var winner = 'L, W'
      } 

    // Get Percentages
    var winA = $(this).find('.pds-feedback-per').eq(0).text();
    var winB = $(this).find('.pds-feedback-per').eq(1).text();

    // Print to Log
    var output = week + ',' + link + ',' + time + ',' + $.trim(teamA) + ',' + $.trim(teamB) + ',' + winner + ',' + winA + ',' + winB + String.fromCharCode(13);
    clipboard.push(output);
})
copy(clipboard);

The code above will return each match on its own line which is good for looking at match-based data, but much more difficult when trying to sum up team records or the like.

The results of both scripts on everything from the 2013 Spring Split to the 2014 Promotion Tournament are located in the below spreadsheet:


Friday, February 14, 2014

Are LCS Fans Good Predictors of Outcome?

I have gone through all the past LCS results on lolesports.com from the 2013 Spring Split to the 2014 Spring Promotion Series and looked at how the fans voted, and how the matches actually ended up.

I wanted to compare three different methods:
  1. How the fans actually voted
  2. How they compare to flipping a coin
  3. How they compare to picking the team with the better record
How did the fans vote?

Out of 406 matches with polling data available, the fans were right on 236 of them, for a respectable 58.1% accuracy on picking the correct winner of the match. The news isn't all good though. When the fans thought a team was 75% likely to win a match by the voting, we would expect that the team they voted for would come out ahead three out of four times. Instead, they were right only 52% of the time, suggesting that they dramatically overestimate the relative strengths of teams.

Confidence # Predictions # Correct Actual %
50%-55% 43 22 51%
55%-60% 53 26 49%
60%-65% 47 28 60%
65%-70% 53 26 49%
70%-75% 47 30 64%
75%-80% 44 23 52%
80%-85% 49 35 71%
85%-90% 45 30 67%
90%-95% 25 16 64%

Are they better than random chance?

Thankfully, the fans are better than random chance. There would only be a 0.043% chance of getting 236 correct estimates if you were to flip a coin on each match. So there is definitely some predictive ability. But should we be betting on the fans being right, or can we do better?

Marcel the Monkey's Picks

In baseball stat analysis, Tom Tango came up with a method of estimating player performance called the Marcels, because they were so simple that even a monkey could perform them. So I came up with a similar concept for the LCS, which follows these simple rules for picking a winner:

  1. Pick the team with the higher win rate in that split
  2. If they are tied, go with the blue side
Using this incredibly simplistic system, I was able to successfully predict the outcome of 288 matches, or 70.9% of them. In other words, the fans are worse than the most basic of predictions that a rational human would make. LCS fans are definitely not a good example of the Wisdom of Crowds.

Methodology

I have included my spreadsheets with the raw data here:



Please feel free to use these for data analysis. They were scraped from lolesports.com using jQuery and the analysis was done in Excel.