View source: R/bootstrap_samples.R
simulate_samples | R Documentation |
This function allows you to simulate samples across various sample sizes when the data (optionally) has repeated measures items.
simulate_samples(
start = 20,
stop = 100,
increase = 5,
population,
replace = TRUE,
nsim = 100,
grouping_items = NULL
)
start |
Sample size for the smallest potential sample |
stop |
Sample size for the largest potential sample |
increase |
Number to increase the sample size with for each potential sample |
population |
The population data set or the pilot dataset |
replace |
A TRUE/FALSE value to simulate with replacement |
nsim |
The number of simulations/samples you want to return |
grouping_items |
The names of columns to group your data by for the simulation, usually this column is the item column |
The simulated samples for each tested sample size.
# step 1 create data like what I think I'll get or use your own
pops <- simulate_population(mu = 4, mu_sigma = .2, sigma = 2,
sigma_sigma = .2, number_items = 30, number_scores = 20,
smallest_sigma = .02, min_score = 1, max_score = 7, digits = 0)
# step 3 simulate samples
samples <- simulate_samples(start = 20, stop = 100,
increase = 5, population = pops,
replace = TRUE, grouping_items = NULL)
# notice just 20 items
samples[[1]]
samples <- simulate_samples(start = 20, stop = 100,
increase = 5, population = pops,
replace = TRUE, grouping_items = "item")
# notice 20 rows per item
samples[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.