Ehm, Andrew is the author. I’m sorry.

]]>Hello, Bob,

since you seem to use WordPress, you may want to read up the documentation concerning code-Tag:

https://codex.wordpress.org/Writing_Code_in_Your_Posts

I’m using a WordPress.com blog, where Automattic provides a nice shortcut with syntax highlighting:

http://en.support.wordpress.com/code/posting-source-code/

Read the end of that article to learn, how to use it in WordPress.org blogs.

]]>I’d prefer to treat each goal as a binary variable, and run logistic regression trying to predict which team scored it. It seems like 1-0 games should tell you less about team skills than 6-5 games, which this would do. In the 6-5 case, you are pretty sure that the teams are almost evenly matched. In the 1-0 case, you would think the team that won is better, but with very little confidence. This matches better how I think about teams after a game.

]]>Thanks. Stupid me missed it on first read.

]]>No, it’s just that my data-entry team typed in the match results from a French book.

]]>I assume that they are official FIFA names, and FIFA is a French institution.

]]>Phil: I think the problem is rather with estimating the sigma than with how heavy the tails are. The “outliers” here are not really that extreme. The largest observed difference was 6, sqrt(6)=2.45. Given that most values were +/- 0, 1, sqrt(2), this is not really so far off that a t_3 or something would be needed to model it.

]]>In soccer a team that trails by two goals (or more) in the second half faces a rather dismal situation: to have any chance of winning they have to play in a way that increases their own chance of scoring, compared to the way they played at the start of the game, but that increases their opponents’ chance of scoring even more. Their probability of winning increases, but so does the magnitude of their expected loss. (If this seems confusing or impossible, consider this example: you are playing a game with dice. If you roll a 1 your opponent gets a point, if you roll a 6 you get a point, and any other roll is neutral. You are trailing by one point and you have a single roll remaining in the game. You can choose to roll a conventional die, or to roll a die that has four 1’s and two 6’s. If you pick the conventional die, you have 1/6 chance of tying the game and 1/6 chance of losing by 2. If you pick the other die, you have a 1/3 chance of tying the game, but if you don’t tie the game you are guaranteed to lose by 2: you’ve substantially increased your chance of winning while simultaneously increasing your chance of losing by a larger margin. In more general terms, you’ve decreased your expected victory margin but increased the variance of the outcomes).

Andrew says “My first thought was to play with the t degrees of freedom, but that can’t really be the solution.” I don’t see why that can’t be the solution. But Andrew says he tried it and it didn’t help, so I agree that it _isn’t_ the solution. (But how could it not help?) I do think a wide-tailed distribution makes sense, though, so if I had to pick a number of degrees of freedom I’d be inclined to use a number like 3 or 4 instead of 7. It may not help much but it still seems better to me.

If having a wider distribution for p( y_ij | a_i – a_j) doesn’t fix the problem then I suppose one has to look to more complicated models. One thing that comes to mind is that team abilities change with time — Brazil was missing their best offensive player and one of their best defensive players in the loss to Germany, for example. Some of the group round games are essentially meaningless to one or both teams — they’ve already been eliminated — which one would expect to lead to less effort (or lower “ability”) in those games. Data on injuries and disqualification due to penalties are available, and of course it’s possible to determine whether a game is meaningful or not, so at least those factors could be incorporated in the model. But I would have expected that simply using a wider-tailed distribution would help a lot and I’m still surprised that it doesn’t.

]]>Perhaps many team parameters (e.g. defense versus offense?) would be required to generate data like this and just taking the differences may not catch an important commonness separately from those.

]]>Not directly. Yu and Meng selects from two different parameterizations (well, one parameterization and one parameter expansion), depending on the conditioning variables, to ease Gibbs sampling, where as here we’re just choosing a single optimal parameterization because HMC jointly updates all of the parameters at once. The underlying reasons for the improved performance are also different.

]]>Bob:

