Learn R Programming

unitedR (version 0.2)

unitedSim: Simulating a formation

Description

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

Usage

unitedSim(home, ..., r, preventGoalGK = 1/14, preventGoalSW = 1/15)

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)
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

Value

Creates an object of the unitedSim class.

Examples

Run this code
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)

Run the code above in your browser using DataLab