Description Usage Arguments Details Examples
View source: R/simulate_design.R
Runs many simulations of a design and returns a simulations data.frame.
1 2 3 | simulate_design(..., sims = 500)
simulate_designs(..., sims = 500)
|
... |
A design created using the + operator, or a set of designs. You can also provide a single list of designs, for example one created by |
sims |
The number of simulations, defaulting to 500. If sims is a vector of the form c(10, 1, 2, 1) then different steps of a design will be simulated different numbers of times. |
Different steps of a design may each be simulated different a number of times, as specified by sims. In this case simulations are grouped into "fans". The nested structure of simulations is recorded in the dataset using a set of variables named "step_x_draw." For example if sims = c(2,1,1,3) is passed to simulate_design, then there will be two distinct draws of step 1, indicated in variable "step_1_draw" (with values 1 and 2) and there will be three draws for step 4 within each of the step 1 draws, recorded in "step_4_draw" (with values 1 to 6).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | my_population <- declare_population(N = 500, noise = rnorm(N))
my_potential_outcomes <- declare_potential_outcomes(
Y_Z_0 = noise, Y_Z_1 = noise +
rnorm(N, mean = 2, sd = 2))
my_assignment <- declare_assignment()
my_estimand <- declare_estimand(ATE = mean(Y_Z_1 - Y_Z_0))
my_estimator <- declare_estimator(Y ~ Z, estimand = my_estimand)
my_reveal <- declare_reveal()
design <- my_population +
my_potential_outcomes +
my_estimand +
my_assignment +
my_reveal +
my_estimator
## Not run:
simulations <- simulate_design(designs, sims = 2)
diagnosis <- diagnose_design(simulations_df = simulations)
## End(Not run)
## Not run:
# A fixed population with simulations over assignment only
head(simulate_design(design, sims = c(1, 1, 1, 100, 1)))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.