Ultimately we’d want to analyze the discrete data directly. Any of these transformations is just a way to keep as much of the data information as possible using a convenient model. In this case, convenience is not so much in programming as in having an understandable model.

]]>Bob:

This could be done but I don’t think there’s enough information in the data to estimate team-level variability. I mean, sure, if you fit such a model to these data you’d find that Germany and Brazil have high estimated variabilities, but I don’t know that this would really give you anything useful.

]]>Does that have anything to do with the ideas in Yu and Meng’s ancillarity-sufficiency interweaving strategy paper?

]]>For the full details, see the Betancourt and Girolami paper on hierarchical models in HMC:

http://arxiv.org/abs/1312.0906

We called the non-centered parameterization the “Matt trick” because Matt Hoffman derived it from first principles while working on Stan. There are more details on how to use it in Stan in the modeling language manual’s chapter on variable transforms.

]]>Once you start doing arbitrary transforms like this, there’s no stopping. Why not a log basis (with something dealing with the 0 case)?

]]>AG, can’t you hear the thunder? You better run, you better take cover.

]]>That was Nate. Andrew’s model put Honduras and Cameroon lower (having observed the actual games).

]]>We have Bessel functions, but I don’t think they’re this particular one. No idea how easy it would be to implement.

Given that the Skellam distro is the difference of two Poissons with different means, we could model the Poissons directly given that we have the raw data, not just the differences.

]]>Hey, we’ve even got a slick emacs mode that Jeffrey Arnold’s been keeping up to date.

]]>What Andy W. said. I just updated the post to use “pre” tags instead of “code” tags.

]]>The short answer is that the number of goals scores depends on the opponent’s defense. By modeling differential, you roll everything together into one model.

]]>Rahul:

I posted all the files; see the link near the end of the post.

]]>Would that work in Stan? (I guess modified Bessel function might be the problem?)

]]>Yeah, though that’s not very surprising to me. People writing and maintaing software of various forms these days tend to have a fetish for fancy colors and it’s not at all hard to define new grammar rules to format them for something like pygments. (which can be used in many more places than html output for web content…)

Everyone loves pretty colors and pretty graphs. =)

]]>Wow, someone’s already written a syntax highlighting template for Stan?

]]>http://pygments.org/demo/462830/

(Sorry my demo example sadly also lost the benefit of proper indentations due to it being a copy and paste from your blog)

Scroll to bottom of page to paste in and format more examples for yourself(without having to permabebtly save a demo link like I did above unless you want to). Don’t forget to select “Stan” from the drop down menu on top right. After it runs you also get a choice between many different color “themes” in yet another drop down if you don’t like the defaults.

I’d be happy to set something up for your blog so you don’t have to worry about it anymore, feel free to inquire at obvious places based on what my email address reveals.

]]>I have more to say about this post, which I think is fabulous, but have to go get breakfast for my kids.

]]>For the graphs, png is a better default than jpeg. Png does not cause any loss in the image, whereas jpeg does. This loss in jpegs is good for raster like images (e.g. photographs or maps with satellite imagery) on the web because they are smaller in size. For statistical graphics that are just filled with vector elements png is fine.

(You could export to svg for the web, but that is probably overkill. For detailed graphs I typically save the pngs as very large, and my wordpress theme automatically shrinks the images to fit the blog post, but if someone opens them in a new tab they can see the large image.)

]]>Can you post the two text files? soccerpowerindex.txt & worldcup2012.txt?

As predictors, what all finally went into this model? The Nate silver rankings for teams & 2012 world cup score differentials? Is that it? Or is there more stuff?

]]>But, why are the names in French?

]]>Imagine all methods sections were this detailed and honest. ]]>

What is the “Matt trick”?

And — this question probably comes from my naivete about sports, but it seems like modeling score differentials carries the implicit assumption that total points scored doesn’t matter. Is that reasonable? To elaborate — suppose Team A plays B and wins 1-0, and team C plays D and wins 7-6. Do those final scores tell you the same thing about the relative abilities of Teams A and C?

]]>