# The [ppm] eyrie

## January 19, 2010

### Players

Filed under: powerplay manager hockey, PPM.miscellaneuous, Uncategorized — glanvalleyeaglets @ 3:21 pm

This is an article I always wanted to do – about the named bundle of attributes, qualities and statistics, about the silent knight of Powerplay Manager, about the goat, ass, horse or hypogrif that carries or brings down the hopes of the manager, the entity that gets nominated for the national team and without hesitation goes through fire and water, checks and fights, not afraid of any kind of fractures, inflammations, abdominal stretches and anginas when serving his Manager, who are you, my dear reader. Let me introduce Mr. Ice Hockey Player. Treat him well and he will thank you on the ice.

Your goal must be to train the player correctly, preferably so that he is the best possible player he could ever be at any time. I’ll leave the definition of the phrase “best player” as an exercise for the interested reader

The best service you can do to a Player is give him the right training for a certain position. The player will become your vision, so take care to have the right visions. It is perfectly all right if you want to turn a young center into a winger, if he has the quality-wise disposition for this. Scout your players, this will show you the way.

Read the Guide if you haven’t done so yet. Re-read it every now and then. The Guide was never written by the actual developers, so it is no wonder that it contains lots of bugs and omissions. Follow the Guide, but don’t trust it. Don’t trust me either, I’m much further from the developers than the authors of the Guide.

One of the most quoted and mysterious passages in the Guide is the following:

“Player with attributes 180 – 25 – 25 or 70 – 90 – 90 /where the first one is the primary main attribute and the last two are secondary main attributes/ is not as good for the given position as a player with attributes 120 – 30 – 50. Similarly a player with attributes 130 – 80 – 30 or 80 – 80 – 80 is not as good as a player with attributes 100 – 80 – 50.”

What in the world is it supposed to mean? Here are two of the most common misinterpretations of this verse:

* Guide states that 100-80-50 is the best distribution
* There is a built-in penalty for excessive secondary attributes, so 70-90-90 might be strictly worse than 70-70-70.

The Guide doesn’t state any of this. Instead, the Guide
* identifies a player with its primary and secondary attributes (three numbers) and
* states that a player P can be strictly better or worse than player Q for a given position.

Hold your horses, what does it mean “better”? My best guess is that the Guide compares players according to their contribution to the team and line strength rating (a.k.a. the pucks and the stars). In this sense one can introduce a number that measures the effectivity of a player for a certain position. I sometimes call it the “effective primary attribute” (EPA).

The guide confirms that EPA depends only on the primary and both secondary attributes. The possible dependence of this relation on the position remains obscure.

I will try to interpret what the Guide tells about the EPA, and will use some maths. If you want to skip this section, you are welcome to do so.

Let me denote the primary and secondary skills by A, B and C. We are looking for a non-negative function of three non-negative arguments with following properties:

1) Monotonicity (better attributes = better player): if $A_1>A_2, B_1>B_2, C_1>C_2$, then $EPA(A_1,B_1,C_1)>EPA(A_2,B_2,C_2)$
2) the A-skill monster punisher: as any one or two of $A, B, C$ tend to infinity and the third remains fixed, $EPA(A,B,C)$ remains bounded.

The simplest functions with the desired properties (punishing the weakest link) are involving the minimum operator:
$EPA(A,B,C)= \mathrm{min} \{A, B/\beta, C/\gamma\},$
where $\beta, \gamma>0$ are constants. Such function has a clear interpretation: the optimal ratio of skills is $1:\beta:\gamma.$

The constants can be estimated by using the examples from the Guide. The strictest inequalities are:

1) $(70-90-90) < (120-30-50) \implies \frac{1}{\beta} > \frac{7}{3}$
2) $(130-80-30) < (100-80-50) \implies \frac{1}{\gamma} < \frac{10}{3}$

3) Since the first secondary skill cannot be less worth than the second secondary skill, we have $\frac{1}{\beta}\leq \frac{1}{\gamma}.$

