Getting at the danger in "Dangerous Areas"

How often do you hear that phrase coming from a color commentator? "They've given up a free-kick in a dangerous area!" Whenever any freekick is within a few yards of the 18-yard box, it's considered to be a massive scoring opportunity for the fouled team. And superficially, that's a completely reasonable assumption. First, a player can have a free shot on goal, no interference, at their leisure. Granted, there is a wall in the way and the keeper is prepared, but that doesn't stop some excellent freekick takers. See Neymar's sublime freekick during the jaw-dropping midweek Champion's League game against PSG.

Second, even if the shot is blocked or parried (or the player opts to cross instead), they're getting the ball in an area very close to goal with lots of their own team (as well as the opponent) packed in. Ricochets are relatively likely. Conversely, the opposing team is entirely prepared for whatever you produce (assuming the freekick is not taken quickly). Given all of this, does the location of a foul really matter?

How dangerous are they?

I gathered every foul from the past 4 seasons in the MLS (over 35,000) to try and find out. First, a look at the stunning graph of every foul given. The team committing the foul is attacking from left to right.

A few things jump out immediately, and a few more follow from close inspection.

The layout of the field is strikingly evident. There is a clear aversion to placing the ball exactly on a line, whether the halfway, center circle, or 18-yard box. The 18-yard box in the negative space is expected on the defensive side, but its counterpart on the attacking side is surprisingly discernible given penalties are not an option. It's possible that, similar to NFL referees, soccer referees have peculiarities with ball placement, opting to avoid putting the ball exactly on a line. Alternatively, the players themselves (who play no small role in ball placement) avoid placing the ball on the line as well. If anyone has any insight as to why this is the case, please let me know.

There is a sharp drop in fouls given in the defensive penalty box. I imagine this is due to both defenders' hyper-awareness of their location when attempting dangerous tackles, but also referees' desires to be absolutely correct when giving a foul in the penalty box.

There is a sharp hotspot of fouls dead center in the attacking 18-yard box. These likely are from corner kicks and freekicks, where aggressive strikers are willing to risk fouling in exchange for an excellent shot or header on goal.

There is a clear, non-uniform, horizontal distribution oriented between the 18-yard boxes, where fewer fouls are committed in the pockets of space around the corner flags and where crosses are played in. This may be due to both the frequency of time spent in the center of the pitch relative to the corners, but also due to the inherent danger of players free in the middle or on the wings looking to cut in relative to those who are deep in a corner.

There is also a non-uniform vertical distribution with more fouls committed along the touchline. My guess is that this comes from fouls committed when trying to beat opponents (or stop opponents) in the regular 1v1s that occur between wingers and fullbacks.

Goals scored after fouls

Despite the beauty of the chart, this doesn't quite answer our original question. I took the same chart and color-coded each foul based on whether or not a goal was scored within 2 minutes of the fouls occurrence. Red dots are goals scored by the team being fouled (the large concentration of red dots in the defending box are penalties), blue dots are goals scored by the team who fouled their opponent and managed to score quickly afterward anyway, and black dots mark fouls for which no goal was scored within close proximity to the foul. An interesting consequence to this approach is that we can see whether fouls committed ever increase a team's chance of scoring by pinning their opponent deep in their own half.

Lets look at the chart with just goals scored by the infringing team first (click on the blue rectangle in the legend). They happen infrequently, evenly distributed across the pitch with no discernible pattern (besides their own 18-yard box). Committing a foul does you no favors when trying to score a goal. But beyond penalties, does it hurt you? Looking at the graph, there is a *slight* pattern where more goals are scored when fouls are committed closer to your own box. I ran a linear regression just against the X coordinate (though we'll see the data is not quite linear), and got a statistically significant effect. For every 1% closer to the opponent's goal you move horizontally, the odds of you scoring within 2 minutes go up by a tenth of a percent (0.1%). Granted, this is small, but the odds aren't that good to begin with. Independent of location, the odds of scoring within two minutes of a foul committed against your team (non-penalties) is 5.5%. By bucketing the x-coordinates into 10 vertical strips, you get the following probabilities.

All is fair in love and soccer

What does this tell us? One: strikers don't need to worry about their fouls hurting their defense, only their own team's offense. They are not going to get scored on because of a foul committed. Two: dangerous areas exist, yes. But... they're not as dangerous as people give them credit for. Going from the halfway line to within about the 18-yard box perimeter increases your chance of scoring within 2 minutes by about 3 percentage points. In other words, every one hundred fouls, you'll score three more goals if the foul is close to the 18-yard box than if the foul is committed around the halfway line. Defenders should be more willing to commit fouls around the 18-30 yard area if it denies an excellent chance to their opponent to score or get inside the 18-yard box. Of course, no defender is doing math in their head at that moment, but their rough calibration on when to foul should probably be more aggressive than it is just outside the box. On the other hand, the next time your team gets fouled at 26 yards out and your best player is looking down the sight of a barrel at the goal, don't sit too far forward on the edge of your seat...Unless, of course, that player is really good.

The odds only make rare goals due to fouls all the more special.