simulate_samples: Simulate Sample from a Population Grouped by Items

View source: R/bootstrap_samples.R

simulate_samplesR Documentation

Simulate Sample from a Population Grouped by Items

Description

This function allows you to simulate samples across various sample sizes when the data (optionally) has repeated measures items.

Usage

simulate_samples(
  start = 20,
  stop = 100,
  increase = 5,
  population,
  replace = TRUE,
  nsim = 100,
  grouping_items = NULL
)

Arguments

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

Value

samples

The simulated samples for each tested sample size.

Examples


# 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]]


SemanticPriming/semanticprimeR documentation built on Dec. 5, 2024, 7:59 p.m.