(1-3) together imply: $\frac{7}{3} < \frac{1}{\beta} \leq \frac{1}{\gamma} < \frac{10}{3}$,

So according to the Guide, the optimal distribution should be in the range (7-10):3:3.

At the beginning of the third season a group of Latvian managers carried out an experiment to find out the optimal primary-to-secondary skill ratio for goalkeepers. They nominated only one goalie for the first game of the league, and then collected the attributes, chemistry and experience in a table together with the rating for goaltending. The data were surprisingly consistent and clearly demonstrated that the ratio 1:0.5:0.5 = 2:1:1 gives the best results.

It also supported the old rumors about the influence of Chemistry and Experience. This law of thumb states that “100 points of chemistry give +20% to the attributes and each 100 points of experience give additional +20% to the attributes.”

So this might be the key to high rating of team strength. Have we come closer to answers to the question – what is the best training for my Mr. Player?

Not necessarily.

* The best Defender will not help his team much if he spends his life in the cooler. A good way to reduce his time on the penalty bench is – train up his technique to match the aggressiveness. Open question: should the Tec:Agg ratio be 1:1, 9:10, or perhaps even 2:1?

* The shooting attribute is independent from the primary/secondary bundle. Open question: which ratio to the primary and secondary skills is the best for the different positions?

* Passing, Technique and Aggressiveness: is there a use for higher values of these attributes than half of the primary skill?

* The “alien primary skills”: does the center need defense and if so, how much?

* Special players: perhaps it is wise to build several types of players – the offensive specialists for PP, defensive masters for PK, mix up good passers and good shooters to increase the productivity of a line? If so, then different attribute ratios should be followed for different players.

It is up to the manager.

Now back to the quality of a player. Yes, I mean it, THE quality.

Suppose you want to train your Player in $k$ skills with the ratio $R_1:R_2: \dots :R_k$. Let the corresponding qualities of the attributes be $Q_1, Q_2, \dots, Q_k$ and the daily progress of the attributes at the current stage of development is correspondingly $P_1,P_2, \dots, P_k.$

Then the effective quality of the player for that ratio is given by the weighted harmonic mean

$\frac{R_1 + R_2 + \dots + R_k}{\frac{R_1}{Q_1} + \frac{R_2}{Q_2} + \dots + \frac{R_k}{Q_k}},$

and the average time in days for the player to increase his overall rating by one point with the current facilities and staff is the weighted mean

$\frac{\frac{R_1}{P_1} + \frac{R_2}{P_2} + \dots + \frac{R_k}{P_k}}{R_1 + R_2 + \dots + R_k}.$

Along with the age and career longevity, the effective quality is the only parameter that determines the future of the player and should be the only number to look at when evaluating a future prospect!

(A side note. There is a weird misconception traveling around, which is called the average of important qualities. This has no “physical” interpretation and anybody using it should be sued for crimes against maths. Qualities 60-60-60 are MUCH better than 85-85-10!)

## November 6, 2009

Filed under: powerplay manager hockey, PPM.statistics — glanvalleyeaglets @ 3:43 pm

Howdy everyone,

I haven’t posted for a while, you should appreciate the reasons – the daily job, the autumn blues, Dinamo Riga underperforming in the second KHL season and, most importantly, the lack of fresh ideas and results to present.

There are many discussions out there about the use and futility of counter-tactics, inconsistency of the game engines, about theories how to build player attributes to suit the demands of certain tactics. I don’t “know” the answers, all I can provide is evidence based on evaluation of over 200 000 games played in the second season of powerplay manager hockey. My opinions and interpretations may be wrong, cruical aspects of the game might be missing in my analysis and you can always believe your intutition outperforms any analysis, or you might just not believe the existence of a “game matrix” when facing the evident and omnipresent random factor making you win a game with 10:0 and losing the next one by 0:10 all settings being equal. Nevertheless I think I have a point to make and this blog is the perfect vehicle for doing so.

