View source: R/experiment-helpers.R
| generate_data | R Documentation |
DGP in the Experiment.Generate sample data from all DGP objects that were added
to the Experiment, including their varied params. Primarily useful
for debugging. Note that results are not generated in parallel.
generate_data(experiment, n_reps = 1, ...)
experiment |
An |
n_reps |
The number of datasets to generate per |
... |
Not used. |
A list of length equal to the number of DGPs in the
Experiment. If the Experiment does not have a
vary_across component, then each element in the list is a list
of n_reps datasets generated by the given DGP. If the
Experiment does have a vary_across component, then each
element in the outermost list is a list of lists. The second layer of
lists corresponds to a specific parameter setting within the
vary_across scheme, and the innermost layer of lists is of
length n_reps with the dataset replicates, generated by the
DGP.
# create DGP to generate data from normal distribution with n samples
normal_dgp <- create_dgp(
.dgp_fun = function(n) rnorm(n), .name = "Normal DGP", n = 10
)
# create DGP to generate data from binomial distribution with n samples
bernoulli_dgp <- create_dgp(
.dgp_fun = function(n) rbinom(n, 1, 0.5), .name = "Bernoulli DGP", n = 10
)
# initialize experiment with toy DGPs only
experiment <- create_experiment(name = "Experiment Name") |>
add_dgp(normal_dgp) |>
add_dgp(bernoulli_dgp)
# generate data from all DGPs (and vary across components if applicable)
# in experiment
generate_data(experiment, n_reps = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.