Goal Grids¶
The GoalGrid is the foundation data structure in pyrf. All distributions, payoffs,
and pricing calculations operate on this grid.
What Is a Goal Grid?¶
A goal grid represents all possible (home, away) scoreline combinations from 0-0 up to n-n. It produces two DataFrames — one for home goals and one for away goals — where each cell [i, j] gives the respective team's goals for that scoreline.
Usage¶
from pyrf.core import GoalGrid
# Default 11×11 grid (0-10 goals each)
grid = GoalGrid.default()
# Custom size
grid = GoalGrid(n=15)
How Models Use It¶
When you call model.pmf(grid), the model computes the probability of each scoreline
on the grid:
from pyrf.models import DixonColes
model = DixonColes(lambda_home=1.8, lambda_away=1.2, rho=-0.10)
pmf = model.pmf(grid)
# pmf is a DataFrame where pmf.loc[away_goals, home_goals] = probability
API Reference¶
See the full API Reference.