Let me keep this stupid and simple – apart from the aesthetics, ice hockey is all about scoring goals and preventing goals. In order to score goals, you have to shoot on the net and shoot with a certain quality. Everybody knows, what the average number of shots per game means. The quality of the shots is measured by the shot efficiency, which I’ll define as the inverse of “shots per goal” (the number of shots needed to score 1 goal). 5 goals with 40 shots gives an efficiency of 5/40 = .125 = 12.5%.

Take the number of shots per game and multiply it by the shot efficiency and you’ll recover the number of goals scored. Learn how to control the two factors and you’ll understand the game. What are the important factors and variables? How big or small is the random factor and what does it depend on?

The best variables available for analysing team strength are the “stars” shown in the profile page of a team. Let us suppose our team has a goaltending at 29 (notation: G+=29), defence at 26 (D+=26), offence at 25 (O+=25) and shooting at 23 (S+=23), and our opponent has goalkeeping G-=28, defence D-=19, offence O-=24 and shooting S-=17. In order to compare our offence to opponent’s defence, we introduce the offence-defence quotient O+/D-, which in this case would be 25/19=1.32. A good measure of comparison between our shooting quality and opponent’s goaltending quality is the shooting-goaltending quotient S+/G- given by 23/28=0.82. It turns out that these along with the corresponding quotients from opponent’s point of view (O-/D+ and S-/G+) are very important indicators for the chances of the teams.

Let us look at the graph in Figure 1. It shows the average number of shots per game versus the offence-defence quotient O+/D-. The blue line is computed from the data of all teams, the green line – from teams playing the right countertactics and the red line – from teams playing against the countertactics.

Fig. 1. Average shots per game versus the O+/D- quotient for all teams (blue), teams playing countertactics (green) and teams playing against countertactics (red)

Evidently this is a “master curve” of the game. We see how the counter-tactics work (improving the shot differential), we see that teams with a weak offence perform few shots against a team with a strong defence, and we see that there is a saturation effect – the average number of shots per game stays below 35.

The lines show an almost cosmic order, but there is the back-side – the mighty random. To estimate its influence, let me introduce the variance $\sigma=\sqrt{N^{-1}\sum_{i=1}^N (x_i-\bar{x})^2}$. It is a moment of probability distribution function, but very roughly saying, in most games the deviation will be considerably smaller than $\sigma$.

O+/D- Shots p G Variance $\sigma$
30-40 16.5 3.28
50-60 20.8 7.17
80-90 27.4 12.8
120-130 31.0 15.8
150-160 32.3 17.1
170-180 32.9 17.4
200+ 33.2 17.5

What this shows is that a weak offensive line will not likely create many shots against a much stronger defence (low variance at low O+/D- levels), but the stronger team may have a good or bad shooting day (By the way, the rule of three sigmas doesn’t apply here as the number of shots is not a normal random variable.) (Should provide a graph to illustrate this in the future.)

So we have learned that the number of shots on the net depends on the offence-defence quotient. If one keeps the O+/D- quotient constant and increases the strength of the own defence, the number of shots slightly increases. This probably has to do with the fact that the better defence creates more offensive situations and the defenders themselves are more likely to take a shot or two. We also have seen the huge variance, so don’t come to me and complain that your team managed only 20 shots whereas it was suppose to generate at least 30. It will all even out in the long run

Do different tactics have different number of shots versus O+/D- quotient curves? If this was true, then there might be a tactic suited for stopping better offensive lines, or a tactic that generates more shots on average, but is it so? Is there a secret key to success hidden in the sea of data?

Alas, see Figure 2.

Figure 2. Shots per game vs O+/D- for various tactics (excluding counter-tactics situations). (Sorry, there are three 'extra' zeroes on the y axis, cross them out when reading the graph)

This study suggests that the answer is negative. Within the margin of errors the lines coincide. (It has to be remarked that towards the extreme ends of the graph the error margin increases considerably due to significanltly smaller amount of available data.) Once more, for underlining and pinning on the walls: no tactics is better suited to a certain team, every one will perform the same way in the long run. Or, more modestly, I could not confirm the opposite to be true although the Universe knows I tried

