View source: R/get_simulated.R
| get_simulated | R Documentation |
Simulate responses from fitted statistical models.
get_simulated(x, ...)
## S3 method for class 'lm'
get_simulated(
x,
data = NULL,
iterations = 1,
include_data = FALSE,
seed = NULL,
...
)
## S3 method for class 'glmmTMB'
get_simulated(
x,
data = NULL,
iterations = 1,
include_data = FALSE,
seed = NULL,
centrality = NULL,
re.form = NULL,
...
)
## S3 method for class 'merMod'
get_simulated(
x,
data = NULL,
iterations = 1,
include_data = FALSE,
seed = NULL,
use.u = FALSE,
re.form = NA,
newparams = NULL,
family = NULL,
cluster.rand = stats::rnorm,
allow.new.levels = FALSE,
na.action = stats::na.pass,
...
)
## Default S3 method:
get_simulated(x, ...)
## S3 method for class 'data.frame'
get_simulated(x, data = NULL, include_data = FALSE, ...)
x |
A model. |
... |
Additional arguments passed to the underlying prediction or simulation methods. |
data |
An optional data frame in which to evaluate predictions before
simulation. This can be a data grid created with |
iterations |
Number of response vectors to simulate. |
include_data |
Logical, if |
seed |
An optional integer random seed. |
centrality |
Function, indicating how to summarize aggregated simulated
values when |
re.form |
For |
use.u |
For |
newparams |
For |
family |
For |
cluster.rand |
For |
allow.new.levels |
For |
na.action |
For |
A data frame with one column per simulation (iter_1, iter_2, ...).
The attribute seed contains information about the RNG state used.
data(mtcars)
m <- lm(mpg ~ wt + cyl, data = mtcars)
# Simulations on the original data
get_simulated(m, iterations = 2, seed = 123)
# Simulations on a data grid
dg <- get_datagrid(m, wt = c(2, 3), cyl = c(4, 6))
get_simulated(dg, m, iterations = 2, seed = 123)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.