Title: | Assessment and Evaluation of Formations in United |
---|---|
Description: | United is a software tool which can be downloaded at the following website <http://www.schroepl.net/pbm/software/united/>. In general, it is a virtual manager game for football teams. This package contains helpful functions for determining an optimal formation for a virtual match in United. E.g. knowing that the opponent has a strong defensive it is advisable to beat him in the midfield. Furthermore, this package contains functions for computing the optimal usage of hardness in a game. |
Authors: | David Schindler [aut, cre] |
Maintainer: | David Schindler <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.4 |
Built: | 2024-12-22 06:30:09 UTC |
Source: | CRAN |
Assessment and Evaluation of United Formations
Package: | unitedR |
Type: | Package |
Version: | 0.4 |
Date: | 2020-06-27 |
License: | GPL (>= 2) |
LazyLoad: | yes |
This package provides functionality for the assessment of lineups and formations in United. The rules for United in detail can be found under: United-rules.
David Schindler [email protected]
omido, United Software, United-Forum
Represents a valid united formation.
formation( GK, SW, DF, MF, ST, hardness = c(0, 0, 0, 0, 0), homeAdv = c(0, 0, 0, 0, 0) )
formation( GK, SW, DF, MF, ST, hardness = c(0, 0, 0, 0, 0), homeAdv = c(0, 0, 0, 0, 0) )
GK |
|
SW |
|
DF |
|
MF |
|
ST |
|
hardness |
|
homeAdv |
|
S4
object of the class formation
.
Generates a numeric
vector which specifies the used united lineup
getLineup(obj) ## S4 method for signature 'formation' getLineup(obj)
getLineup(obj) ## S4 method for signature 'formation' getLineup(obj)
obj |
object of the class |
vector
of the used lineup
Computes the final overtime outcome.
overtime(chancesHome, chancesAway, probGoalHome, probGoalAway)
overtime(chancesHome, chancesAway, probGoalHome, probGoalAway)
chancesHome |
goalscoring chances of home team |
chancesAway |
goalscoring chances of away team |
probGoalHome |
probability of scoring a goal for home team |
probGoalAway |
probability of scoring a goal for away team |
list
with probabilities of final outcome.
unitedR
packageThis list of parameters yields a comprehensive overview of the parameters
used in the unitedR
package.
away |
away team (an object of the |
chancesAway |
goalscoring chances of away team |
chancesHome |
goalscoring chances of home team |
DF |
|
formation |
object of the |
GK |
|
hardness |
|
hardnessMatrix |
|
home |
home team (an object of the |
homeAdv |
|
L |
|
MF |
|
overtime |
|
penaltyGoalProb |
probability of a goal by a singular penalty |
penaltyProb |
occurrence probability of a penalty |
posPenalties |
number of possible penalties in a game |
preventGoalGK |
factor multiplicied with the strength of the GK for computing the probability of preventing a goal by the goalkeeper |
preventGoalSW |
factor multiplicied with the strength of the SW for computing the probability of preventing a goal by the sweeper |
probGoalAway |
probability of scoring a goal for away team |
probGoalHome |
probability of scoring a goal for home team |
probPenaltySaveAway |
probability of saving a penalty for away team |
probPenaltySaveHome |
probability of saving a penalty for home team |
r |
number of replications for the simulation of hardness and penalties, can
be |
ST |
|
SW |
|
x |
a variable |
Computes the distribution function of possible goals by penalties.
penaltyGoalsProb(posPenalties, penaltyGoalProb, penaltyProb = 0.1)
penaltyGoalsProb(posPenalties, penaltyGoalProb, penaltyProb = 0.1)
posPenalties |
number of possible penalties in a game |
penaltyGoalProb |
probability of a goal by a singular penalty |
penaltyProb |
occurrence probability of a penalty |
A data.frame
with two columns: the possible goals and the probability
for achieving this number of goals.
Computes outcome of a penalty shootout.
penaltyShootout(probPenaltySaveHome, probPenaltySaveAway, initial = 5)
penaltyShootout(probPenaltySaveHome, probPenaltySaveAway, initial = 5)
probPenaltySaveHome |
probability of saving a penalty for home team |
probPenaltySaveAway |
probability of saving a penalty for away team |
initial |
number of initial penalties (default 5) |
list
with probabilities of final outcome (winProbabilityHome
,
winProbabilityAway
).
Simulates red card(s) in the united and returns the adjusted lineup.
simRedCard(obj, lineup, Hard) ## S4 method for signature 'formation,numeric,matrix' simRedCard(obj, lineup, Hard)
simRedCard(obj, lineup, Hard) ## S4 method for signature 'formation,numeric,matrix' simRedCard(obj, lineup, Hard)
obj |
object of the class |
lineup |
lineup of the corresponding object |
Hard |
matrix of hardness to be used |
list
with two elements:
vector
adjusted lineup for the red card(s)
numeric
number of red cards
Summary of assessments of a randomization procedure
summary(object, ...) ## S4 method for signature 'unitedSim' summary(object) ## S4 method for signature 'unitedSimResults' summary(object)
summary(object, ...) ## S4 method for signature 'unitedSim' summary(object) ## S4 method for signature 'unitedSimResults' summary(object)
object |
object of class |
... |
additional arguments affecting the summary that will be produced. |
data.frame
with a summary of the assessed object.
Simulates a formation against another formations (several formations of away are possible).
unitedSim( home, ..., r, penaltyProb = 0.1, preventGoalGK = 1/14, preventGoalSW = 1/15, hardnessMatrix, L, overtime = FALSE )
unitedSim( home, ..., r, penaltyProb = 0.1, preventGoalGK = 1/14, preventGoalSW = 1/15, hardnessMatrix, L, overtime = FALSE )
home |
home team (an object of the |
... |
several objects of the class |
r |
number of replications for the simulation of hardness and penalties, can
be |
penaltyProb |
occurrence probability of a penalty |
preventGoalGK |
factor multiplicied with the strength of the GK for computing the probability of preventing a goal by the goalkeeper |
preventGoalSW |
factor multiplicied with the strength of the SW for computing the probability of preventing a goal by the sweeper |
hardnessMatrix |
|
L |
|
overtime |
|
Creates an object of the unitedSim
class.
home <- formation(10, NA, c(7,5,3), c(8,8), c(10,10,8)) away <- formation(5, 8, c(8,8), c(10,10), c(10,10,10), hardness = c(0,0,0,0,1)) set.seed(123) unitedSim(home, away) # can also be simualated unitedSim(home, away, r = 100) # several away lineups unitedSim(home, away, away) # several away lineups simulated unitedSim(home, away, away, r = 100) # used hardness matrix (default) # shows the probability of receiving a specifed number of yellow cards # dependent on the used points of hardness dimNams <- list(paste(0:7, "cards"), paste(0:10, "hardness points")) (hardnessMatrix <- matrix(c(90,10,0,0,0,0,0,0, 70,30,0,0,0,0,0,0,50,40,10, 0,0,0,0,0,30,50,20,0,0,0,0,0,20,40,30,10,0,0, 0,0,10,30,40,20,0,0,0,0,0,20,40,30,10,0,0,0,0, 10,30,40,20,0,0,0,0,0,20,40,30,10,0,0,0,0,10,20, 40,20,10,0,0,0,0,10,40,20,20,10), nrow = 8, dimnames = dimNams))
home <- formation(10, NA, c(7,5,3), c(8,8), c(10,10,8)) away <- formation(5, 8, c(8,8), c(10,10), c(10,10,10), hardness = c(0,0,0,0,1)) set.seed(123) unitedSim(home, away) # can also be simualated unitedSim(home, away, r = 100) # several away lineups unitedSim(home, away, away) # several away lineups simulated unitedSim(home, away, away, r = 100) # used hardness matrix (default) # shows the probability of receiving a specifed number of yellow cards # dependent on the used points of hardness dimNams <- list(paste(0:7, "cards"), paste(0:10, "hardness points")) (hardnessMatrix <- matrix(c(90,10,0,0,0,0,0,0, 70,30,0,0,0,0,0,0,50,40,10, 0,0,0,0,0,30,50,20,0,0,0,0,0,20,40,30,10,0,0, 0,0,10,30,40,20,0,0,0,0,0,20,40,30,10,0,0,0,0, 10,30,40,20,0,0,0,0,0,20,40,30,10,0,0,0,0,10,20, 40,20,10,0,0,0,0,10,40,20,20,10), nrow = 8, dimnames = dimNams))
Simulates a formation against another formation.
unitedSimOne( home, away, r, penaltyProb = 0.1, preventGoalGK = 1/14, preventGoalSW = 1/15, hardnessMatrix, overtime = FALSE )
unitedSimOne( home, away, r, penaltyProb = 0.1, preventGoalGK = 1/14, preventGoalSW = 1/15, hardnessMatrix, overtime = FALSE )
home |
home team (an object of the |
away |
away team (an object of the |
r |
number of replications for the simulation of hardness and penalties, can
be |
penaltyProb |
occurrence probability of a penalty |
preventGoalGK |
factor multiplicied with the strength of the GK for computing the probability of preventing a goal by the goalkeeper |
preventGoalSW |
factor multiplicied with the strength of the SW for computing the probability of preventing a goal by the sweeper |
hardnessMatrix |
|
overtime |
|
Creates an object of the unitedSim
class.
home <- formation(10, NA, c(7,5,3), c(8,8), c(10,10,8)) away <- formation(5, 8, c(8,8), c(10,10), c(10,10,10), hardness = c(0,0,0,0,1)) set.seed(123) unitedSimOne(home, away) # results with overtime # Note: Only key statistics are adjusted for overtime unitedSimOne(home, away, overtime = TRUE) # simulating the game unitedSimOne(home, away, r = 100)
home <- formation(10, NA, c(7,5,3), c(8,8), c(10,10,8)) away <- formation(5, 8, c(8,8), c(10,10), c(10,10,10), hardness = c(0,0,0,0,1)) set.seed(123) unitedSimOne(home, away) # results with overtime # Note: Only key statistics are adjusted for overtime unitedSimOne(home, away, overtime = TRUE) # simulating the game unitedSimOne(home, away, r = 100)