Let us now move to the second parameter – shot efficiency alias scoring percentage. Figure 3 below shows the mastercurve “shot efficiency vs the shooting-goaltending quotient S+/G-” for all teams (blue line), teams playing counter-tactics (red line) and teams playing against countertactics (red line).

Fig. 3. Shot efficiency vs S+/G- for all teams (blue), teams playing countertactics (green) and teams playing against countertactics (red)

This chart is worth a thousand words. Not only does it confirm that the relation between shooting skill and opponent’s goaltending skill is the most important factor determining the scoring percentage, but it also shows an almost linear dependence of shot percentage on S+/G-. One more thing we can read off the curves is that counter-tactics do not influence the shot percentage.

To estimate the magnitude of random in scoring efficiency (including the famous goalie’s good/bad night effect), let us look at the variances.

S+/G- Shot effic. % Variance $\sigma$
30-40 5.9 5.84
50-60 10.2 6.09
80-90 13.7 7.03
120-130 18.4 7.91
150-160 21.9 8.92
170-180 24.2 9.42
200+ 29.1 10.6

As we see, the variance grows slower than the scoring efficiency, hence the bigger your S+/G- advantage, the less likely gets the chance for the great upset. It is difficult enough for an average goalie to stop a much stronger offence. However, and I want to emphesize this, the stronger the goalie, the larger the relative fluctuations in his game!

However, S+/G- is not the only one parameter that influences the scoring percentage. You don’t have to train the shooting skill exclusively to improve your shot efficiency. This curve happens to shift considerably with changing offence-defence O+/D- quotient.

Fig. 4. Shot efficiency versus shooting-goaltending ratio (S+/G-) for various offence-defence ratios (O+/D-)

This is illustrated in Figure 4.

Again, no words are required to explain the results – except that I’ve found out that the shot efficiency is more sensitive with respect to shooting-goaltending ratio S+/G- than it is to offence-defence ratio O+/D-. The bottom line is – you gotta train both offence and shooting for the best performance

The final picture for today studies the curves for different tactics played.

Fig. 5. Goaltending efficiency versus goaltending-shooting ratio (G+/S-) for the different tactics.

Figure 5 shows the opposite quantities to Figure 4, namely, goalkeeping efficiency versus goalkeeping-shooting ratio G+/S-. However, it is basically the same thing as goalkeeping efficiency is just 100% minus shot efficiency and G+/S- is just reversed S-/G+, so basically it is the same thing (but the tactics are chosen by the defensive team). The thing to take home from here is the fact that the curves coincide within the margin of error. No optimal tactics for a great goalie or for a team with great shooting, it is all the same

I’d like to conclude that the following passage in the Guide is henceforth a busted myth:

“Every team has a different composition of player attributes and therefore a different style of play is suitable for each team. Therefore you need to find the right style of play that suits your team. A different style of play is suitable for a team with a weak goalie and brilliant forwards and vice versa for a team with a goalie star. “

Hopefully they’ll implement it some day

Right, folks, that’s it for today. Good luck for the upcoming playoffs everyone! (And thanks for your interest, I never expected to get tens of thousands of hits in the first half-year of this blog!)

## September 17, 2009

### The key factor

Filed under: powerplay manager hockey, PPM.statistics — glanvalleyeaglets @ 12:08 pm

Let us put the tactics and game importance aside for a while and ask: what is the most important factor that decides the outcome of a game? Today we’ll talk team strength. Whether we like it or not, as much as we sometimes wish an underdog to win, the stronger teams usually do better and prevail in the long run. The ice-hockey simulation in powerplay manager is no exception.

One could write monographs about what makes a great team great. Luckily, it is easier in PPM. Each team has a profile page where you can find the estimate of team strength based on the lineup used in the previous official game. These are the ominous “stars”, the four integers indicating the levels of Goaltending, Defence, Offence and Shooting. There is a fifth one that shows the total team strength, but it is just the arithmetic mean of the former four. So let us look at the four numbers as a measure of team strength.

