unitedSim: Simulating a formation

Description Usage Arguments Value See Also Examples

View source: R/unitedSim.R

Description

Simulates a formation against another formations (several formations of away are possible).

Usage

1
2
unitedSim(home, ..., r, penaltyProb = 0.1, preventGoalGK = 1/14,
  preventGoalSW = 1/15, hardnessMatrix)

Arguments

home

home team (an object of the S4class formation)

...

several objects of the class formation

r

number of replications for the simulation of hardness and penalties, can be missing (exact results will be computed)

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

matrix matrix with eleven columns which contain the probability for yellow cards dependent on the used hardness

Value

Creates an object of the unitedSim class.

See Also

unitedSimOne

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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))

unitedR documentation built on Jan. 5, 2018, 5:07 p.m.