## Poisson GLM for FIFA 2018 goals
data("FIFA2018", package = "distributions3")
m <- glm(goals ~ difference, data = FIFA2018, family = poisson)
## simulate new goals via glm method
set.seed(0)
g_glm <- simulate(m, n = 3)
## alternatively use the new default method
set.seed(0)
g_default <- simulate.default(m, n = 3)
## same results
all.equal(g_glm, g_default, check.attributes = FALSE)
Run the code above in your browser using DataLab