Skip to contents

This function takes the relevant parameters from the model and assigns them to the approapriate teams in each remaining game of the season.

Usage

run_simulations(
  results_thisSeason,
  number_seasons = 0L,
  lookback_rounds = 19L,
  number_simulations = 25000L,
  value_seed = 120519L
)

Arguments

results_thisSeason

These are the results generated by running get_openData on the current season, such as at 'https://raw.githubusercontent.com/openfootball/football.json/refs/heads/master/2024-25/en.1.json'. The data should have the following columns and names:

number_match

The id values of the matches in the dataset as a character, typically from "001"

number_match_integer

the integer equivalent of the characters in number_match

matchday

The date of the match in yyyy-mm-dd format

homeTeam

The shortName of the home team, consistent with the data in the teams table

awayTeam

The shortName of the away team, consistent with the data in the teams table

FTHG

The integer number of goals scored in the whole match by the home team

FTAG

The integer number of goals scored in the whole match by the away team

FTR

The result of the match, as a factor of three levels ... where 'H', 'D' and 'A' represent a home win, a draw and an away win, respectively

played

A logical to show if the game has yet been played

year_end

The four figure integer value of the year in which the season ends

number_seasons

This is the integer required for the number of previous seasons to include. It defaults to zero.

lookback_rounds

This is the integer number of rounds of fixtures to use in a model (so 38L would represent a whole season). Defaults to half a season (that is, 19L).

number_simulations

This is the integer number of simulations to use for each game in the remaining season. Defaults to 25000L.

value_seed

This is the integer seed to use for the random numbers in the simulation. Defaults to 120519L (which, IMHO, was a great footballing day).

Examples

if (FALSE) { # \dontrun{
run_simulations(
  results_thisSeason = example_thisSeason,
  number_seasons = 1L,
  lookback_rounds = 78L,
  number_simulations = 25000L,
  value_seed = 120519L
  )
  } # }