There is a long ongoing discussion about “what do you mean by saying that your team was much stronger”. With the scale going up to 200, it doesn’t sound like a big difference between 15 and 20, it is a basic beginners level. In the same time the difference between 15 and 20 is 25% down or 33% up, and this is no peanuts anymore. We can see whether our team is better or worse in terms of the stars, but how does it affect the chances of winning the bloody game? Be the first to know and keep reading this great feature article in the [ppm] eyrie. We bring to you the whole story as it unfolds! Blah, blah, blah!

A typical ppm ice hockey team in the middle of second season might have Goaltending GT rated at 16, Defence DF=16, Offence OF=15 and Shooting SH=14. My Eaglets have (23, 23, 22, 19); Radowan’s Enterprise is currently rated at (30,25,28,17), the best Latvian team Pardaugavas Lauvas impresses with (31,29,23,22).

We’ll do the simplest thing out there and just sum the four indicators (GT + DF + OF + SH) of both teams and compute the difference, and see how the teams perform against each other in dependence on this difference.

The results can be summarized in a table. The first column shows the difference, then the percentage of wins (in regular time), overtimes and losses of the stronger team and finally the number of games used to calculate the “odds”.

Diff W % OT % L % N
1-2 47.3 15.0 37.5 7588
3-4 51.8 14.5 33.5 7176
5-6 56.8 14.2 28.9 6153
7-8 62.0 13.4 24.4 5363
9-10 68.0 11.9 20.0 4609
11-12 72.3 11.0 16.6 3906
13-14 77.5 10.1 12.3 3412
15-16 81.7 8.0 10.2 2865
17-18 84.4 8.0 7.4 2298
19-20 88.6 6.9 4.4 1859
21-22 90.2 5.7 3.9 1512
23-24 92.9 4.2 2.7 1199
25-26 94.6 2.4 2.9 892
27-28 95.8 1.6 2.5 718
29-30 96.8 2.2 0.9 540
31+ 99.8 0.1 0.0 5199

The trend is visible, isn’t it? The advantage of some 6-7 team strength points weighs approximately as much as the correct counter-tactics. I hope to get to the corresponding effect of game importance in a future article.

How does this info add to the understanding of the game? Let’s speculate and assume that I am to throw my 87 points against Liepinsh’s 105. Under normal conditions I’m at -18 meaning that my chances of winning the game are somewhere around 7.4%. Can I influence my odds? Sure, I can choose the game importance and tactics. With the right counter-tactics, the odds would shift in my favor, perhaps the shift is worth as much as 6 points making the gap approx. -12 points wide. Why, according to this arithmetics, the chance of winning just sky-rocketed to 16%! If I am lucky and my team actually plays that tactics well and if I use higher game importance, my chances might improve even further. (Of course, the life is never as simple as that)

Just want to make a final remark. Perhaps I am looking at the wrong thing. The quotient of team strength indicators might be more important than the difference. Say, is the difference between 110 and 100 points “ten points” or “ten percent” wide? Is it as good as 20 vs 10 (difference) or as good as 11 vs 10 (quotient)? Or is it something in between? I don’t know the answer, but some day…

## September 16, 2009

### Tactics and home ice advantage

Filed under: powerplay manager hockey, PPM.statistics — glanvalleyeaglets @ 10:41 am

In the first season I was first and foremost interested in finding out the basic relations of the tactics and countertactics, so I only recorded the tactics and the score of the match. As the spread in the teams’ strength increases, the grand total tables make less sense, so I decided to create a more serious databasis for the second season. So for each game under consideration I store the tactics, game importance, team strength estimates (the “stars” for goaltending, defensive, offensive and shooting), shots, penalties and the final score. I find this is a much better tool for studying how this game works!

I hope this is the first post in a series of articles. Today I want to address a simple question: is there a home ice advantage in regular season games and what does it have to do with the tactics?

