sim | R Documentation |
glm
object based on new data, with automatic detection of family and link.Simulate from a fitted glm
object based on new data, with automatic detection of family and link.
sim(model, newdata, binomial_n = 1)
model |
a fitted |
newdata |
data frame with values of the covariates based on which to simulate the response, similar to |
binomial_n |
int length nrow(newdata). If |
A vector of length nrow(newdata) with simulated responses.
n = 100 df = tibble::tibble(x = rnorm(n), y = rpois(n, lambda = exp(x))) mod = glm(y~x, poisson('log'), df) sims = sim(mod, newdata=df) qqplot(df$y, sims)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.