Let us start with the grand total table using all the games I’ve gone through. All are from the regular tournament of the second season, match days 1-16 (games with participation of inactive teams were excluded, but it was done with care in order not to lose games like this one ). In total 48,770 games of powerplay manager ice-hockey. For those interested: the most popular pairing of tactics is Normal vs Normal with 5083 games; the most exotic is Defensive (home team) vs Breaking up (road team) with 416 games. Here the rows represent tactics of the home team, the columns – the tactics of the road team. The numbers are percentage of home wins, games with overtime and away wins.

Normal Offensive Defensive Counteratt Breaking Forecheck
Normal 48.1-11.4-40.3 42.3-11.8-45.8 63.1-10.4-26.4 47.1-13.5-39.2 37.8-10.1-52.0 45.8-10.8-43.2
Offensive 54.4-11.5-34.0 48.9-12.1-38.8 37.5-13.0-49.3 48.0-13.3-38.5 52.8-10.3-36.8 62.7-12.0-25.1
Defensive 37.8-12.5-49.6 59.6-12.4-27.9 48.0-12.3-39.6 51.0-11.6-37.2 47.8-11.7-40.3 43.6-13.2-43.0
Counteratt 49.3-12.0-38.6 48.1-12.6-39.2 47.6-11.3-40.9 48.0-13.2-38.6 58.1-11.8-30.0 37.0-9.0-53.8
Breaking 61.9-8.9-29.0 46.7-12.5-40.6 42.3-12.6-44.9 34.5-12.5-52.8 45.0-11.8-43.1 45.3-9.8-44.8
Forecheck 51.4-11.6-36.8 35.0-12.1-52.7 44.5-11.2-44.2 61.1-12.8-26.0 51.1-12.2-36.6 47.8-13.0-39.1

The home teams win approximately 48% of the games and lose some 40%, so there is a measurable home ice advantage in this game.

The average team in this study has goaltending rated at 16.1 stars, defense 16.0, offense 15.4 and shooting 14.1. No wonder that, for instance, offensive tactics overall does slightly better than defensive tactics (it is worth paying more attention to the weakest part of the team). For offensive teams, the opposite is the case!

On the top of this we clearly see the famous ring of countertactics in action!

Of course, games of equally rated teams are more interesting to us. Taking the sum of goaltending, defense, offense and shooting “stars” as a measure of team strength and filtering out all games where the difference exceeds 5, I was left with mere 18,508 games. Here is the resulting table:

Normal Offensive Defensive Counteratt Breaking Forecheck
Normal 49.5-14.5-35.9 46.8-15.7-37.4 65.9-12.0-22.0 50.4-15.4-34.1 38.7-12.0-49.1 47.5-12.9-39.5
Offensive 48.8-15.2-35.8 46.7-16.2-37.0 36.1-17.6-46.2 48.6-16.2-35.1 51.9-13.7-34.2 60.6-15.1-24.1
Defensive 34.5-16.5-48.8 63.3-14.3-22.2 45.9-14.2-39.8 45.8-16.2-37.9 49.4-11.7-38.8 43.4-17.3-39.1
Counteratt 51.4-13.7-34.8 52.0-15.2-32.7 48.2-14.5-37.1 47.7-16.5-35.7 60.0-12.8-27.2 36.3-12.1-51.5
Breaking 62.0-11.5-26.4 50.1-13.5-36.2 45.9-13.1-40.9 31.5-16.3-52.1 45.6-12.8-41.5 49.5-11.6-38.8
Forecheck 52.0-15.0-32.8 37.4-16.7-45.7 43.4-15.6-40.9 63.2-15.8-20.8 49.3-13.8-36.7 50.7-16.2-32.9

We see that in this case the draw margin is way bigger and that it is harder for the visiting team to win the game; home wins ~ 48%, away wins ~37% of the “equal” games.

I must stress that these tables are not there to suggest that “some tactics are better than others”. It is true that the tactics should suit your team and tactics that one team uses with great success may miserably fail for another team with different skill distribution.

So we have seen the importance of home ice in games of the regular season. It is claimed that there is no such thing in cup games or friendlies. In the next article I plan to go deeper into the overall team strength – performance relation. It will turn out that the team strength may be more important than the tactics